Alert if port is active on 2 hosts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
spcmidrange
Posts: 47
Joined: Fri Jun 15, 2012 12:54 pm

Alert if port is active on 2 hosts

Post by spcmidrange »

Hey Everyone

Thought i would post this question to see if anyone has any ideas. We need to monitor a port on 2 servers, but we only want an alert if port is ACTIVE on BOTH servers. If its active on only one, then that is fine as that is how it should be, but we cannot have both ports active

Anyone have any suggestions best way to monitor/alert with this?

Thanks in advance

Cheers!
User avatar
kfanselow
Posts: 247
Joined: Tue Aug 31, 2021 3:25 pm

Re: Alert if port is active on 2 hosts

Post by kfanselow »

Hi Spcmidrange,

The easiest solution might be to write your own plugin in bash ( or perl or python if you prefer). Writing your own plugin isn't all that difficult and would give you some flexibility in terms of logic and behavior (e.g. - introduce vary a delay between the two ports). One of the advantages of nagios is you can use the existing plugins in your script. For example give this a try on the command line:

/usr/local/nagios/libexec/check_tcp -H 127.0.0.1 -p 22

Here are a couple of resources to help you get started:

https://exchange.nagios.org/directory/T ... pt/details

https://nagios-plugins.org/doc/guidelines.html

https://assets.nagios.com/downloads/nag ... ugins.html

Please let us know if that's helpful.
spcmidrange
Posts: 47
Joined: Fri Jun 15, 2012 12:54 pm

Re: Alert if port is active on 2 hosts

Post by spcmidrange »

Thank you for your reply kfanselow.
We were already thinking that route, but thought we would put it out here to the forum to see if anyone else had other suggestions.

Cheers!
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Alert if port is active on 2 hosts

Post by benjaminsmith »

Hi,

Thanks for posting this. Yeah, a wrapper script to handle the logic would be the recommended approach.

Let us know if you need anything else or if it's okay to close this out.

--Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
spcmidrange
Posts: 47
Joined: Fri Jun 15, 2012 12:54 pm

Re: Alert if port is active on 2 hosts

Post by spcmidrange »

Sorry for the late reply

Thank you for your suggestions. You can close this request

Cheers!
Locked