-
Notifications
You must be signed in to change notification settings - Fork 0
/
host.sh
13 lines (10 loc) · 883 Bytes
/
host.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
HOSTNAME=$1
HOSTSTATE=$2
NOTIFICATIONTYPE=$3
CONTACTEMAIL=$4
HOSTADDRESS=$5
HOSTOUTPUT=$6
EMAIL=`mysql -uroot -p2012 -h10.10.8.35 ops_db -e "select '$HOSTNAME',email from user where id = (select user_id from item where label = '$HOSTNAME') union select '$HOSTNAME',email from user where id = (select owner_id from item where label = '$HOSTNAME')"|grep -vE 'label|email' |awk '{print$2 }'`
#/usr/bin/printf "%b" "$HOSTADDRESS\nInfo: $HOSTOUTPUT\npost time `date |awk '{print$4}'`" | /usr/bin/sendEmail -f [email protected] -t $EMAIL -cc $CONTACTEMAIL -s mail.rt.i.ajkdns.com -u "$NOTIFICATIONTYPE Host Alert: $HOSTNAME is $HOSTSTATE"
/usr/bin/printf "$HOSTADDRESS\nInfo:$HOSTOUTPUT\npost time `date |awk '{print$4}'`" | /usr/bin/sendEmail -f [email protected] -t $EMAIL -cc $CONTACTEMAIL -s 1.1.1.1 -u "$NOTIFICATIONTYPE $HOSTNAME is $HOSTSTATE"