summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2013-11-27 22:39:54 (GMT)
committerJames Meyer <james.meyer@operamail.com>2013-11-27 22:39:54 (GMT)
commit83df5fbd0c9dcfbb4ea943fd317df153cebb0097 (patch)
treec613faf26d9632f4521ebec8d027d120ea52030d
parent82e79deb33a3e21737fa28d15cea63b4ae151037 (diff)
downloadlinhes_pkgbuild-83df5fbd0c9dcfbb4ea943fd317df153cebb0097.zip
linhes_pkgbuild-83df5fbd0c9dcfbb4ea943fd317df153cebb0097.tar.gz
linhes_pkgbuild-83df5fbd0c9dcfbb4ea943fd317df153cebb0097.tar.bz2
xymon: add login_notify.sh. This will write out and remove alert files to be parsed by myth_status
refs #943 refs #945
-rwxr-xr-xabs/core/xymon/PKGBUILD13
-rwxr-xr-xabs/core/xymon/alerts.cfg8
-rw-r--r--abs/core/xymon/login_notify.sh64
3 files changed, 78 insertions, 7 deletions
diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index a0c603b..96aa82f 100755
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,14 +1,14 @@
pkgbase=xymon
pkgname=(xymonserver xymonclient)
pkgver=4.3.5
-pkgrel=50
+pkgrel=51
pkgdesc="Hobbit is a system for monitoring servers and networks. "
license="GPL"
arch=('i686' 'x86_64')
url="http://www.xymon.com/"
-source=(http://hivelocity.dl.sourceforge.net/project/xymon/Xymon/4.3.5/xymon-4.3.5.tar.gz hobbitadd.py xymon_ghost_check graph.cfg.diff xymonserver.cfg.diff tasks.d.mv clientlaunch.cfg.patch hobbitstorage.py hbnotes.py hobbit-myth-orphan.sh analysis.cfg hbfunc.py be.png tuner.png tv.png hobbit-mem-myth.sh hobbit_notify.sh alerts.cfg hobbit_myth_data.py logrotate-server.xymon logrotate-client.xymon log_list.sh client-local.cfg.patch led_themes.tar.gz xymon-server.rules hosts.cfg.patch)
+source=(http://hivelocity.dl.sourceforge.net/project/xymon/Xymon/4.3.5/xymon-4.3.5.tar.gz hobbitadd.py xymon_ghost_check graph.cfg.diff xymonserver.cfg.diff tasks.d.mv clientlaunch.cfg.patch hobbitstorage.py hbnotes.py hobbit-myth-orphan.sh analysis.cfg hbfunc.py be.png tuner.png tv.png hobbit-mem-myth.sh hobbit_notify.sh login_notify.sh alerts.cfg hobbit_myth_data.py logrotate-server.xymon logrotate-client.xymon log_list.sh client-local.cfg.patch led_themes.tar.gz xymon-server.rules hosts.cfg.patch)
depends=('rrdtool' 'fping' 'pcre' 'python2' 'graphviz' 'LinHES-system>=8.0-5')
@@ -67,6 +67,7 @@ package_xymonserver(){
cat alerts.cfg >> $startdir/pkg/xymonserver/home/xymon/etc/alerts.cfg
install -m755 hobbit_notify.sh $startdir/pkg/xymonserver/home/xymon/server/bin/hobbit_notify.sh
+ install -m755 login_notify.sh $startdir/pkg/xymonserver/home/xymon/server/bin/login_notify.sh
install -m755 $startdir/src/tv.png $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/tv.png
install -m755 $startdir/src/tuner.png $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/tuner.png
install -m755 $startdir/src/be.png $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/be.png
@@ -91,6 +92,9 @@ package_xymonserver(){
patch -p3 < $startdir/src/client-local.cfg.patch || return 1
patch -p3 < $startdir/src/hosts.cfg.patch || return 1
+ #make dir for login alerts
+ mkdir $startdir/pkg/xymonserver/home/xymon/var/login_alerts
+
#fix permissions
chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/
chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/
@@ -99,6 +103,8 @@ package_xymonserver(){
chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/snap/
chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/rep/
chmod 750 $startdir/pkg/xymonserver/etc/sudoers.d
+ chmod 775 $startdir/pkg/xymonserver/home/xymon/var/login_alerts
+
}
@@ -137,7 +143,8 @@ md5sums=('31923ec126fe1c264fceb459d2175161'
'0469d775db9fdd18ea95dd41937ada82'
'0757294eec13771f8e63da23cf066796'
'6baa410da1dfb86435191f4805186ea7'
- '81715c58ae495812da0e0f18e2f74c76'
+ 'a834dd134b6d640d753b1e26609d37df'
+ '9b5f3079c461f1e0a1b5fb805d073665'
'77a542c2fd13468791ef23057ba8e77d'
'b4e8641e97e6b689dbc634af785e6799'
'e2844513e2c92e8b5084818f3b2a478d'
diff --git a/abs/core/xymon/alerts.cfg b/abs/core/xymon/alerts.cfg
index 4f97f18..3ba26bd 100755
--- a/abs/core/xymon/alerts.cfg
+++ b/abs/core/xymon/alerts.cfg
@@ -119,10 +119,10 @@
HOST=* SERVICE=func
- SCRIPT /home/xymon/server/bin/hobbit_notify.sh 1234567890 FORMAT=SMS DURATION=4h REPEAT=48h COLOR=red
+ SCRIPT /home/xymon/server/bin/hobbit_notify.sh dummy_notice FORMAT=plain DURATION>4h REPEAT=48h COLOR=red
HOST=* SERVICE=* EXSERVICE=conn
- SCRIPT /home/xymon/server/bin/hobbit_notify.sh 1234567890 FORMAT=SMS DURATION=4h REPEAT=12h COLOR=red
-# SCRIPT /home/xymon/server/bin/hobbit_notify.sh 1234567890 FORMAT=SMS DURATION=4H REPEAT=12H COLOR=yellow
-
+ SCRIPT /home/xymon/server/bin/hobbit_notify.sh dummy_notice FORMAT=plain DURATION>4h REPEAT=12h COLOR=red
+ SCRIPT /home/xymon/server/bin/login_notify.sh dummy_notice FORMAT=plain DURATION>5m REPEAT=5m COLOR=red RECOVERED
+
diff --git a/abs/core/xymon/login_notify.sh b/abs/core/xymon/login_notify.sh
new file mode 100644
index 0000000..6696165
--- /dev/null
+++ b/abs/core/xymon/login_notify.sh
@@ -0,0 +1,64 @@
+#!/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
+# ACKCODE - The "cookie" that can be used to acknowledge the alert
+# RCPT - The recipient, from the SCRIPT entry
+# BBHOSTNAME - The name of the host that the alert is about
+# MACHIP - The IP-address of the host that has a problem
+# BBSVCNAME - The name of the service that the alert is about
+# BBSVCNUM - The numeric code for the service. From SVCCODES definition.
+# BBHOSTSVC - HOSTNAME.SERVICE that the alert is about.
+# BBHOSTSVCCOMMAS - As BBHOSTSVC, but dots in the hostname replaced with commas
+# BBNUMERIC - A 22-digit number made by BBSVCNUM, MACHIP and ACKCODE.
+# 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
+
+# LOGIN_OUT=/tmp/login_out
+# echo $BBCOLORLEVEL >> $LOGIN_OUT
+# echo $BBALPHAMSG >>$LOGIN_OUT
+# echo $RCPT >>$LOGIN_OUT
+# echo $BBHOSTNAME >>$LOGIN_OUT
+# echo $BBSVCNAME >>$LOGIN_OUT
+# echo $BBHOSTSVC >>$LOGIN_OUT
+# echo $BBHOME >> $LOGIN_OUT
+# echo $DOWNSECS >> $LOGIN_OUT
+# echo $RECOVERED >> $LOGIN_OUT
+# echo "----------" >> $LOGIN_OUT
+
+#BBCOLORLEVEL=red
+#BBCOLORLEVEL=yellow
+#BBALPHAMSG="vmtest:disk red [751147]"
+#BBHOSTNAME="testcraa"
+#BBSVCNAME="disk"
+#BBSVCNAME="func"
+#BBHOSTSVC="vmtest.disk"
+
+#bbhome ends up as /home/xymon/server which is why I didn't use it here
+NOTICE_DIR="/home/xymon/var/login_alerts"
+if [ ! -d $NOTICE_DIR ]
+then
+ mkdir $NOTICE_DIR
+fi
+
+if [ "x$RECOVERED" == "x1" ]
+then
+ if [ -f $NOTICE_DIR/$BBHOSTSVC ]
+ then
+ rm -f $NOTICE_DIR/$BBHOSTSVC
+ else
+ echo "$NOTICE_DIR/$BBHOSTSVC is not present, didn't remove it"
+ fi
+else
+ echo "DOWN: $DOWNSECS" > $NOTICE_DIR/$BBHOSTSVC
+ echo "SERVICE: $BBSVCNAME" >> $NOTICE_DIR/$BBHOSTSVC
+ echo "HOST: $BBHOSTNAME" >> $NOTICE_DIR/$BBHOSTSVC
+ echo "ACKCODE: $ACKCODE" >> $NOTICE_DIR/$BBHOSTSVC
+ echo "MSG $BBALPHAMSG" >> $NOTICE_DIR/$BBHOSTSVC
+
+fi
+
+
+