1

This might be a basic question for some of you but being a beginner i wanted to know how to export or import data of the current status(CPU, Memory, Diskspace etc) of the host from command line into a CSV/JSON/XML format. THis is to provide daily reports in a readable format to our management team. Below is brief of what we are running,

We have a nagios server in the backend and we are using Icinga on the frontend to see host status, graphs etc. On the Icinga when i check the current status of the host i do see an option to "Export to CSV" in the browser but i wanted to get this data from the command line so i can automate this process for multiple hosts. Is there a way to simply run some commands and download the current status of a host(Windows or Linux) from command line?

Thanks and any help will be much appreciated!

Keith
  • 4,627
  • 14
  • 25
user95198
  • 41
  • 1
  • 5
  • Just wanted to add the command i am using to give a clearer view of my problem, curl -o test/test2 -u user:password http://10.0.0.1/icinga/cgi-bin/status.cgi/host=10.0.0.2&csvoutput In the above URL 10.0.0.1 is the Icinga server and using the above URL i am trying to download data of host 10.0.0.2. This works but its downloading data of all the hosts currently running on Icinga. I only need data specific to the host and not for all the hosts on the Icinga server. – user95198 Feb 12 '15 at 01:49

2 Answers2

1

Icinga natively supports JSON output in status.cgi.

By constructing the right filter arguments, you can get JSON of anything that status.cgi can display. For example, something like:

status.cgi?hoststatustypes=3&serviceprops=2097162&servicestatustypes=20&jsonoutput

Keith
  • 4,627
  • 14
  • 25
1

Thanks Keith. I got it fixed. Just added double quotes to the URL and that did the job :)

curl -o test/test2 -u user:password "http://10.0.0.1/icinga/cgi-bin/status.cgi/host=10.0.0.2&csvoutput"

user95198
  • 41
  • 1
  • 5