From 525bfed2bec6b2671ad3a82aa88b9baf1b01111c Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 26 Oct 2014 12:03:56 -0500
Subject: xymon: add gputemp.sh, fix permissions, and add some extra try/except
 to hbnotes refs #979

---
 abs/core/xymon/PKGBUILD               | 47 ++++++++++++++------
 abs/core/xymon/clientlaunch.cfg.patch | 19 +++++---
 abs/core/xymon/gpu-temp.sh            | 76 ++++++++++++++++++++++++++++++++
 abs/core/xymon/graph.cfg.diff         | 23 +++++++---
 abs/core/xymon/hbnotes.py             | 64 +++++++++++++++------------
 abs/core/xymon/hobbitserver.cfg.diff  | 45 -------------------
 abs/core/xymon/tasks.d.mv             |  6 +++
 abs/core/xymon/xymon-gputemp.sh       | 83 +++++++++++++++++++++++++++++++++++
 abs/core/xymon/xymon.install          | 37 +++++++++++++---
 abs/core/xymon/xymonserver.cfg.diff   | 19 ++++----
 10 files changed, 304 insertions(+), 115 deletions(-)
 mode change 100644 => 100755 abs/core/xymon/clientlaunch.cfg.patch
 create mode 100644 abs/core/xymon/gpu-temp.sh
 mode change 100644 => 100755 abs/core/xymon/graph.cfg.diff
 delete mode 100644 abs/core/xymon/hobbitserver.cfg.diff
 mode change 100644 => 100755 abs/core/xymon/tasks.d.mv
 create mode 100644 abs/core/xymon/xymon-gputemp.sh
 mode change 100644 => 100755 abs/core/xymon/xymonserver.cfg.diff

diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index 38b8805..e8b73ac 100755
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,19 +1,37 @@
 pkgbase=xymon
 pkgname=('xymonserver' 'xymonclient')
 pkgver=4.3.17
-pkgrel=4
+pkgrel=9
 pkgdesc="Xymon is a system for monitoring of hosts and networks"
 license="GPL"
 arch=('i686' 'x86_64')
 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' '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')
+        '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'
+        'xymon-gputemp.sh'
+        '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')
 install=xymon.install
 
@@ -62,6 +80,7 @@ package_xymonserver(){
     install -D -m755 ${srcdir}/hbnotes.py ${pkgdir}/home/xymon/server/ext/hbnotes.py
     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}/log_list.sh ${pkgdir}/home/xymon/client/bin/log_list.sh
 
     install -m755 analysis.cfg ${pkgdir}/home/xymon/etc/analysis.cfg
