Page 1 of 1

How can I monitor a Nagios Server from external server?

Posted: Fri Oct 06, 2017 9:04 pm
by jobst
Hi

My nagios server sits behind a firewall wall in a DMZ zone. If the server itself is down OR the nagios daemon has fallen over it will not be able to send messages to the admins and we wouldn't have a clue that something is wrong with any of the machines/services it monitors.

I already have some checks (e.g. ping) from one of my servers I have in a datacenter, this one will send us admins a SMS if the hosts it monitors are not happy.

How can I check a Nagios server itself that it is alive and well?
Is there any flag I can POST to "status.cgi" that will just return "I am OK!"?

Thanks
Jobst

Re: How can I monitor a Nagios Server from external server?

Posted: Mon Oct 09, 2017 7:26 am
by mcapra
jobst wrote: Is there any flag I can POST to "status.cgi" that will just return "I am OK!"?
check_http should work to check the front-end, but that won't tell you anything about whether or not the Nagios Core daemon is running. Like so:

Code: Select all

[root@capra_nag ~]# /usr/local/nagios/libexec/check_http -H localhost -u /nagios/cgi-bin/status.cgi -a nagiosadmin:hunter2 -e 200
HTTP OK: Status line output matched "200" - HTTP/1.1 200 OK - 50068 bytes in 0.026 second response time |time=0.025602s;;;0.000000 size=50068B;;;0
With that check, I'm making sure a status code of 200 is received when accessing status.cgi. The way many people monitor a Nagios Core instance is to have a 2nd Nagios Core instance. You could set up an agent on your master Nagios Core instance and have the secondary Nagios Core instance be responsible for checking in on it.

Re: How can I monitor a Nagios Server from external server?

Posted: Mon Oct 09, 2017 11:35 am
by scottwilkerson
Thanks @mcapra

I also will add that many people monitor their monitoring server from a second Nagios server.

I would suggest monitoring it just like you would any other critical server/service.

Install NRPE, on your monitoring server, monitor disk, load, memory and the nagios service at the very minimum.

Re: How can I monitor a Nagios Server from external server?

Posted: Mon Oct 16, 2017 12:24 am
by jobst
scottwilkerson wrote:Thanks @mcapra
I also will add that many people monitor their monitoring server from a second Nagios server.
I would suggest monitoring it just like you would any other critical server/service.
Install NRPE, on your monitoring server, monitor disk, load, memory and the nagios service at the very minimum.
Isn't that a little overkill?
I think it would be a good idea if there is a script (as part of Nagios) running on an external server scheduled by crontab that sources a special cgi script raising an alarm via email/sms/XYZ when the Nagios server does not respond. This way you make sure, too, that the Internet connection that is utilised by the Nagios server is monitored.
That monitor could also be part of the set of machines the Nagios server monitors anyway.

No need to look after more daemons - I already have enough of them in my head.

Jobst

Re: How can I monitor a Nagios Server from external server?

Posted: Mon Oct 16, 2017 1:57 pm
by mcapra
jobst wrote: I think it would be a good idea if there is a script (as part of Nagios) running on an external server scheduled by crontab that sources a special cgi script raising an alarm via email/sms/XYZ when the Nagios server does not respond.
You're more than welcome to submit a request on the GitHub. I know of at least one recent issue raised for similar functionality:
https://github.com/NagiosEnterprises/na ... issues/428

The script itself would be trivial; Whether or not it is implemented is more a general lifecycle/support discussion that would need to happen.

Re: How can I monitor a Nagios Server from external server?

Posted: Mon Oct 16, 2017 2:47 pm
by kyang
Thanks @mcapra!