Skip to content

Instantly share code, notes, and snippets.

@MichinobuMaeda
Last active December 23, 2015 10:29
Show Gist options
  • Save MichinobuMaeda/6622161 to your computer and use it in GitHub Desktop.
Save MichinobuMaeda/6622161 to your computer and use it in GitHub Desktop.
Nagios: check all smtp servers. If one of them is ok, return ok. Usage: check_smtp_all.sh host1 [host2 [...]]
#!/bin/bash
for TRG in $@
do
STT=`/usr/local/nagios/libexec/check_smtp -H $TRG`
if echo $STT | grep -q "SMTP OK"
then
echo $STT
exit 0
fi
done
echo $STT
exit 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment