Nagios Notifications
Nagios Notifications
Is there a command I can run that looks to see if Nagios notifications are enabled? I want to make something that emails us if Nagios notifications are disabled at a certain time of day.
Re: Nagios Notifications
Yes. You can use the json api to get this information if you are running core4 and XI 2014:
Or you can use the XML XI backend to get the programstatus:
Code: Select all
http://<ip>/nagios/cgi-bin/statusjson.cgi?query=programstatusCode: Select all
http://<ip>/nagiosxi/backend/?cmd=getprogramstatusFormer 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: Nagios Notifications
Do you know how I could output the XML XI backend into a file?
Re: Nagios Notifications
uh, depends. You can just wget it to a file. Curl it, and then redirect to a file. Save it in your browser. Many ways to do this. How are you retrieving it?
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: Nagios Notifications
I tried to wget it, but how do I get past the fact that it needs a username and password? I think curl is the way to go, but I don't know what type of authentication to use.
Re: Nagios Notifications
You can embed the basic auth credentials in the url for the core json api:
Redirect it to a file with:
You can add a ticket id to the XI XML url to pull the XML without a login. You can get the ticket id from the backend url component. Go to --> Admin --> Manage Components --> Backend.
Select the user you wish to log in as (I suggest a read-only user), and then copy the last two get parameters (user and ticket) from the any of the urls.
Code: Select all
curl -k http://nagiosadmin:<password>@<nagios server ip>/nagios/cgi-bin/statusjson.cgi?query=programstatusCode: Select all
curl -k http://nagiosadmin:<password>@<nagios server ip>/nagios/cgi-bin/statusjson.cgi?query=programstatus > /tmp/programstatus.jsonSelect the user you wish to log in as (I suggest a read-only user), and then copy the last two get parameters (user and ticket) from the any of the urls.
Code: Select all
curl -k http://<ip>/nagiosxi/backend/?cmd=getprogramstatus&username=<user>&ticket=<ticket id string>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: Nagios Notifications
I have the @ sign in my password so it says how do i get past this?
Code: Select all
curl: (6) Couldn't resolve host '@[email protected]'- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Nagios Notifications
Change your password so it doesn't have an @ symbol.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios Notifications
I just html encoder it changed the @ sign into %40, this thread can be closed.