Check for a specific IP and if not then send alert

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Check for a specific IP and if not then send alert

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check for a specific IP and if not then send alert

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check for a specific IP and if not then send alert

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Check for a specific IP and if not then send alert

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check for a specific IP and if not then send alert

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Check for a specific IP and if not then send alert

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check for a specific IP and if not then send alert

Post by jkinning »

This will work. Thanks for the assistance and you can close this one.
Locked