summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2015-02-20 20:11:18 (GMT)
committerBritney Fransen <brfransen@gmail.com>2015-02-20 20:11:18 (GMT)
commit53d9a174f4f05c94c0fe392a83deb310095310b1 (patch)
tree3805c7057bff77acedd900fb1eae8a62db1b01cc /abs
parent6fde8cd5e74f0840e01988e743464fe91c0a28f8 (diff)
downloadlinhes_pkgbuild-53d9a174f4f05c94c0fe392a83deb310095310b1.zip
linhes_pkgbuild-53d9a174f4f05c94c0fe392a83deb310095310b1.tar.gz
linhes_pkgbuild-53d9a174f4f05c94c0fe392a83deb310095310b1.tar.bz2
xymon: add smart monitor
hobbit-myth-orphan.sh: add some help text
Diffstat (limited to 'abs')
-rwxr-xr-xabs/core/xymon/PKGBUILD23
-rwxr-xr-xabs/core/xymon/clientlaunch.cfg.patch18
-rw-r--r--abs/core/xymon/hobbit-myth-orphan.sh36
-rwxr-xr-xabs/core/xymon/tasks.d.mv8
-rw-r--r--abs/core/xymon/xymon-client.rules3
-rw-r--r--abs/core/xymon/xymon-server.rules1
-rwxr-xr-xabs/core/xymon/xymon-smart.sh65
-rwxr-xr-xabs/core/xymon/xymonserver.cfg.diff2
8 files changed, 116 insertions, 40 deletions
diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index e8908cc..f171831 100755
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,7 +1,7 @@
pkgbase=xymon
pkgname=('xymonserver' 'xymonclient')
pkgver=4.3.17
-pkgrel=11
+pkgrel=12
pkgdesc="Xymon is a system for monitoring of hosts and networks"
license="GPL"
arch=('i686' 'x86_64')
@@ -25,14 +25,16 @@ source=("https://downloads.sourceforge.net/project/xymon/Xymon/$pkgver/$pkgbase-
'alerts.cfg'
'hobbit_myth_data.py'
'xymon-gputemp.sh'
+ 'xymon-smart.sh'
'logrotate-server.xymon'
'logrotate-client.xymon'
'log_list.sh'
'client-local.cfg.patch'
'led_themes.tar.gz'
'xymon-server.rules'
+ 'xymon-client.rules'
'hosts.cfg.patch')
-depends=('rrdtool' 'fping' 'pcre' 'python2' 'graphviz')
+depends=('rrdtool' 'fping' 'pcre' 'python2' 'graphviz' 'smartmontools')
install=xymon.install
build() {
@@ -81,6 +83,7 @@ package_xymonserver(){
install -D -m755 ${srcdir}/hobbit_myth_data.py ${pkgdir}/home/xymon/server/ext/hobbit_myth_data.py
install -D -m755 ${srcdir}/hobbit-mem-myth.sh ${pkgdir}/home/xymon/server/ext/hobbit-mem-myth.sh
install -D -m755 ${srcdir}/xymon-gputemp.sh ${pkgdir}/home/xymon/server/ext/xymon-gputemp.sh
+ install -D -m755 ${srcdir}/xymon-smart.sh ${pkgdir}/home/xymon/server/ext/xymon-smart.sh
install -D -m755 ${srcdir}/log_list.sh ${pkgdir}/home/xymon/client/bin/log_list.sh
install -m755 analysis.cfg ${pkgdir}/home/xymon/etc/analysis.cfg
@@ -134,14 +137,16 @@ package_xymonserver(){
package_xymonclient(){
#create client package as well
- depends=()
+ depends=('smartmontools')
backup=('data/srv/xymon/client/etc/xymonclient.cfg')
install=xymon-client.install
+ install -D -m400 ${srcdir}/xymon-client.rules ${pkgdir}/etc/sudoers.d/xymon_client
install -D -m755 ${srcdir}/log_list.sh ${pkgdir}/home/xymon/client/bin/log_list.sh
install -D -m644 ${srcdir}/logrotate-client.xymon ${pkgdir}/etc/logrotate.d/xymon-client
install -D -m755 ${srcdir}/hobbit-mem-myth.sh ${pkgdir}/home/xymon/client/ext/hobbit-mem-myth.sh
install -D -m755 ${srcdir}/xymon-gputemp.sh ${pkgdir}/home/xymon/client/ext/xymon-gputemp.sh
+ install -D -m755 ${srcdir}/xymon-smart.sh ${pkgdir}/home/xymon/client/ext/xymon-smart.sh
cp -rp ${pkgdir}/../xymonserver/home/xymon/client/ ${pkgdir}/home/xymon/
cd -
@@ -154,12 +159,12 @@ md5sums=('d8d119a777e7b7204d1292fb27314312'
'a0fbb9cbeb3600a40943e6205790f22f'
'c60b0d59bb39505ee3d62c6dd65429c5'
'53f1af1054d3c70f4d6b6fe952cf7e11'
- 'b2f404913400a25f13c63b27f064ad2e'
- 'e40c31eb53ef17c0c544389a525de957'
- '3ad3ce12b84cca82dd34ef97984c315e'
+ '510f36dfada9439f09327da5278bcdb1'
+ 'c9f93372dce3489e23fb601a941818bb'
+ '8d024dfc58bacdfedfbddf8e78fd53eb'
'b2f98ac0df013332deedc1efae0a270d'
'4a8244c1bb44fe35ca7372355b01cec4'
- '526c169e020b570b5b02661a831aa4e6'
+ 'aa7c2eec6cd894dc171e90a4eed69de1'
'166279c006c3ef7bf0c21537cf89fc83'
'80d9cfac86c6d96836e6f406e35e7cf5'
'd210c43fb9ee9ad6cd7648e0c2e0efea'
@@ -171,10 +176,12 @@ md5sums=('d8d119a777e7b7204d1292fb27314312'
'9af2ad60ac4c3cb653754618f603e311'
'a9b7f0a22f29f55b2928160bc44f2c14'
'6452d891d88bb46d07bcf7790a523ad0'
+ '1348bef3cdd20ec0ea66d61ac1834847'
'b4e8641e97e6b689dbc634af785e6799'
'e2844513e2c92e8b5084818f3b2a478d'
'98e9242ae346f729b14cb195786571f2'
'31ac5c1f6dcc9408b64c4107b325a9a6'
'c7178bbf384bbe86c318b60fef6faf10'
- '72bf7caf0f53928d97ff5cd9810d6d4d'
+ '2871c53627e9e125922118013a868a95'
+ 'cdfbca43dbae4ce0ca72dd002ec22af1'
'606f535a49f32b35802ed9d46bd7d068')
diff --git a/abs/core/xymon/clientlaunch.cfg.patch b/abs/core/xymon/clientlaunch.cfg.patch
index 8c1915a..0348c6c 100755
--- a/abs/core/xymon/clientlaunch.cfg.patch
+++ b/abs/core/xymon/clientlaunch.cfg.patch
@@ -1,9 +1,9 @@
---- clientlaunch.cfg.orig 2014-10-25 11:56:01.947006791 -0500
-+++ clientlaunch.cfg 2014-10-25 11:57:02.632312788 -0500
-@@ -26,3 +26,14 @@
- LOGFILE $XYMONCLIENTLOGS/xymonclient.log
- INTERVAL 5m
-
+--- clientlaunch.cfg.orig 2015-02-19 22:50:43.102571615 +0000
++++ clientlaunch.cfg 2015-02-20 14:41:10.594633850 +0000
+@@ -26,3 +26,20 @@
+ LOGFILE $XYMONCLIENTLOGS/xymonclient.log
+ INTERVAL 5m
+
+[memmyth]
+ ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
+ CMD /home/xymon/client/ext/hobbit-mem-myth.sh
@@ -15,3 +15,9 @@
+ CMD /home/xymon/client/ext/xymon-gputemp.sh
+ LOGFILE $XYMONCLIENTLOGS/xymon-gputemp.log
+ INTERVAL 5m
++
++[smart]
++ ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
++ CMD /home/xymon/client/ext/xymon-smart.sh
++ LOGFILE $XYMONCLIENTLOGS/xymon-smart.log
++ INTERVAL 30m
diff --git a/abs/core/xymon/hobbit-myth-orphan.sh b/abs/core/xymon/hobbit-myth-orphan.sh
index cc4ca30..ff91fb5 100644
--- a/abs/core/xymon/hobbit-myth-orphan.sh
+++ b/abs/core/xymon/hobbit-myth-orphan.sh
@@ -2,13 +2,10 @@
TMPFILE=/tmp/oprhan.result
MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/find_orphans.py --printonly > $TMPFILE
-
COLUMN=orphan # Name of the column
COLOR=green # By default, everything is OK
-MSG="No Orphans Found."
-
-
+MSG="No Orphans Found."
#yellow
for i in "Orphaned video files" "Orphaned snapshots" "Database backups" "Other files" "Recordings with missing files" "Zero byte recordings"
@@ -22,27 +19,18 @@ do
fi
done
-#red
-#for i in "Recordings with missing files" "Zero byte recordings"
-#do
-# grep -q "$i" $TMPFILE
-# status=$?
-# if [ $status -eq 0 ]
-# then
-# COLOR="red"
-# MSG="Problems with $i"
-# fi
-#done
-
+if [[ $MSG != "No Orphans Found." ]]
+then
MSG="
${MSG}
- `cat $TMPFILE` "
-# Tell Hobbit about it
-$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
- ${MSG}
- "
-exit 0
-
-
+ `cat $TMPFILE`
+<b>From <a href="/shell/" target="_blank">System >> Terminal</a> run find_orphans.py to clean up these issues.</b>
+"
+fi
+# Tell Hobbit about it
+$BB $BBDISP "status $MACHINE.$COLUMN $COLOR Results from find_orphans.py
+ ${MSG}
+ "
+exit 0
diff --git a/abs/core/xymon/tasks.d.mv b/abs/core/xymon/tasks.d.mv
index 02afc14..f8ce177 100755
--- a/abs/core/xymon/tasks.d.mv
+++ b/abs/core/xymon/tasks.d.mv
@@ -42,4 +42,10 @@
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD /home/xymon/server/ext/xymon-gputemp.sh
LOGFILE $BBSERVERLOGS/xymon-gputemp.log
- INTERVAL 5m \ No newline at end of file
+ INTERVAL 5m
+
+[smart]
+ ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
+ CMD /home/xymon/server/ext/xymon-smart.sh
+ LOGFILE $BBSERVERLOGS/xymon-smart.log
+ INTERVAL 30m
diff --git a/abs/core/xymon/xymon-client.rules b/abs/core/xymon/xymon-client.rules
new file mode 100644
index 0000000..f13b3f6
--- /dev/null
+++ b/abs/core/xymon/xymon-client.rules
@@ -0,0 +1,3 @@
+#These rules are used by xymon-client
+nobody ALL = NOPASSWD:/usr/bin/smartctl
+
diff --git a/abs/core/xymon/xymon-server.rules b/abs/core/xymon/xymon-server.rules
index b0f6100..e4c515b 100644
--- a/abs/core/xymon/xymon-server.rules
+++ b/abs/core/xymon/xymon-server.rules
@@ -1,5 +1,6 @@
#These rules are used by xymon-server
nobody ALL = NOPASSWD:/usr/bin/certmaster-ca
+nobody ALL = NOPASSWD:/usr/bin/smartctl
http ALL = NOPASSWD:/usr/LH/bin/lh_system_backup_job
http ALL = NOPASSWD:/usr/LH/bin/lh_system_restore_job
http ALL = NOPASSWD:/sbin/sv
diff --git a/abs/core/xymon/xymon-smart.sh b/abs/core/xymon/xymon-smart.sh
new file mode 100755
index 0000000..1ad3cc7
--- /dev/null
+++ b/abs/core/xymon/xymon-smart.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# NOTE: Must be run as root, so you probably need to setup sudo for this.
+
+if test -f /tmp/dres; then rm -f /tmp/dres; fi
+
+# MODIFY below to match your setup - the "scsi-SATA" is pretty generic, but you
+# can add more disks if you like. E.g. I have a USB disk permanently plugged in.
+
+ls /dev/disk/by-id/scsi-* /dev/disk/by-id/ata-* /dev/disk/by-id/usb-* | grep -v -- -part | sort |
+while read DISK
+do
+ DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'`
+
+ #check if disk is removable
+ RM=`cat /sys/block/$DISKDEV/removable`
+ if test $RM -ne 0
+ then
+ continue
+ fi
+
+ DRES=`sudo /usr/sbin/smartctl -H -n standby $DISK`
+ DCODE=$?
+ DSTBY=$(( $DCODE & 2 ))
+ DFAIL=$(( $DCODE & 8 ))
+ DWARN=$(( $DCODE & 32 ))
+
+ if test $DSTBY -ne 0
+ then
+ COLOR="4&clear"
+ elif test $DFAIL -ne 0
+ then
+ COLOR="1&red"
+ elif test $DWARN -ne 0
+ then
+ COLOR="2&yellow"
+ else
+ COLOR="3&green"
+ fi
+
+ echo "${COLOR} $DISK (/dev/$DISKDEV)"
+
+ echo "${COLOR} $DISK (/dev/$DISKDEV)" | cut -c2- >>/tmp/dres
+ echo "" >>/tmp/dres
+ echo "$DRES" | egrep -v "^smartctl|^Copyright|^$|^===" >>/tmp/dres
+ echo "-----------------------------------------------------------------------------" >>/tmp/dres
+ echo "" >>/tmp/dres
+ echo "" >>/tmp/dres
+done >/tmp/dcheck
+
+COLOR=`cat /tmp/dcheck | awk '{print $1}' | sort | uniq | head -1 | cut -c3-`
+
+$XYMON $XYMSRV "status ${MACHINE}.smart ${COLOR} SMART Health Check
+
+`cat /tmp/dcheck | cut -c2-`
+
+============================== Detailed status ==============================
+
+`cat /tmp/dres`
+"
+
+rm -f /tmp/dres /tmp/dcheck
+
+exit 0
+
diff --git a/abs/core/xymon/xymonserver.cfg.diff b/abs/core/xymon/xymonserver.cfg.diff
index 8850670..5432767 100755
--- a/abs/core/xymon/xymonserver.cfg.diff
+++ b/abs/core/xymon/xymonserver.cfg.diff
@@ -18,7 +18,7 @@
# status view of a test should include a graph.
-TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond"
+#TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond"
-+TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond,storage=ncv,memmbe=ncv,memmfe=ncv,gputemp=ncv"
++TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond,storage=ncv,memmbe=ncv,memmfe=ncv,gputemp=ncv,smart"
# This defines which RRD files to include on the "trends" column webpage,
# and the order in which they appear.