Change check that marks a host UP/DOWN

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Jtessaro
Posts: 9
Joined: Mon Nov 17, 2014 2:54 pm

Change check that marks a host UP/DOWN

Post by Jtessaro »

We have a number of hardened appliances (Linux -- CentOS/RedHat based) that will not return to pings but are being monitored via SNMP. When added to Nagios these appliances appear to be down due to the ping failure, how can we change the way Nagios decides if a host is up or down? (ex. if the host is open to SSH it is up)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Change check that marks a host UP/DOWN

Post by tmcdonald »

This is as simple as changing the check command that is run. So instead of using check_icmp or check_ping, you can give it something like check_tcp or check_snmp with a specific OID that will respond positively.
Former Nagios employee
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Change check that marks a host UP/DOWN

Post by eloyd »

To answer with the specific example you used, you can use check_ssh to probe the SSH port. If you use a non-standard SSH port that's different on each machine, you can use custom host variables and pass the variable to the check_ssh command via the -p <port> parameter:

Code: Select all

check_command     $USER1$/check_ssh -H $HOSTADDRESS$ p $_HOSTSSH_PORT
This assumes you define a custom host variable called _SSH_PORT on each host.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Change check that marks a host UP/DOWN

Post by slansing »

Thank you for the example Eloyd! Yep, it really is as easy as just changing the check command.
Locked