Nagios Notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rentsys
Posts: 98
Joined: Wed Oct 16, 2013 11:57 am

Nagios Notifications

Post by rentsys »

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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Notifications

Post by abrist »

Yes. You can use the json api to get this information if you are running core4 and XI 2014:

Code: Select all

http://<ip>/nagios/cgi-bin/statusjson.cgi?query=programstatus
Or you can use the XML XI backend to get the programstatus:

Code: Select all

http://<ip>/nagiosxi/backend/?cmd=getprogramstatus
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.
rentsys
Posts: 98
Joined: Wed Oct 16, 2013 11:57 am

Re: Nagios Notifications

Post by rentsys »

Do you know how I could output the XML XI backend into a file?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Notifications

Post by abrist »

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.
rentsys
Posts: 98
Joined: Wed Oct 16, 2013 11:57 am

Re: Nagios Notifications

Post by rentsys »

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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Notifications

Post by abrist »

You can embed the basic auth credentials in the url for the core json api:

Code: Select all

curl -k http://nagiosadmin:<password>@<nagios server ip>/nagios/cgi-bin/statusjson.cgi?query=programstatus
Redirect it to a file with:

Code: Select all

curl -k http://nagiosadmin:<password>@<nagios server ip>/nagios/cgi-bin/statusjson.cgi?query=programstatus > /tmp/programstatus.json
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://<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.
rentsys
Posts: 98
Joined: Wed Oct 16, 2013 11:57 am

Re: Nagios Notifications

Post by rentsys »

I have the @ sign in my password so it says

Code: Select all

curl: (6) Couldn't resolve host '@[email protected]'
how do i get past this?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios Notifications

Post by Box293 »

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.
rentsys
Posts: 98
Joined: Wed Oct 16, 2013 11:57 am

Re: Nagios Notifications

Post by rentsys »

I just html encoder it changed the @ sign into %40, this thread can be closed.
Locked