Nagios外部コマンド

#!/bin/sh
NOW='date +%s'

case $1 in
	"off")
	COMMAND="DISABLE"
	;;
	"on")
	COMMAND="ENABLE"
	;;
	*)
	echo "error: option not exists."
        exit
	;;
esac

for HOST in `cat list`
do
	echo "[$NOW] ${COMMAND}_HOST_NOTIFICATIONS;$HOST;$NOW" \
	> /usr/local/nagios/var/rw/nagios.cmd
	echo "[$NOW] ${COMMAND}_HOST_SVC_NOTIFICATIONS;$HOST;$NOW" \
	> /usr/local/nagios/var/rw/nagios.cmd
done

使用可能な全コマンドの一覧

External Command List