@@ -122,6 +141,7 @@ package_xymonclient(){
     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
     cp -rp ${pkgdir}/../xymonserver/home/xymon/client/ ${pkgdir}/home/xymon/
 
     cd -
@@ -133,12 +153,12 @@ package_xymonclient(){
 md5sums=('d8d119a777e7b7204d1292fb27314312'
          'a0fbb9cbeb3600a40943e6205790f22f'
          'c60b0d59bb39505ee3d62c6dd65429c5'
-         'a45dd4cdb84817bcf3e51b25cc713799'
-         '034658a1084510ecbbb0dc166c0401eb'
-         '758cdd9f1ba5ae3e1b42e811172806f3'
-         'ee608dcafc050d790e28647a670f6b60'
+         '53f1af1054d3c70f4d6b6fe952cf7e11'
+         'b2f404913400a25f13c63b27f064ad2e'
+         'e40c31eb53ef17c0c544389a525de957'
+         '3ad3ce12b84cca82dd34ef97984c315e'
          'b2f98ac0df013332deedc1efae0a270d'
-         'b8c3b00db8fec518289b5caa0df0060b'
+         '4a8244c1bb44fe35ca7372355b01cec4'
          '526c169e020b570b5b02661a831aa4e6'
          '166279c006c3ef7bf0c21537cf89fc83'
          '80d9cfac86c6d96836e6f406e35e7cf5'
@@ -150,6 +170,7 @@ md5sums=('d8d119a777e7b7204d1292fb27314312'
          '22d4c9065fd959efe82f121dcb511305'
          '9af2ad60ac4c3cb653754618f603e311'
          'b8eb10070f2ad6a245d3da15091694ba'
+         'e8f2ac43a1e3b28f5af438d787c86db2'
          'b4e8641e97e6b689dbc634af785e6799'
          'e2844513e2c92e8b5084818f3b2a478d'
          '98e9242ae346f729b14cb195786571f2'
diff --git a/abs/core/xymon/clientlaunch.cfg.patch b/abs/core/xymon/clientlaunch.cfg.patch
old mode 100644
new mode 100755
index ec475f9..8c1915a
--- a/abs/core/xymon/clientlaunch.cfg.patch
+++ b/abs/core/xymon/clientlaunch.cfg.patch
@@ -1,12 +1,17 @@
---- clientlaunch.cfg.orig	2011-11-25 19:07:19.000000000 -0600
-+++ clientlaunch.cfg	2011-11-25 19:09:55.000000000 -0600
-@@ -25,4 +25,9 @@
- 	CMD $XYMONCLIENTHOME/bin/xymonclient.sh
- 	LOGFILE $XYMONCLIENTLOGS/xymonclient.log
- 	INTERVAL 5m
+--- 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
+
 +[memmyth]
 +       ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
 +       CMD  /home/xymon/client/ext/hobbit-mem-myth.sh
 +       LOGFILE $XYMONCLIENTLOGS/mythmem.log
 +       INTERVAL 5m
-
++
++[gputemp]
++       ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
++       CMD  /home/xymon/client/ext/xymon-gputemp.sh
++       LOGFILE $XYMONCLIENTLOGS/xymon-gputemp.log
++       INTERVAL 5m
diff --git a/abs/core/xymon/gpu-temp.sh b/abs/core/xymon/gpu-temp.sh
new file mode 100644
index 0000000..09f79ca
--- /dev/null
+++ b/abs/core/xymon/gpu-temp.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+
+
+gpu_temp=0
+gpu_color="clear"
+
+if ! test -x /usr/bin/nvidia-smi ; then
+
+  $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+  GPUTEMP:$gpu_temp
+  Couldn't find nvidia-smi
+  "
+  exit 0
+fi
+
+# Use NVidia SMI to determine the model
+gpu_model=`nvidia-smi -L`
+if test -z "$gpu_model" ; then
+  $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+  GPUTEMP:$gpu_temp
+  Couldn't find nvidia card
+  "
+  exit 0
+fi
+
+# Determine GPU maximum temperature based on GPU model
+if test $(echo $gpu_model | grep -c -i 'GeForce 210') -eq 0 ; then
+  # GT 210 maximum GPU temperature is 105 C
+  max_temp=105
+elif test $(echo $gpu_model | grep -c -i 'GeForce 220') -eq 0 ; then
+  # GT 220 maximum GPU temperature is 105 C
+  max_temp=105
+elif test $(echo $gpu_model | grep -c -i 'GeForce 240') -eq 0 ; then
+  # GT 240 maximum GPU temperature is 105 C
+  max_temp=105
+elif test $(echo $gpu_model | grep -c -i 'GeForce 430') -eq 0 ; then
+  # GT 430 maximum GPU temperature is  98 C
+  max_temp=98
+elif test $(echo $gpu_model | grep -c -i 'GeForce GTS 450') -eq 0 ; then
+  # GTS 450 maximum GPU temperature is  100 C
+  max_temp=100
+elif test $(echo $gpu_model | grep -c -i 'GeForce GT 520') -eq 0 ; then
+  # GT 520 maximum GPU temperature is  102 C
+  max_temp=102
+else
+  # Assume 100 is the maximum
+  max_temp=100
+fi
+crit_temp=`expr $max_temp - 5`
+warn_temp=`expr $crit_temp - 10`
+
+if test -x /usr/bin/nvidia-smi ; then
+  temp=`nvidia-smi -q -g 0 -d TEMPERATURE | grep -Ei 'Gpu[[:space:]]+:[[:space:]]+[[:digit:]]+ C'`
+  gpu_temp=`echo $temp | sed -e 's/[^0-9]*//g'`
+  #echo "GPUTEMP:$gpu_temp" > /tmp/gputemp.txt
+  if test -n "$gpu_temp" ; then
+    # Have some type of number
+    if test $gpu_temp -lt $warn_temp ; then
+      gpu_color=green
+    elif test $gpu_temp -lt $crit_temp ; then
+      gpu_color=yellow
+    else
+      gpu_color=red
+    fi
+    #echo gputemp $gpu_temp $gpu_color
+    #echo $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+    #`cat /tmp/gputemp.txt`
+    #"
+    $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+    GPUTEMP:$gpu_temp
+    "
+  fi
+fi
+
+exit 0
\ No newline at end of file
diff --git a/abs/core/xymon/graph.cfg.diff b/abs/core/xymon/graph.cfg.diff
old mode 100644
new mode 100755
index c92479a..a105bd7
--- a/abs/core/xymon/graph.cfg.diff
+++ b/abs/core/xymon/graph.cfg.diff
@@ -1,11 +1,11 @@
---- graphs.cfg.orig	2011-11-22 07:56:12.240933957 -0800
-+++ graphs.cfg	2011-11-22 07:57:26.902933853 -0800
-@@ -2094,4 +2094,40 @@
+--- graphs.cfg.orig	2014-10-25 12:01:22.209825001 -0500
++++ graphs.cfg	2014-10-25 21:55:22.065856064 -0500
+@@ -2100,4 +2100,50 @@
  	GPRINT:qlen@RRDIDX@:AVERAGE: %6.1lf (avg)\n
- 
+
  ########### end of ifmib graphs ###########
 +[storage]
-+       TITLE Storage Groups 
++       TITLE Storage Groups
 +       YAXIS  recordings
 +       DEF:storage1=storage.rrd:rectvtotal:AVERAGE
 +       LINE2:storage1#00CCCC:current recorded
@@ -40,4 +40,15 @@
 +
 +       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
+
+
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
index b12cc7b..d14d62a 100755
--- a/abs/core/xymon/hbnotes.py
+++ b/abs/core/xymon/hbnotes.py
@@ -122,44 +122,46 @@ def create_dot_file():
 
 #----------------------------------Create graphviz dot files
     dotfilename="/home/xymon/server/etc/mythdot"
+    try:
+        dotfile=open(dotfilename,'w')
+        dotfile.write("digraph G {   " + "\n" )
+        dotfile.write("graph [bgcolor=transparent]" + "\n" )
+        #print tunerdict
 
-    dotfile=open(dotfilename,'w')
-    dotfile.write("digraph G {   " + "\n" )
-    dotfile.write("graph [bgcolor=transparent]" + "\n" )
-    #print tunerdict
-
-    #define the nodes
-    dotfile.write( dotMBE + "  \n" )
+        #define the nodes
+        dotfile.write( dotMBE + "  \n" )
 
-    dotfile.write("tunermbe"+   " [ label= \"" + tunerdict["MBE"] +     "\" , shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tuner.png\"   fontcolor=\"white\"  color=red ]  \n" )
+        dotfile.write("tunermbe"+   " [ label= \"" + tunerdict["MBE"] +     "\" , shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tuner.png\"   fontcolor=\"white\"  color=red ]  \n" )
 
-    for fe in dotfrontend:
-        dotfile.write("FEND"+fe + "[ label=\"frontend \\n " + fe +     "\" ,shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tv.png\" , fontcolor=\"white\" , imagescale=\"true\"  color=\"gold2\" ]   \n" )
+        for fe in dotfrontend:
+            dotfile.write("FEND"+fe + "[ label=\"frontend \\n " + fe +     "\" ,shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tv.png\" , fontcolor=\"white\" , imagescale=\"true\"  color=\"gold2\" ]   \n" )
 
-    for fe in dotslave:
-        cslave="STUNER"+fe
-        #adding tuners to dot file
-        if tunerdict[cslave] != "" :
-            dotfile.write(cslave+   " [ label= \"" + tunerdict[cslave] +     "\" , shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tuner.png\"   fontcolor=\"white\"  color=red ]  \n" )
-        #adding slave to dot file
-        dotfile.write("SLAVE"+fe + "[ label=\"slave backend \\n " + fe +     "\" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\"  fontcolor=\"white\"  color=green ]   \n" )
+        for fe in dotslave:
+            cslave="STUNER"+fe
+            #adding tuners to dot file
+            if tunerdict[cslave] != "" :
+                dotfile.write(cslave+   " [ label= \"" + tunerdict[cslave] +     "\" , shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tuner.png\"   fontcolor=\"white\"  color=red ]  \n" )
+            #adding slave to dot file
+            dotfile.write("SLAVE"+fe + "[ label=\"slave backend \\n " + fe +     "\" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\"  fontcolor=\"white\"  color=green ]   \n" )
 
-    #connect up the nodes!
-    dotfile.write("tunermbe -> MBE  [color=\"red\"] \n  "  )
+        #connect up the nodes!
+        dotfile.write("tunermbe -> MBE  [color=\"red\"] \n  "  )
 
-    for fe in dotfrontend:
-        dotfile.write("MBE  -> FEND" + fe + "[color=\"gold2\"]   \n  "  )
+        for fe in dotfrontend:
+            dotfile.write("MBE  -> FEND" + fe + "[color=\"gold2\"]   \n  "  )
 
-    for fe in dotslave:
-        cslave="STUNER"+fe
-        dotfile.write("SLAVE" + fe + "-> MBE [color=\"green\"]  \n  "  )
-        if tunerdict[cslave] != "" :
-            dotfile.write(cslave + "-> SLAVE"+fe +  "[color=\"red\"]"  "\n"  )
+        for fe in dotslave:
+            cslave="STUNER"+fe
+            dotfile.write("SLAVE" + fe + "-> MBE [color=\"green\"]  \n  "  )
+            if tunerdict[cslave] != "" :
+                dotfile.write(cslave + "-> SLAVE"+fe +  "[color=\"red\"]"  "\n"  )
 
 
 
-    dotfile.write("}  " + "\n"   )
-    dotfile.close()
+        dotfile.write("}  " + "\n"   )
+        dotfile.close()
+    except:
+        print "Problem writing %s" %dotfilename
 
 
     cmd="/usr/bin/unflatten -l1 -c3 -f " + dotfilename + " |/usr/bin/dot -Tpng  -o/data/srv/httpd/htdocs/xymon/gifs/network.png "
@@ -248,8 +250,12 @@ def create_notes():
        filename="/home/xymon/server/www/notes/"
        filename+=str(row[0])
        filename+=(".html")
+       try:
+            file = open(filename,'w')
+       except:
+            print "problem opening %s" %filename
+            continue
 
-       file = open(filename,'w')
        string='''
 <html>
 <head>  <style type="text/css">@import "/frame.css";</style>
diff --git a/abs/core/xymon/hobbitserver.cfg.diff b/abs/core/xymon/hobbitserver.cfg.diff
deleted file mode 100644
index 7c829fe..0000000
--- a/abs/core/xymon/hobbitserver.cfg.diff
+++ /dev/null
@@ -1,45 +0,0 @@
---- hobbitserver.cfg.orig	2008-01-08 15:25:34.000000000 +0000
-+++ hobbitserver.cfg	2008-01-08 16:22:56.000000000 +0000
-@@ -105,7 +105,7 @@
- CONNTEST="TRUE"					# Should we 'ping' hosts ?
- IPTEST_2_CLEAR_ON_FAILED_CONN="TRUE"		# If TRUE, then failing network tests go CLEAR if conn-test fails.
- NONETPAGE=""					# Network tests that go YELLOW upon failure
--FPING="/usr/sbin/fping"					# Path and options for the ping program.
-+FPING="hobbitping"					# Path and options for the ping program.
- NTPDATE="ntpdate"				# Path to the 'ntpdate' program
- TRACEROUTE="traceroute"                         # How to do traceroute on failing ping tests. Requires "trace" in bb-hosts.
- BBROUTERTEXT="router"				# What to call a failing intermediate network device.
-@@ -120,7 +120,9 @@
- # Size of the generated graph images
- 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"
- # 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 hobbitd_larrd --extra-script
-@@ -132,11 +134,11 @@
- #
- # This is also used by the bb-hostsvc.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"
-+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,storage=ncv,memmbe=ncv,memmfe=ncv"
- 
- # 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"
-+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,storage,memmbe,memmfe"
- 
- # These two settings can be used to restrict what filesystems are being
- # tracked (i.e. have their utilisation graphed) by Hobbit.
-@@ -158,7 +160,7 @@
- HTMLCONTENTTYPE="text/html"                     # You can add charset options here.
- 
- # Fonts and texts
--HOBBITLOGO="Hobbit"                             # HTML inserted on all header pages at top-left corner.
-+HOBBITLOGO=""                             # HTML inserted on all header pages at top-left corner.
- MKBBLOCAL="<B><I>Pages Hosted Locally</I></B>"
- MKBBREMOTE="<B><I>Remote Status Display</I></B>"
- MKBBSUBLOCAL="<B><I>Subpages Hosted Locally</I></B>"
diff --git a/abs/core/xymon/tasks.d.mv b/abs/core/xymon/tasks.d.mv
old mode 100644
new mode 100755
index 5ea7841..02afc14
--- a/abs/core/xymon/tasks.d.mv
+++ b/abs/core/xymon/tasks.d.mv
@@ -37,3 +37,9 @@
        CMD  /home/xymon/server/bin/hobbitadd.py
        LOGFILE $BBSERVERLOGS/hobbitadd.log
        INTERVAL 5m
+
+[gputemp]
+       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
diff --git a/abs/core/xymon/xymon-gputemp.sh b/abs/core/xymon/xymon-gputemp.sh
new file mode 100644
index 0000000..cebea41
--- /dev/null
+++ b/abs/core/xymon/xymon-gputemp.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+
+
+gpu_temp=0
+gpu_color="clear"
+
+if ! test -x /usr/bin/nvidia-smi ; then
+
+  $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+  Couldn't find nvidia-smi
+
+  GPUTEMP : $gpu_temp
+
+  "
+  exit 0
+fi
+
+# Use NVidia SMI to determine the model
+gpu_model=`nvidia-smi -L`
+if test -z "$gpu_model" ; then
+  $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+  Couldn't find nVidia card
+
+  GPUTEMP : $gpu_temp
+
+  "
+  exit 0
+fi
+
+# Determine GPU maximum temperature based on GPU model
+if test $(echo $gpu_model | grep -c -i 'GeForce 210') -eq 0 ; then
+  # GT 210 maximum GPU temperature is 105 C
+  max_temp=105
+elif test $(echo $gpu_model | grep -c -i 'GeForce 220') -eq 0 ; then
+  # GT 220 maximum GPU temperature is 105 C
+  max_temp=105
+elif test $(echo $gpu_model | grep -c -i 'GeForce 240') -eq 0 ; then
+  # GT 240 maximum GPU temperature is 105 C
+  max_temp=105
+elif test $(echo $gpu_model | grep -c -i 'GeForce 430') -eq 0 ; then
+  # GT 430 maximum GPU temperature is  98 C
+  max_temp=98
+elif test $(echo $gpu_model | grep -c -i 'GeForce GTS 450') -eq 0 ; then
+  # GTS 450 maximum GPU temperature is  100 C
+  max_temp=100
+elif test $(echo $gpu_model | grep -c -i 'GeForce GT 520') -eq 0 ; then
+  # GT 520 maximum GPU temperature is  102 C
+  max_temp=102
+else
+  # Assume 100 is the maximum
+  max_temp=100
+fi
+crit_temp=`expr $max_temp - 5`
+warn_temp=`expr $crit_temp - 10`
+
+if test -x /usr/bin/nvidia-smi ; then
+  temp=`nvidia-smi -q -g 0 -d TEMPERATURE | grep -Ei 'Gpu[[:space:]]+:[[:space:]]+[[:digit:]]+ C'`
+  gpu_temp=`echo $temp | sed -e 's/[^0-9]*//g'`
+  #echo "GPUTEMP:$gpu_temp" > /tmp/gputemp.txt
+  if test -n "$gpu_temp" ; then
+    # Have some type of number
+    if test $gpu_temp -lt $warn_temp ; then
+      gpu_color=green
+    elif test $gpu_temp -lt $crit_temp ; then
+      gpu_color=yellow
+    else
+      gpu_color=red
+    fi
+    #echo gputemp $gpu_temp $gpu_color
+    #echo $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+    #`cat /tmp/gputemp.txt`
+    #"
+    $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
+    GPU model is $gpu_model
+    max temp is $max_temp
+
+    GPUTEMP : $gpu_temp
+    "
+  fi
+fi
+
+exit 0
\ No newline at end of file
diff --git a/abs/core/xymon/xymon.install b/abs/core/xymon/xymon.install
index 62feb36..4461df4 100755
--- a/abs/core/xymon/xymon.install
+++ b/abs/core/xymon/xymon.install
@@ -17,16 +17,41 @@ post_install() {
 	sed -i -e "s/localhost/$hostname/" /home/xymon/server/etc/hosts.cfg
 	sed -i -e "s/\# bbd/\# bbd func/" /home/xymon/server/etc/hosts.cfg
 	sed -i -e "s/localhost/$hostname/" /home/xymon/server/etc/xymonserver.cfg
-	#fix permissions
-	chown -R nobody /home/xymon
-	chown -R nobody /data/srv/httpd/htdocs/xymon
-
 
-	chown -R nobody:http /data/srv/httpd/htdocs/xymon/snap
+	#fix permissions
+	chown -R nobody:nobody /home/xymon
+	chown -R nobody:nobody /data/srv/httpd/htdocs/xymon
+	
+        chown -R nobody:http /data/srv/httpd/htdocs/xymon/snap
 	chown -R nobody:http /data/srv/httpd/htdocs/xymon/rep
-	chmod -R 775   /data/srv/httpd/htdocs/xymon/rep
+        chmod -R 775   /data/srv/httpd/htdocs/xymon/rep
 	chmod -R 775   /data/srv/httpd/htdocs/xymon/snap
 
+        chmod g+s /data/srv/httpd/htdocs/xymon/notes/
+        setfacl -d -m g::rw /data/srv/httpd/htdocs/xymon/notes/
+        setfacl -d -m u:nobody:rwx /data/srv/httpd/htdocs/xymon/notes/
+
+	file="/data/srv/httpd/htdocs/xymon/gifs/network.png"
+	if [ -f $file ]
+	then
+           setfacl -m u:nobody:rw $file
+        fi
+	
+
+	setfacl -d -m u:nobody:rwx /data/srv/httpd/htdocs/xymon/gifs/
+
+	chmod g+s /home/xymon/etc
+        setfacl -d -m g::rw /home/xymon/etc/
+        setfacl -d -m u::rw /home/xymon/etc/
+        setfacl -d -m u:nobody:rwx /home/xymon/etc/
+  	
+	file="/home/xymon/etc/mythdot"
+        if [ -f $file ]
+        then
+           setfacl -m u:nobody:rw $file
+        fi
+ 
+
 	chown -R nobody /var/log/hobbit
 
 	chown root /home/xymon/server/bin/xymonping
diff --git a/abs/core/xymon/xymonserver.cfg.diff b/abs/core/xymon/xymonserver.cfg.diff
old mode 100644
new mode 100755
index a8a469d..8850670
--- a/abs/core/xymon/xymonserver.cfg.diff
+++ b/abs/core/xymon/xymonserver.cfg.diff
@@ -1,29 +1,30 @@
---- xymonserver.cfg.orig	2011-11-22 07:58:19.405933864 -0800
-+++ xymonserver.cfg	2011-11-22 08:01:32.452933536 -0800
-@@ -125,6 +125,10 @@
+--- 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 @@
  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"
 +
  # 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
-@@ -136,11 +140,13 @@
+@@ -156,11 +161,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"
- 
++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"
+
  # 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"
- 
++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"
+
  # These two settings can be used to restrict what filesystems are being
  # tracked (i.e. have their utilisation graphed) by Xymon.
-- 
cgit v0.12

