Page 1 of 1
Check for a specific IP and if not then send alert
Posted: Thu Jan 25, 2018 2:23 pm
by jkinning
I have an Exchange cluster, don't know much about it, but the Exchange admin asked if Nagios can monitor the DAG cluster. There are 3 here in the Home Office using 10.131.x.x addresses and 1 in our DR site using 10.115.x.x. If this DAG ever gets a 10.115.x.x address a notification should be sent to them so they can correct the group so the 10.131.x.x is the primary online system.
Has anyone setup such a check or is there a better way to accomplish this monitoring.
Re: Check for a specific IP and if not then send alert
Posted: Fri Jan 26, 2018 11:54 am
by cdienger
Is it really for a specific IP or is it for a range? If you want to check for a specific IP a simple check-host-alive check would do this.
Another option would be to configure the client to use a custom script that just sends it's IP address to Nagios. Assuming that DNS is updated when the client gets a new IP and Nagios, the check would come in via the correct hostname but with an alert that the IP has changed.
Re: Check for a specific IP and if not then send alert
Posted: Fri Jan 26, 2018 2:42 pm
by jkinning
In this case a range. I don't want it to have the 10.115 address. If it does I want a notification so I can change it back to a 10.131 address.
Re: Check for a specific IP and if not then send alert
Posted: Fri Jan 26, 2018 4:19 pm
by tgriep
Have you tried the DNS Query Wizard?
You put in the hostname and the expected IP addresses and it they are not correct, it will generate an alert.
Re: Check for a specific IP and if not then send alert
Posted: Wed Feb 07, 2018 8:39 am
by jkinning
But in this case this host would be alright if it has one of 2 different IP addresses. The 10.131 network is alright but if it has the 10.115 I need to send out a notification. Is there a way to check and say if the host has the 10.115 address send out the notification since the other options would be OK, using the 10.131.
Re: Check for a specific IP and if not then send alert
Posted: Wed Feb 07, 2018 10:06 am
by tgriep
That is what the check_dns plugin does, you give it a host name to look up and if the expected IP address is not returned, it will generate a Critical Alert.
This example is checking
www.google.com for it to return the IP address of 172.217.8.196 and it did and the check was IP.
Code: Select all
/usr/local/nagios/libexec/check_dns -H www.google.com -a 172.217.8.196
DNS OK: 0.038 seconds response time. www.google.com returns 172.217.8.196|time=0.038112s;;;0.000000
I ran it again and it did not get the expected IP address and it generated a Critical Alert.
Code: Select all
/usr/local/nagios/libexec/check_dns -H www.google.com -a 172.217.8.196
DNS CRITICAL - expected '172.217.8.196' but got '172.217.8.164'
You would use the hostname for your cluster and the IP address 10.131 as the expected address.
Re: Check for a specific IP and if not then send alert
Posted: Fri Feb 09, 2018 9:36 am
by jkinning
This will work. Thanks for the assistance and you can close this one.