Page 1 of 1

API or CLI host list

Posted: Mon Jul 27, 2020 7:17 am
by dariusz.nalazek
Hello.

How to list servers or even better server’s group (host lists) using API?
Or save https://nagios_logsever_server/nagioslogserver/reports/hosts to csv report file from CLI (bash script)…

I can't find it in online documentation :(

DarekN.

Re: API or CLI host list

Posted: Mon Jul 27, 2020 5:01 pm
by benjaminsmith
HI DarekN,

That's a good question, and I can double-check this as well, but the best option is to use hosts report as CSV to retrieve this information.

Benjamin

As a future reference and to supplement what's in the gui documentation, the following page as some handy API examples for Log Server.
https://support.nagios.com/kb/article/n ... s-596.html

Re: API or CLI host list

Posted: Thu Jul 30, 2020 3:27 am
by dariusz.nalazek
Yes please, check it out.
I wish to get some automation to receive these data.
Manual download is good only from time to time, not for daily monitoring of amount of hosts registered or/and sending data.

DarekN.

Re: API or CLI host list

Posted: Thu Jul 30, 2020 2:23 pm
by benjaminsmith
Hi DarekN,

I looked into this and right now it's possible to pull reports from the API.

Let me know if you have any other questions.

Re: API or CLI host list

Posted: Fri Jul 31, 2020 1:38 am
by dariusz.nalazek
Great,

but where I can find full API command references for Nagios LS? …or at last the part with listing servers (or pulling report, as u mentioned).
On the examples web page there is no info about listing servers... and I can’t find API documentation on website.

DarekN.

Re: API or CLI host list

Posted: Fri Jul 31, 2020 4:30 pm
by benjaminsmith
Hi DarekN,

You'll find the API reference in the user interface, just go to Help > References > API Reference.

Let me know if you have any more questions.

Benjamin

Re: API or CLI host list

Posted: Sat Aug 01, 2020 10:58 am
by dariusz.nalazek
I was hoping more straightforward answer then riddles :D ..since you checked it out and posted it's there.

Help > References > API Reference, It's usefull information, there is description how to access alarm history, logstash log, dashboards, ...but I can't see any clue how to get host raport or json dictionary with host list.

Re: API or CLI host list

Posted: Mon Aug 03, 2020 1:51 pm
by benjaminsmith
HI,

Apologies for any confusion. As mentioned, it's not possible to generate that type of report from the API. The best workaround would be to download the unique hosts report as a CSV file.

Re: API or CLI host list

Posted: Mon Aug 03, 2020 3:41 pm
by dariusz.nalazek
benjaminsmith wrote:(...)
I looked into this and right now it's possible to pull reports from the API.
(...)
OK, I see, so it's not possible after all.

It would be nice feature for monitoring purposes, maybe you could post it to LS road map as customer request/idea/vote.

Thank you for help, and information.

Re: API or CLI host list

Posted: Mon Aug 03, 2020 3:52 pm
by benjaminsmith
Hi,

No problem. I put in an internal feature request on your behalf for this capability.