Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As part of a larger complex, is a small office building with 4 computers. It has a single cat5 run to a non-managed switch that has 4 computers connected to it.

Since I can't ping the switch, the only way I can tell if that network is up is by pinging the computers. But the ladies in that office tend to turn the computers off on holidays, weekend, when they fell like it, etc. 99% of the time, at least 1 computer is on.

What I want to do is have Nagios send a notification only if all 4 computers go missing. Aka, the switch died or a FSB (fiber seeking backhoe) had some fun in the area. I don't think Nagios host check dependencies will do this from what I have been reading.

Any other way to do this?

share|improve this question
Does the switch support SNMP? Some non-managed switches do, in which case you could monitor it that way. – John Gardeniers Apr 3 '11 at 22:13
up vote 2 down vote accepted

Writing your own small plugin that does this shouldn't be too difficult, as simple test plugins are really easy to write, all they have to do is to return an exit code and a line of text that nagios interprets (see the doc).

Edit: I had a minute of time, so here is an extremely simple example on how to go for such a test:


ping -c 3 host1 > /dev/null        
if [ "$?" -eq "0" ]; then
   echo "OK - answer from host1"
   exit 0

ping -c 3 host2 > /dev/null        
if [ "$?" -eq "0" ]; then
   echo "OK - answer from host2"
   exit 0

echo "Fail - no host answers"
exit 2

This will simply send three pings to the hosts and exit with a return value of 0 if a host answers and finally exit with a value of 2 if none could be reached.

share|improve this answer
I didn't think of doing it that way, but this will work excellent. Thank you. – Porch Apr 4 '11 at 1:24

Well, four machines make a cluster, no? See in the documentation for an indication on how to create an "OR" check; one that notifies only when several conditions occur.

share|improve this answer
check_cluster was the command I was looking for. Thank you. But SvenW below came up with a script that will make the job cleaner. – Porch Apr 4 '11 at 1:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.