Hi,
Using the nagios web interface is it possible to extract the contactgroups associated with a server and the e-mail addresses associated with the contactgroups?
The reason I ask is that I'm using curl to control and report on my Nagios instance and I want to use the same technique for a script I am developing. If I could work out how to get the information on screen I could easily work out the curl command.
David
Seeing contactgroup information via the web UI
Re: Seeing contactgroup information via the web UI
There are a few ways to get this information.
1. You could create a script that parses the objects.cache file for the desired information. Depending on how you named objects, this can be difficult to parse (and cannot be curled).
2. Utilize a combination of configuration pages:
The following will give you a single row table with the host object information (including contacts and contactgroups)
The next url will show you a table of the members of the contact group in question:
The final url will show you a table of the contact, including the email address:
With these three urls, you should be able to write logic to curl and parse to variables in your script. Best of luck!
1. You could create a script that parses the objects.cache file for the desired information. Depending on how you named objects, this can be difficult to parse (and cannot be curled).
2. Utilize a combination of configuration pages:
The following will give you a single row table with the host object information (including contacts and contactgroups)
Code: Select all
http://<ip>/nagios/cgi-bin/config.cgi?type=hosts&expand=<host name>Code: Select all
http://<ip>/nagios/cgi-bin/config.cgi?type=contactgroups&expand=<contactgroup>Code: Select all
http://<ip>/nagios/cgi-bin/config.cgi?type=contacts&expand=<contact>Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Seeing contactgroup information via the web UI
Simply beautiful! I've not scripted it yet, but the URLs are exactly what I need - scripting it will be easy from here. Much appreciated.
Rotty
Rotty
Re: Seeing contactgroup information via the web UI
Good luck! Closing thread, feel free to open another if you need it.
Former Nagios employee