diff options
Diffstat (limited to 'abs/core/xymon/hobbit_notify.sh')
-rw-r--r-- | abs/core/xymon/hobbit_notify.sh | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/abs/core/xymon/hobbit_notify.sh b/abs/core/xymon/hobbit_notify.sh index 7569e2a..742b3db 100644 --- a/abs/core/xymon/hobbit_notify.sh +++ b/abs/core/xymon/hobbit_notify.sh @@ -1,4 +1,5 @@ #!/bin/bash +. /etc/systemconfig # # BBCOLORLEVEL - The color of the alert: "red", "yellow" or "purple" # BBALPHAMSG - The full text of the status log triggering the alert @@ -14,35 +15,65 @@ # RECOVERED - Is "1" if the service has recovered. # DOWNSECS - Number of seconds the service has been down. # DOWNSECSMSG - When recovered, holds the text "Event duration : N" where -echo $BBCOLORLEVEL > /tmp/hobbitout -echo $BBALPHAMSG >>/tmp/hobbitout -echo $RCPT >>/tmp/hobbitout -echo $BBHOSTNAME >>/tmp/hobbitout -echo $BBSVCNAME >>/tmp/hobbitout -echo $BBHOSTSVC >>/tmp/hobbitout + + +# echo $BBCOLORLEVEL > /tmp/hobbitout +# echo $BBALPHAMSG >>/tmp/hobbitout +# echo $RCPT >>/tmp/hobbitout +# echo $BBHOSTNAME >>/tmp/hobbitout +# echo $BBSVCNAME >>/tmp/hobbitout +# echo $BBHOSTSVC >>/tmp/hobbitout #BBCOLORLEVEL=red #BBCOLORLEVEL=yellow #BBALPHAMSG="vmtest:disk red [751147]" -#BBHOSTNAME="vmtest" +#BBHOSTNAME="testcraa" #BBSVCNAME="disk" +#BBSVCNAME="func" #BBHOSTSVC="vmtest.disk" -if [ x$BBSVCNAME = xdisk ] -then - case $BBCOLORLEVEL in - red ) - /usr/bin/notify.py ALT "$BBHOSTNAME disk is full" - ;; - yellow ) +#/usr/LH/bin/msg_client.py --msg "$BBCOLORLEVEL\n$BBHOSTSVC" +#/usr/bin/func "*" call msg display + +function msg_func_out() { + /usr/bin/func "*" call msg display "${1}" +} + +function msg_local_out() { + + /usr/LH/bin/msg_client.py --msg "${1}" + + } + - /usr/bin/notify.py PHN "$BBHOSTNAME disk almost full " - ;; - esac -fi +case x$BBSVCNAME in + xdisk) + case $BBCOLORLEVEL in + red ) + msg_func_out "$BBHOSTNAME disk is at 95% full or greater|alert" + ;; + yellow ) + msg_func_out "$BBHOSTNAME disk is almost full" + ;; + esac + ;; + + xfunc) + if [ "x$hostname" = "x$BBHOSTNAME" ] + then + msg_local_out "System can not communicate with itself (func) |alert" + else + msg_func_out "$hostname can not communicate with $BBHOSTNAME (func)|alert" + fi + ;; + *) + #catch all for everything else + msg_func_out "Condition $BBCOLORLEVEL\n$BBHOSTNAME $BBSVCNAME\n Please check the system health webpage|alert" + ;; +esac |