Page 1 of 5
Send alert for server uptime
Posted: Thu Jul 30, 2015 2:27 am
by jamesc23
Hi,
I'm looking for a plugin which will alert specific uptime for windows server. I've looked at check_uptime but I couldn't get it to install.
I'm very new to Nagios. Can someone please help me?
Thanks.
Re: Send alert for server uptime
Posted: Thu Jul 30, 2015 9:05 am
by lmiltchev
I've looked at check_uptime but I couldn't get it to install.
What are the specific issues that you ran into? What have you tried so far? The basic steps for installing a plugin would be:
1. Copy the plugin to the "/usr/local/nagios/libexec" directory. You can do this manually or install the plugin in the web UI by going to:
Admin->Manage Plugins->Browse->...->Upload Plugin
2. Test the plugin in the CLI and make sure it works.
3. Create a command and a service check in Nagios XI.
For more info, please read the document below:
https://assets.nagios.com/downloads/nag ... lugins.pdf
Re: Send alert for server uptime
Posted: Thu Jul 30, 2015 7:59 pm
by jamesc23
Hi,
So I managed to upload the plugin manually as I was getting permission related error. I can run the command against the local host itself. I'm having no luck in trying to run this against remote windows server.
Is it possible to just run check_uptime without SNMP? We don't enable SNMP on windows servers and we have over 300 servers.
Thanks.
Re: Send alert for server uptime
Posted: Thu Jul 30, 2015 8:09 pm
by Box293
You could use NSClient++ as it has a built in uptime check, however this requires installing NSClient++ on your windows servers.
Another possibility might be available by check_wmi_plus, however this requires enabling WMI so once again you need to do something to the windows servers.
How do you currently monitor your windows servers?
Re: Send alert for server uptime
Posted: Thu Jul 30, 2015 10:27 pm
by jamesc23
Yes, we use NSClient++ on all of our windows servers. Can you please shed some light on this?
Also, please bear in mind that I would like to have alerts to be sent out when uptime is above xxx days.
Re: Send alert for server uptime
Posted: Thu Jul 30, 2015 11:12 pm
by Box293
I would use check_nrpe in NSClient++ instead of check_nt as it is more flexible.
Check if the system uptime is longer than 1 day. Critical alert if system has been has been running for longer than one day.
Code: Select all
Command:
check_nrpe -H 192.168.142.1 -t 30 -c CheckUpTime -a MaxCrit=1d
Output:
OK all counters within bounds.|'uptime'=3281000;0;86400000
If you need to enable nrpe in NSClient++ 0.4.x, the following commands will do it:
Open a command prompt
Type
cd "\Program Files\NSClient++\" and press Enter
Type
nscp settings --activate-module NRPEServer --add-defaults and press Enter
Type
nscp settings --path /settings/NRPE/server --key "allow arguments" --set true and press Enter
Type
nscp settings --path /settings/NRPE/server --key "allow nasty characters" --set true and press Enter
Type
nscp service --stop and press Enter
Wait for the service to stop
Type
nscp service --start and press Enter
Wait for the service to start
Here are some uptime examples:
http://sites.box293.com/nagios/guides/c ... cks/uptime
Here is some commands for manipulating NSClient++ 0.4.x ini files:
http://sites.box293.com/nagios/guides/n ... t-ini-file
Re: Send alert for server uptime
Posted: Fri Jul 31, 2015 12:29 am
by jamesc23
OK, thanks very much for your assistance so far.
I'm also there. The reading is still a bit confusing to me.
CRITICAL: uptime: 40w 251d 5974:357951 > critical
I've set the critical alert at 280 days with -a MaxCrit=280d. If I read the status correctly, it says 251d. Am I missing something?
Thanks.
Re: Send alert for server uptime
Posted: Fri Jul 31, 2015 1:40 am
by Box293
Interesting. Here's a test I did:
Command:
./check_nrpe -H win2008r2-01 -t 30 -c CheckUpTime -a MaxCrit=28d
Output:
CRITICAL: uptime: 4w 1d 2:9 > critical|'uptime'=2513363000;0;2419200000
So this number:
2513363000
Seems to be milliseconds, which equals roughly 4w 1d 2h 9m perhaps?
Perhaps 280 days causes some calulation problems? What is the full output you are getting, the performance data string will be helpful?
What version of NSClient++ are you running?
Re: Send alert for server uptime
Posted: Fri Jul 31, 2015 1:49 am
by jamesc23
Yeah. I just tried to run the command and I got the same number as you. The first reading of CRITICAL: uptime: 40w 251d 5974:357951 > critical was from the web based status information. I will ignore this for now as I can see the alert is working properly. Just that the reading I got within the email alert is showing some weird number.
We're using very old client NSCLient++ - 0.3.8.76
Upgrade will probably happen in a very near future.
I'm now looking at a way to change or implement this service all to windows servers within Nagios. We currently have uptime using check_nt service setup for all windows servers. I would like to modify current uptime service to use check_nrpe on a server, then cascade this to all servers. Is this possible? Is there an easier way of trying to achieve this?
Re: Send alert for server uptime
Posted: Fri Jul 31, 2015 1:54 am
by Box293
From the NSClient++ side, you should be able to replace the nsc.ini with an updated one so it enables nrpe and and the restart the service, you could do this with psexec I think.
From the Nagios side, simply create a hostgroup of all your windows servers and assign your nrpe uptime service to that hostgroup and all those hosts will get that service. I would not try to use the same service name as the check_nt performance data will probably be different and cause problems with your rrd files.