#!/bin/bash clear echo ---------------------------------------------------- echo USAGE: echo ./ALERT [HOSTNAMES] echo EXAMPLE: echo ./ALERT "'"SMAF1009"|"SMAF0010"'" echo ---------------------------------------------------- echo testing sound mplayer -really-quiet /usr/share/sounds/gaim/redalert.wav > /dev/null 2>/dev/null for i in {0..10000} do wget -q -O temp.html --user=nmc --password=nmc "http://localhost/nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=4&hostprops=42" #export var1=`cat temp.html | grep statusHOSTDOWN | grep cgi | egrep -v "($1)"` export var1=`lynx -nolist -width=999 -auth nmc:nmc -dump "http://localhost/nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=4&hostprops=42" | tr -d '\n' | sed 's/.*Status Information//g' | awk '{gsub("seconds","\n"); print}' | grep -v "0d 0h [0-9]m" | grep -v "0d 0h 1[0-5]m" | grep -v Displayed | grep -v flapping | egrep -v "($1)"` if [[ "$var1" != "" ]] then mplayer -really-quiet /usr/share/sounds/gaim/redalert.wav > /dev/null 2>/dev/null echo $var1 else clear echo NO NEW ITEMS echo current items ignored: $1 fi echo sleeping for 5min sleep 60 sleep 60 sleep 60 sleep 60 sleep 60 done