From 4fa58e575df074c999db5cbc13a2488131597fcc Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Thu, 5 Mar 2015 01:10:11 +0000 Subject: xymon: add hddtemp module --- abs/core/xymon/PKGBUILD | 20 ++++++----- abs/core/xymon/clientlaunch.cfg.patch | 10 ++++-- abs/core/xymon/graphs.cfg.diff | 63 +++++++++++++++++++++++++++++++++++ abs/core/xymon/tasks.d.mv | 6 ++++ abs/core/xymon/xymon-hddtemp.sh | 50 +++++++++++++++++++++++++++ abs/core/xymon/xymon-smart.sh | 7 ++-- abs/core/xymon/xymonserver.cfg.diff | 19 ++++++----- 7 files changed, 151 insertions(+), 24 deletions(-) create mode 100755 abs/core/xymon/graphs.cfg.diff create mode 100755 abs/core/xymon/xymon-hddtemp.sh diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD index f171831..e7b9577 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=12 +pkgrel=13 pkgdesc="Xymon is a system for monitoring of hosts and networks" license="GPL" arch=('i686' 'x86_64') @@ -9,7 +9,7 @@ url="http://www.xymon.com/" source=("https://downloads.sourceforge.net/project/xymon/Xymon/$pkgver/$pkgbase-$pkgver.tar.gz" 'hobbitadd.py' 'xymon_ghost_check' - 'graph.cfg.diff' + 'graphs.cfg.diff' 'xymonserver.cfg.diff' 'tasks.d.mv' 'clientlaunch.cfg.patch' @@ -25,6 +25,7 @@ source=("https://downloads.sourceforge.net/project/xymon/Xymon/$pkgver/$pkgbase- 'alerts.cfg' 'hobbit_myth_data.py' 'xymon-gputemp.sh' + 'xymon-hddtemp.sh' 'xymon-smart.sh' 'logrotate-server.xymon' 'logrotate-client.xymon' @@ -83,6 +84,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-hddtemp.sh ${pkgdir}/home/xymon/server/ext/xymon-hddtemp.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 @@ -110,7 +112,7 @@ package_xymonserver(){ #apply patches to conf file install -D -m775 ${srcdir}/tasks.d.mv ${pkgdir}/home/xymon/etc/tasks.d/mv.cfg cd ${pkgdir}/home/xymon/etc - patch -p0 < ${srcdir}/graph.cfg.diff || return 1 + patch -p0 < ${srcdir}/graphs.cfg.diff || return 1 patch -p0 < ${srcdir}/xymonserver.cfg.diff || return 1 patch -p3 < ${srcdir}/client-local.cfg.patch || return 1 patch -p3 < ${srcdir}/hosts.cfg.patch || return 1 @@ -146,6 +148,7 @@ package_xymonclient(){ 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-hddtemp.sh ${pkgdir}/home/xymon/client/ext/xymon-hddtemp.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/ @@ -158,10 +161,10 @@ package_xymonclient(){ md5sums=('d8d119a777e7b7204d1292fb27314312' 'a0fbb9cbeb3600a40943e6205790f22f' 'c60b0d59bb39505ee3d62c6dd65429c5' - '53f1af1054d3c70f4d6b6fe952cf7e11' - '510f36dfada9439f09327da5278bcdb1' - 'c9f93372dce3489e23fb601a941818bb' - '8d024dfc58bacdfedfbddf8e78fd53eb' + '92bd5e8279c688fd854d514443bc733c' + 'f0fca78520f434918bd1be717d165073' + 'a19c8c546dcd95049476bb19f9d4e3ae' + '079833e3af5d74b93a86b5819dbf453b' 'b2f98ac0df013332deedc1efae0a270d' '4a8244c1bb44fe35ca7372355b01cec4' 'aa7c2eec6cd894dc171e90a4eed69de1' @@ -176,7 +179,8 @@ md5sums=('d8d119a777e7b7204d1292fb27314312' '9af2ad60ac4c3cb653754618f603e311' 'a9b7f0a22f29f55b2928160bc44f2c14' '6452d891d88bb46d07bcf7790a523ad0' - '1348bef3cdd20ec0ea66d61ac1834847' + '374ce9cc7b7cb8ae04bf89ed4d79a7be' + '6eb413053fde2110859c30737032b916' 'b4e8641e97e6b689dbc634af785e6799' 'e2844513e2c92e8b5084818f3b2a478d' '98e9242ae346f729b14cb195786571f2' diff --git a/abs/core/xymon/clientlaunch.cfg.patch b/abs/core/xymon/clientlaunch.cfg.patch index 0348c6c..980da4c 100755 --- a/abs/core/xymon/clientlaunch.cfg.patch +++ b/abs/core/xymon/clientlaunch.cfg.patch @@ -1,6 +1,6 @@ --- 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 @@ ++++ clientlaunch.cfg 2015-03-04 23:45:50.087484982 +0000 +@@ -26,3 +26,26 @@ LOGFILE $XYMONCLIENTLOGS/xymonclient.log INTERVAL 5m @@ -16,6 +16,12 @@ + LOGFILE $XYMONCLIENTLOGS/xymon-gputemp.log + INTERVAL 5m + ++[hddtemp] ++ ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg ++ CMD /home/xymon/client/ext/xymon-hddtemp.sh ++ LOGFILE $XYMONCLIENTLOGS/xymon-hddtemp.log ++ INTERVAL 5m ++ +[smart] + ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg + CMD /home/xymon/client/ext/xymon-smart.sh diff --git a/abs/core/xymon/graphs.cfg.diff b/abs/core/xymon/graphs.cfg.diff new file mode 100755 index 0000000..8b1b438 --- /dev/null +++ b/abs/core/xymon/graphs.cfg.diff @@ -0,0 +1,63 @@ +--- graphs.cfg.orig 2015-03-04 21:46:31.493387574 +0000 ++++ graphs.cfg 2015-03-04 21:47:26.972936010 +0000 +@@ -2100,4 +2100,60 @@ + GPRINT:qlen@RRDIDX@:AVERAGE: %6.1lf (avg)\n + + ########### end of ifmib graphs ########### ++[storage] ++ TITLE Storage Groups ++ YAXIS recordings ++ DEF:storage1=storage.rrd:rectvtotal:AVERAGE ++ LINE2:storage1#00CCCC:current recorded + ++ DEF:rectime=storage.rrd:rectvtime:AVERAGE ++ LINE2:rectime#000000:current recorded time ++ ++ DEF:livetime=storage.rrd:livetvtime:AVERAGE ++ LINE2:livetime#00CC11:current live time ++ ++ ++[memmbe] ++ TITLE Memory usage for MythBackend ++ YAXIS mythbackend ++ DEF:vmsize=memmbe.rrd:VmSize:AVERAGE ++ LINE2:vmsize#00CCCC:vmsize ++ ++ DEF:vmpeak=memmbe.rrd:VmPeak:AVERAGE ++ LINE2:vmpeak#000000:vmpeak ++ ++ DEF:vmrss=memmbe.rrd:VmRSS:AVERAGE ++ LINE2:vmrss#00CC11:vmrss ++ ++[memmfe] ++ TITLE Memory usage for MythFrontend ++ YAXIS mythfrontend ++ DEF:vmsize=memmfe.rrd:VmSize:AVERAGE ++ LINE2:vmsize#00CCCC:vmsize ++ ++ DEF:vmpeak=memmfe.rrd:VmPeak:AVERAGE ++ LINE2:vmpeak#000000:vmpeak ++ ++ DEF:vmrss=memmfe.rrd:VmRSS:AVERAGE ++ LINE2:vmrss#00CC11:vmrss ++ ++[gputemp] ++ TITLE GPU Temperature ++ YAXIS Temperature ++ DEF:gputemp=gputemp.rrd:GPUTEMP:AVERAGE ++ LINE2:gputemp#00CC11:gputemp ++ GPRINT:gputemp:LAST: \: %5.1lf (cur) ++ GPRINT:gputemp:MAX: \: %5.1lf (max) ++ GPRINT:gputemp:MIN: \: %5.1lf (min) ++ GPRINT:gputemp:AVERAGE: \: %5.1lf (avg)\n ++ ++[hddtemp] ++ FNPATTERN ^hddtemp.(.*).rrd ++ TITLE Hard Drive Temperatures ++ YAXIS Celsius ++ DEF:p@RRDIDX@=@RRDFN@:lambda:AVERAGE ++ LINE2:p@RRDIDX@#@COLOR@:@RRDPARAM@\n ++ GPRINT:p@RRDIDX@:LAST: %5.1lf °C (cur) ++ GPRINT:p@RRDIDX@:MAX: \: %5.1lf °C (max) ++ GPRINT:p@RRDIDX@:MIN: \: %5.1lf °C (min) ++ GPRINT:p@RRDIDX@:AVERAGE: \: %5.1lf °C (avg)\n diff --git a/abs/core/xymon/tasks.d.mv b/abs/core/xymon/tasks.d.mv index f8ce177..2cdaebb 100755 --- a/abs/core/xymon/tasks.d.mv +++ b/abs/core/xymon/tasks.d.mv @@ -44,6 +44,12 @@ LOGFILE $BBSERVERLOGS/xymon-gputemp.log INTERVAL 5m +[hddtemp] + ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg + CMD /home/xymon/server/ext/xymon-hddtemp.sh + LOGFILE $BBSERVERLOGS/xymon-hddtemp.log + INTERVAL 5m + [smart] ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg CMD /home/xymon/server/ext/xymon-smart.sh diff --git a/abs/core/xymon/xymon-hddtemp.sh b/abs/core/xymon/xymon-hddtemp.sh new file mode 100755 index 0000000..6961919 --- /dev/null +++ b/abs/core/xymon/xymon-hddtemp.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# NOTE: Must be run as root, so you probably need to setup sudo for this. + +ls /dev/disk/by-id/* | grep -ve '-part' -ve '/wwn-' | +while read DISK +do + DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'` + DISKNAME=`echo $DISK | awk -F/ '{print $5}'` + + #check if disk is removable + RM=0 + RM=`cat /sys/block/$DISKDEV/removable` + if test $RM -ne 0 + then + continue + fi + + hddtemp=`sudo smartctl -A $DISK | grep Temperature_Celsius | awk '{print $10}'` + + TEMP=": $hddtemp" + if [[ $hddtemp == "" ]] + then + TEMP="- No Temp Sensor Found" + COLOR="4&clear" + elif test $hddtemp -gt 50 + then + COLOR="1&red" + elif test $hddtemp -ge 45 + then + COLOR="2&yellow" + else + COLOR="3&green" + fi + + echo "${COLOR} $DISKNAME $TEMP" + +done > /tmp/hddcheck + +COLOR=`cat /tmp/hddcheck | awk '{print $1}' | sort | uniq | head -1 | cut -c3-` + +# Report status to Xymon Server +$XYMON $XYMSRV "status ${MACHINE}.hddtemp ${COLOR} Hard Drive Temperatures (in °C) + +`cat /tmp/hddcheck | cut -c2-` +" + +rm -f /tmp/hddcheck + +exit 0 diff --git a/abs/core/xymon/xymon-smart.sh b/abs/core/xymon/xymon-smart.sh index 1ad3cc7..f951158 100755 --- a/abs/core/xymon/xymon-smart.sh +++ b/abs/core/xymon/xymon-smart.sh @@ -4,15 +4,13 @@ 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 | +ls /dev/disk/by-id/* | grep -ve '-part' -ve '/wwn-' | while read DISK do DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'` #check if disk is removable + RM=0 RM=`cat /sys/block/$DISKDEV/removable` if test $RM -ne 0 then @@ -62,4 +60,3 @@ $XYMON $XYMSRV "status ${MACHINE}.smart ${COLOR} SMART Health Check 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 5432767..48631dc 100755 --- a/abs/core/xymon/xymonserver.cfg.diff +++ b/abs/core/xymon/xymonserver.cfg.diff @@ -1,30 +1,31 @@ ---- xymonserver.cfg.orig 2014-10-25 22:05:16.611876375 -0500 -+++ xymonserver.cfg 2014-10-25 22:07:35.818604144 -0500 -@@ -145,6 +145,11 @@ +--- xymonserver.cfg.orig 2015-03-04 21:28:58.618598840 +0000 ++++ xymonserver.cfg 2015-03-04 21:31:55.352569106 +0000 +@@ -145,6 +145,12 @@ RRDHEIGHT="120" RRDWIDTH="576" # The RRD's contain 576 data points, so this is a good value - + +NCV_storage="*:GAUGE" +NCV_memmbe="*:GAUGE" +NCV_memmfe="*:GAUGE" +NCV_gputemp="*:GAUGE" ++SPLITNCV_hddtemp="*:GAUGE" + # TEST2RRD defines the status- and data-messages you want to collect RRD data # about. You will normally not need to modify this, unless you have added a # script to pick up RRD data from custom tests (the xymond_rrd --extra-script -@@ -156,11 +161,13 @@ +@@ -156,11 +162,13 @@ # # This is also used by the svcstatus.cgi script to determine if the detailed # 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,smart" - ++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,hddtemp=ncv,smart" + # This defines which RRD files to include on the "trends" column webpage, # and the order in which they appear. -GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond" +#GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond" -+GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond,storage,memmbe,memmfe,gputemp" - ++GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond,storage,memmbe,memmfe,gputemp,hddtemp" + # These two settings can be used to restrict what filesystems are being # tracked (i.e. have their utilisation graphed) by Xymon. -- cgit v0.12