I am looking for a way to ping our server farms load balancer every second. I thought about creating a new template for it and defining the interval inside the template but the pre-flight bombs each time I try to use the interval settings. After digging a bit deeper, I found the time_interval setting inside the main nagios.cfg file, but that would change it for all ping checks. I would like to only ping the frontend IP address of the load balancer each second and leave the 5 / 1 / 1/ 1/ 1 rule in place for servers behind the balancer.
Any suggestions?
If this can work as I hope, I would probably switch our firewall HA pairs to the once-per-second rate as well.
Template to ping every second
Re: Template to ping every second
The first thing I need to point out is that we do not recommend changing the time_interval setting. This has major repercussions for the timing of every other check, and if you are not careful to keep this in mind you can easily overload your system. In addition, a ping check by default sends multiple ICMP packets a few seconds apart, so you will need to make sure you are just sending one. Expect a few false positives.
That being said if you really want to do this, set the time_interval to 1, and multiply every other time setting by 60.
That being said if you really want to do this, set the time_interval to 1, and multiply every other time setting by 60.
Former Nagios employee
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Template to ping every second
Code: Select all
while [ 1 ]; do
if [ `ping -c 2 loadbalancer | grep "0 received" | wc -l` -gt 0 ]; then
printf "load balancer\t2\tholy moly things are broke\n" | send_nsca.sh -H localhost;
fi
done-
Cyber Saiyan
- Posts: 14
- Joined: Mon Jun 15, 2015 7:01 am
Re: Template to ping every second
jdalrymple,
Is this a perl script that I would need to create and launch?
Is this a perl script that I would need to create and launch?
Re: Template to ping every second
Bash script, not perl, but the same idea. I would fork it into the background so it doesn't require a running terminal session. It needs to be run on the Nagios system.
Essentially what this does is ping every second, and if there is no response it will fire off a passive result to Nagios.
Essentially what this does is ping every second, and if there is no response it will fire off a passive result to Nagios.
Former Nagios employee