From 9f71a641425ac0a8b93d36a09be94c789bb1ec9e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 12 Dec 2011 09:16:37 -0600
Subject: xymon: add led theme   logrotate: send hup after rotate   hbfunc:
 general rewrite   hbnotes: better output formatting for the dot file, fix
 slave tuners in the dot file

---
 abs/core/xymon/PKGBUILD               |  31 ++++--
 abs/core/xymon/hbfunc.py              | 174 ++++++++++++++++++++++++----------
 abs/core/xymon/hbnotes.py             | 172 +++++++++++++++++----------------
 abs/core/xymon/led_themes.tar.gz      | Bin 0 -> 46255 bytes
 abs/core/xymon/logrotate-client.xymon |  14 +++
 abs/core/xymon/logrotate-server.xymon |  14 +++
 abs/core/xymon/logrotate.xymon        |  11 ---
 abs/core/xymon/xymon.install          |   2 +-
 8 files changed, 267 insertions(+), 151 deletions(-)
 create mode 100644 abs/core/xymon/led_themes.tar.gz
 create mode 100644 abs/core/xymon/logrotate-client.xymon
 create mode 100644 abs/core/xymon/logrotate-server.xymon
 delete mode 100644 abs/core/xymon/logrotate.xymon

diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index 560bbeb..9c1ef87 100644
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,14 +1,14 @@
 pkgbase=xymon
 pkgname=(xymonserver xymonclient)
 pkgver=4.3.5
-pkgrel=24
+pkgrel=25
 pkgdesc="Hobbit is a system for monitoring servers and networks. "
 license="GPL"
 arch=('i686' 'x86_64')
 
 url="http://www.xymon.com/"
 
-source=(http://voxel.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.xymon log_list.sh client-local.cfg.patch)
+source=(http://voxel.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 )
 depends=(rrdtool fping pcre python graphviz)
 install=xymon.install
 
@@ -46,6 +46,7 @@ build() {
 }
 
 package_xymonserver(){
+      backup=('data/srv/xymon/etc/hosts.cfg')
       cd $startdir/src/xymon-$pkgver
       make PKGBUILD=1 INSTALLROOT=$startdir/pkg/xymonserver install
       cd $startdir/src
@@ -67,12 +68,19 @@ package_xymonserver(){
       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
 
-      install -D  -m755 $startdir/src/logrotate.xymon $startdir/pkg/xymonserver/etc/logrotate.d/xymon
+      install -D  -m644 $startdir/src/logrotate-server.xymon $startdir/pkg/xymonserver/etc/logrotate.d/xymon-server
 
+      #copy in replacment icon set
+      DOCDIR=$startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon
+      cp -rp  $DOCDIR/gifs $DOCDIR/gifs.orig
+      cd $startdir/src/themes
+      cp -fp Common/* $DOCDIR/gifs/
+      cp -fp ModernLED/* $DOCDIR/gifs/
     #apply patches to conf file
 #      mkdir -p $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/
 #      mkdir -p $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/
-       cat  $startdir/src/tasks.d.mv >>  $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.cfg
+       install -D -m755 $startdir/src/tasks.d.mv $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/mv.cfg
+#       cat  $startdir/src/tasks.d.mv >>  $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.cfg
       cd $startdir/pkg/xymonserver/data/srv/xymon/etc
       patch -p0 <  $startdir/src/graph.cfg.diff || return 1 
       patch -p0 <  $startdir/src/xymonserver.cfg.diff || return 1
@@ -86,10 +94,11 @@ package_xymonserver(){
 package_xymonclient(){
     #create client package as well
     depends=()
+     backup=('data/srv/xymon/client/etc/xymonclient.cfg')
     install=xymon-client.install
 
-     install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymon/client/data/srv/xymon/client/bin/log_list.sh
-    install -D  -m755 $startdir/src/logrotate.xymon $startdir/pkg/xymonclient/etc/logrotate.d/xymon
+     install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymonclient/data/srv/xymon/client/bin/log_list.sh
+    install -D  -m644 $startdir/src/logrotate-client.xymon $startdir/pkg/xymonclient/etc/logrotate.d/xymon-client
     install -D -m755 $startdir/src/hobbit-mem-myth.sh $startdir/pkg/xymonclient/data/srv/xymon/client/ext/hobbit-mem-myth.sh
     cp -rp /$startdir/pkg/xymonserver/data/srv/xymon/client/ $startdir/pkg/xymonclient/data/srv/xymon/
 
@@ -109,10 +118,10 @@ md5sums=('31923ec126fe1c264fceb459d2175161'
          'cc845b5aedc33dda8e3103b915fe4967'
          '650b523d879f32c1bad3b4a9e10e7c93'
          '093648dabb0d1da0fdcc37b327737f43'
-         '62b73cf181fdc227c95aade509b65c0a'
+         '84f6b0db44e5142bb59aeabc7ea875af'
          '6eb6ecdf33454f35b6c2409b863c816f'
          'f6921f0413215ae174e81306be80d37f'
-         'c08b0f116674b1eb8cd5902c1f497644'
+         'be02f5d21373f97224ffa4727ec9718a'
          'd210c43fb9ee9ad6cd7648e0c2e0efea'
          '0c808fa12672289f86b0651545381308'
          '0469d775db9fdd18ea95dd41937ada82'
@@ -120,6 +129,8 @@ md5sums=('31923ec126fe1c264fceb459d2175161'
          '622f400fd098cbc43c203e3210a6694e'
          'd06c4327cc69aeead3fa05f39660f33e'
          '129353c8ad92e89c691382a98dd5ce77'
-         'e6a3ed8b8f6abe357bd1736ff1e63001'
+         'f6ff1fb4bacee930007b877424619b30'
+         'e06147db25d75cf246886137a4ea164a'
          '98e9242ae346f729b14cb195786571f2'
-         '40fa09bdb1ae60f3fe767f1c6a979b65')
+         '40fa09bdb1ae60f3fe767f1c6a979b65'
+         'c7178bbf384bbe86c318b60fef6faf10')
diff --git a/abs/core/xymon/hbfunc.py b/abs/core/xymon/hbfunc.py
index edd2461..39e1680 100644
--- a/abs/core/xymon/hbfunc.py
+++ b/abs/core/xymon/hbfunc.py
@@ -2,11 +2,13 @@
 #checks that the MBE can connect to the minions
 
 # ===============================================
-import sys
+import sys, subprocess
 import os
 import string
 import time
 import func.overlord.client as fc
+import datetime
+
 BBLINE = ''
 BBCOLOR="green"
 DATE = time.strftime("%a %b %d %H:%M:%S %Z %Y", time.localtime(time.time()))
@@ -27,6 +29,91 @@ BBDISP="127.0.01"
 #     MACHINE=os.environ['MACHINE']
 
 
+failed_func_hosts_file="/data/srv/httpd/htdocs/failed_func_hosts"
+
+def print_out(msg):
+    #print msg
+    pass
+
+def clear_func_cert(currentclient):
+     cmd="sudo /usr/bin/certmaster-ca -c " + currentclient
+     os.system(cmd)
+     line="clearing out certs via certmaster: %s" %currentclient
+     print_out(line)
+
+
+def ispresent_failedfunc(host):
+    host=host.split(",")[0].strip()
+    ispresent = False
+    try:
+        f = open(failed_func_hosts_file, "r")
+        failed_list = f.readlines()
+        for line in failed_list:
+            print_out(host+" "+line)
+            if host.strip() == line.split(",")[0].strip():
+                ispresent = True
+                break
+    except:
+        pass
+    print_out("host: %s is present %s" %(host,ispresent))
+    return ispresent
+
+def remove_from_failedfunc(host):
+    count_fail="/tmp/%s.failed" %host
+    print_out("removing from failed list: %s" %host)
+    f = open(failed_func_hosts_file,'r')
+    failed_lines=f.readlines()
+    f.close
+    f = open(failed_func_hosts_file,'w')
+    for line in failed_lines:
+        if line.startswith(currentclient.strip()):
+            continue
+        f.write(line)
+    f.close()
+    if os.path.exists(count_fail):
+        os.remove(count_fail)
+
+def count_failed(host):
+
+
+    now = datetime.datetime.now()
+    now_str=str(now)
+    fc=0
+    count_fail="/tmp/%s.failed" %host
+    with open(count_fail, "a") as f:
+            f.write(now_str+"\n")
+
+    f = open(count_fail, "r")
+    failed_list = f.readlines()
+    f.close()
+    fc=len(failed_list)
+    print_out("number of failures for %s: %s" %(host,fc))
+    return fc
+
+
+
+def add_to_failed_host(host):
+    #check number of times it's failed.  If more then three, write func file
+    cf = count_failed(host.split(",")[0].strip())
+    currentclient = host.split(",")[0].strip()
+    if not ispresent_failedfunc(host) and cf  > 3:
+        with open(failed_func_hosts_file, "a") as f:
+            f.write(host+"\n")
+        print_out("adding %s to failed_func" %host)
+        clear_func_cert(currentclient)
+    else:
+        if cf < 3:
+            line="%s has less then 3 failues" %host.split(",")[0]
+            BBLINE="%s: %s failures  (yellow)  \n "  %(currentclient, cf)
+            LINE = "status " + currentclient  + ".func yellow" + " " + DATE + " " + BBLINE
+            cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+            os.system(cmd)
+            print_out("sending yellow for %s" %currentclient)
+        else:
+            line="%s is already in failed func file" %host.split(",")[0]
+            clear_func_cert(currentclient)
+        print_out(line)
+
 def readbb():
         global hostlist
         global mythtype
@@ -41,12 +128,10 @@ def readbb():
                 infile.close()
         for line in bbhostlist:
             cline=line.strip()
-            #if not cline.startswith("#") and cline != '' and cline.find("bbd") == -1 and cline.find("func") != -1  :
             if not cline.startswith("#") and cline != '' and cline.find("func") != -1  :
                 host=cline.split("#")
                 host=host[0].split()
                 hostlist.append(host[1].strip())
-        #print hostlist
         infile.close()
         try:
                 infile = open('/etc/mythtv-releasetype')
@@ -61,13 +146,16 @@ def find_local_myth_version():
     local_pkg_name="not_found"
     pkgname="mythtv"
     pkgname+=mythtype
-    cmd="/usr/bin/pacman -Q %s " %pkgname
-    result = os.popen2(cmd)[1].readlines()
+    cmd="/usr/bin/pacman"
+    proc = subprocess.Popen([cmd, "-Q" , pkgname], stdout=subprocess.PIPE)
+    result=[]
+    result.append( proc.communicate()[0])
     for list in result:
         l=list.strip()
         if l.startswith('mythtv') :
             local_pkg_name=l.strip()
             break
+    print_out("pkg name is: %s" %local_pkg_name )
     return local_pkg_name
 
 
@@ -117,13 +205,14 @@ hostlist = []
 readbb()
 local_myth_version=find_local_myth_version()
 
-for currentclient in hostlist:
-    #print currentclient
+for currentclient_a in hostlist:
+    currentclient=currentclient_a.lower()
+    print currentclient
     cmd='/data/srv/xymon/server/bin/xymon 127.0.0.1  "query '
     cmd+=currentclient
     cmd+='.conn"'
     bbresults=os.popen(cmd,'r'	).readline().strip().split()
-
+    #check if host is active
     try:
         bbstate=bbresults[0]
     except:
@@ -132,18 +221,18 @@ for currentclient in hostlist:
     #print bbstate
     if bbstate == 'green':
         try:
-            client = (fc.Client( currentclient ))
+            client = (fc.Client( currentclient.lower() ))
         except Exception as e:
             #couldn't find minion in certmaster
-            #print "couldn't find minion in certmaster:%s" %currentclient
             BBLINE="%s: %s  (red)  \n "  %(currentclient,e)
             LINE = "status " + currentclient  + ".func red" + " " + DATE + " " + BBLINE
             cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
-            cmd2= "echo " + currentclient + " >> /data/srv/httpd/htdocs/failed_func_hosts"
-            os.system(cmd2)
             os.system(cmd)
             BBCOLOR="red"
             send_myth_clear(currentclient)
+            add_to_failed_host(currentclient + ", func client error")
+            clear_func_cert(currentclient)
+
             continue
 
 
@@ -153,26 +242,24 @@ for currentclient in hostlist:
             #print results[currentclient]
             #print type(results[currentclient])
             #print "----------"
-            if  type(results[currentclient]) == str:
+            if "socket.error" in results[currentclient]:
+                print_out("socket error occured")
+                BBLINE="%s: %s  (red)  \n "  %(currentclient,"socket error occured")
+                LINE = "status " + currentclient  + ".func red" + " " + DATE + " " + BBLINE
+                cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+                os.system(cmd)
+                add_to_failed_host(currentclient + ", socket error occured")
+
+
+            elif  type(results[currentclient]) == str:
                 if results[currentclient] == '12':
+
                     BBLINE="%s:  success (green) \n " %currentclient
                     LINE = "status " + currentclient  + ".func green" + " " + DATE + " " + BBLINE
                     cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
                     os.system(cmd)
                     #REMOVE HOST FROM FAILED_FUNC
-                    #cmd='sed -i "/' +  currentclient + '/d" /data/srv/httpd/htdocs/failed_func_hosts'
-                    f = open("/data/srv/httpd/htdocs/failed_func_hosts")
-                    failed_lines=f.readlines()
-                    f.close
-                    f = open("/data/srv/httpd/htdocs/failed_func_hosts",'w')
-                    for line in failed_lines:
-                        if line.strip() == currentclient:
-                            continue
-                        f.write(line)
-                    f.close()
-
-
-                    #os.system(cmd)
+                    remove_from_failedfunc(currentclient)
                     mythversion_check(currentclient,local_myth_version)
                 else:
                     BBLINE="%s:  connected but wtf  (yellow)  \n " %currentclient
@@ -185,33 +272,24 @@ for currentclient in hostlist:
                 BBLINE="%s: %s  (red)  \n "  %(currentclient,results[currentclient])
                 LINE = "status " + currentclient  + ".func red" + " " + DATE + " " + BBLINE
                 cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
-                cmd2= "echo " + currentclient + " >> /data/srv/httpd/htdocs/failed_func_hosts"
-                cmd3="sudo /usr/bin/certmaster-ca -c " + currentclient
-                os.system(cmd2)
-                os.system(cmd3)
                 os.system(cmd)
+                add_to_failed_host(currentclient + ", test failed")
+
+                BBCOLOR="red"
+
+        except Exception as e:
+                print_out(e)
+                BBLINE="%s had an error : %s (red) \n "   % (currentclient,str(results))
+                LINE = "status " + currentclient  + ".func red" + " " + DATE + " " + BBLINE
+                cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+                os.system(cmd)
+                add_to_failed_host(currentclient + ", had an error")
+
                 BBCOLOR="red"
-        except:
-            BBLINE="%s had an error : %s (red) \n "   % (currentclient,str(results))
-            LINE = "status " + currentclient  + ".func red" + " " + DATE + " " + BBLINE
-            cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
-            cmd2= "echo " + currentclient + " >> /data/srv/httpd/htdocs/failed_func_hosts"
-            os.system(cmd)
-            os.system(cmd2)
-            cmd3="sudo /usr/bin/certmaster-ca -c " + currentclient
-            os.system(cmd3)
-            BBCOLOR="red"
     else:
-        BBLINE+= "Not  testing %s \n "  % currentclient
+        BBLINE= "Not  testing %s \n "  % currentclient
         LINE = "status " + currentclient  + ".func clear" + " " + DATE + " " + BBLINE
         cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
         os.system(cmd)
         BBCOLOR="clear"
         send_myth_clear(currentclient)
-
-#LINE = "status " + MACHINE + ".func green" + " " + DATE + " " + BBLINE
-#cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
-#os.system(cmd)
-
-#print BBLINE
-#print BBCOLOR
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
index e08992c..13dbd86 100644
--- a/abs/core/xymon/hbnotes.py
+++ b/abs/core/xymon/hbnotes.py
@@ -50,6 +50,7 @@ def main(argv):
 
     # create a cursor
     cursor = db.cursor()
+
 #------------------------------write client-config------------------------------------------------
     SQL="SELECT DISTINCT(hostname) from settings where hostname not in(%s)"
     cursor.execute(SQL %ignorehostlist)
@@ -65,9 +66,8 @@ def main(argv):
     dotslave=list()
     dotslavefe=list()
     tunerdict = {}
-    currenthostype=''
     for row in result:
-  #     print row[0]
+       #print row[0]
    #Find the system type
        cursor.execute("select value,data  from settings where hostname=%s and value in ('HostSystemType','HostRunFrontend');",(row))
        hostvalues=cursor.fetchall()
@@ -94,64 +94,67 @@ def main(argv):
                     tunerdict["MBE"]=tstring
 
           elif hostvalues[1][1] == 'Master_backend':
-              print "found MBE"
-              print hostvalues
+
               if hostvalues[0][1]=='0':
                   masterbackend+=","+row[0]
-                  #dotMBE=row[0] + "\\n Master Backend"
-		  #This is wrong, but it's enough to get it working
-                  dotMBE=''
+                  dotMBE="MBE" + " [ label=\"" + row[0]  + "  \\n Master Backend \" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\"  fontcolor=\"white\"  color=blue4 style=filled   ] "
               else:
                   masterbacked_w_fe+=","+row[0]
                   dotMBE="MBE" + " [ label=\"" + row[0]  + "  \\n Master Backend with frontend  \" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\"  fontcolor=\"white\"  color=blue4 style=filled   ] "
+                  dotfrontend.append(row[0])
               cursor.execute("select cardtype,defaultinput  from capturecard  where hostname=%s;",(row))
               tuners=cursor.fetchall()
               tstring=""
-              if len(tuners) == 0:
-                 tunerdict["MBE"]="no tuners \\n"
+
+              if len(tuners) <= 0:
+                tunerdict["MBE"]="no tuners \\n"
               else:
-                    for t in tuners:
-                            tstring+=t[0]
-                            tstring+=t[1]
-                            tstring+='\\n'
-                            tunerdict["MBE"]=tstring
-              dotfrontend.append(row[0])
+                #print tuners
+                for t in tuners:
+                        tstring+=t[0]
+                        tstring+=t[1]
+                        tstring+='\\n'
+                        tunerdict["MBE"]=tstring
 
           elif hostvalues[1][1] == 'Slave_backend':
+              cursor.execute("select cardtype,defaultinput  from capturecard  where hostname=%s;",(row))
+              tuners=cursor.fetchall()
+              #slave withoutfe
               if hostvalues[0][1]=='0':
                   slave+=","+row[0]
                   dotslave.append(row[0])
-                  cursor.execute("select cardtype,defaultinput  from capturecard  where hostname=%s;",(row))
-                  tuners=cursor.fetchall()
                   tstring=""
-                  for t in tuners:
-                        tstring+=t[0]
-                        tstring+=t[1]
-                        tstring+='\\n'
-                  tunerdict["STUNER"+row[0]]=tstring
-                  #dotfrontend.append(row[0])
+                  if len(tuners) <= 0:
+                      tunerdict["STUNER"+row[0]]="No Tuners"
+                  else:
+                      for t in tuners:
+                            tstring+=t[0]
+                            tstring+=t[1]
+                            tstring+='\\n'
+                            tunerdict["STUNER"+row[0]]=tstring
               else:
-                  cursor.execute("select cardtype,defaultinput  from capturecard  where hostname=%s;",(row))
-                  tuners=cursor.fetchall()
+                  #slave with fe
                   tstring=""
-                  for t in tuners:
-                        tstring+=t[0]
-                        tstring+=t[1]
-                        tstring+='\\n'
-                  tunerdict["STUNER"+row[0]]=tstring
-                  print tstring
-
+                  if len(tuners) <= 0:
+                     tunerdict["STUNER"+row[0]]="No Tuners"
+                  else:
+                      for t in tuners:
+                            tstring+=t[0]
+                            tstring+=t[1]
+                            tstring+='\\n'
+                            tunerdict["STUNER"+row[0]]=tstring
                   slave_w_fe+=","+row[0]
                   dotslave.append(row[0])
                   dotfrontend.append(row[0])
 
+
 #----------------------------------Create graphviz dot files
     dotfilename="/data/srv/xymon/server/etc/mythdot"
 
     dotfile=open(dotfilename,'w')
     dotfile.write("digraph G {   " + "\n" )
     dotfile.write("graph [bgcolor=transparent]" + "\n" )
-
+    #print tunerdict
 
 #define the nodes
     dotfile.write( dotMBE + "  \n" )
@@ -163,11 +166,16 @@ def main(argv):
 
     for fe in dotslave:
         cslave="STUNER"+fe
+        #adding tuners to dot file
         if tunerdict[cslave] != "" :
-            dotfile.write(cslave+   " [ label= \"" + tunerdict[cslave] +     "\" ,  shape=box ]     \n" )
+            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  "  )
 
@@ -178,7 +186,7 @@ def main(argv):
         cslave="STUNER"+fe
         dotfile.write("SLAVE" + fe + "-> MBE [color=\"green\"]  \n  "  )
         if tunerdict[cslave] != "" :
-            dotfile.write(cslave + "-> SLAVE"+fe + "\n"  )
+            dotfile.write(cslave + "-> SLAVE"+fe +  "[color=\"red\"]"  "\n"  )
 
 
 
@@ -186,58 +194,60 @@ def main(argv):
     dotfile.close()
 
 
-    cmd="/usr/bin/unflatten -l6 -c3 -f " + dotfilename + " |/usr/bin/dot -Tpng  -o/data/srv/httpd/htdocs/xymon/gifs/network.png "
+    cmd="/usr/bin/unflatten -l1 -c3 -f " + dotfilename + " |/usr/bin/dot -Tpng  -o/data/srv/httpd/htdocs/xymon/gifs/network.png "
  #   cmd="/usr/bin/circo -Tpng  -o/data/srv/httpd/htdocs/xymon/gifs/network.png " + dotfilename
 
     results=os.popen(cmd,'r')
 
  #--------------------------------------------------
     #hobbitfile="/data/srv/xymon/server/etc/hobbit-clients.cfg"
-    hobbitfile="/data/srv/xymon/server/etc/tasks.cfg"
-    hobbitf=open(hobbitfile,'r')
-    hobbitconfig=hobbitf.readlines()
-    hobbitf.close()
-    hobbitf=open(hobbitfile,'w')
-    print "FE",frontonly
-    print "MBE",masterbackend
-    print "MBEwFW",masterbacked_w_fe
-    print "SLAVEwFW",slave_w_fe
-    print "SLAVE",slave
-    print "STD",stand_alone
-
-    for line in hobbitconfig:
-        if line.startswith("HOST"):
-            cline=line.split("=")
-            if cline[1].startswith("_FRONTEND_"):
-                pline="HOST="
-                pline+=frontonly.strip()
-                hobbitf.write(pline + "\n")
-            elif cline[1].startswith("_MASTERBACKEND_"):
-                pline="HOST="
-                pline+=masterbackend.strip()
-                #print pline
-                hobbitf.write(pline+ "\n")
-            elif cline[1].startswith("_MASTERFRONTEND_"):
-                pline="HOST="
-                pline+=masterbacked_w_fe.strip()
-                #print pline
-                hobbitf.write(pline+ "\n")
-            elif cline[1].startswith("_SLAVEBACKEND_"):
-                pline="HOST="
-                pline+=slave.strip()
-                #print pline
-                hobbitf.write(pline+ "\n")
-            elif cline[1].startswith("_SLAVEFE_"):
-                pline="HOST="
-                pline+=slave_w_fe.strip()
-                #print pline
-                hobbitf.write(pline+ "\n")
-            else:
-                #print line
-                hobbitf.write(line)
-        else:
-            #print line
-            hobbitf.write(line)
+
+    ###WHY WAS THIS HERE??
+    #hobbitfile="/data/srv/xymon/server/etc/tasks.cfg"
+    #hobbitf=open(hobbitfile,'r')
+    #hobbitconfig=hobbitf.readlines()
+    #hobbitf.close()
+    #hobbitf=open(hobbitfile,'w')
+    #print "FE",frontonly
+    #print "MBE",masterbackend
+    #print "MBEwFW",masterbacked_w_fe
+    #print "SLAVEwFW",slave_w_fe
+    #print "SLAVE",slave
+    #print "STD",stand_alone
+
+    #for line in hobbitconfig:
+        #if line.startswith("HOST"):
+            #cline=line.split("=")
+            #if cline[1].startswith("_FRONTEND_"):
+                #pline="HOST="
+                #pline+=frontonly.strip()
+                #hobbitf.write(pline + "\n")
+            #elif cline[1].startswith("_MASTERBACKEND_"):
+                #pline="HOST="
+                #pline+=masterbackend.strip()
+                ##print pline
+                #hobbitf.write(pline+ "\n")
+            #elif cline[1].startswith("_MASTERFRONTEND_"):
+                #pline="HOST="
+                #pline+=masterbacked_w_fe.strip()
+                ##print pline
+                #hobbitf.write(pline+ "\n")
+            #elif cline[1].startswith("_SLAVEBACKEND_"):
+                #pline="HOST="
+                #pline+=slave.strip()
+                ##print pline
+                #hobbitf.write(pline+ "\n")
+            #elif cline[1].startswith("_SLAVEFE_"):
+                #pline="HOST="
+                #pline+=slave_w_fe.strip()
+                ##print pline
+                #hobbitf.write(pline+ "\n")
+            #else:
+                ##print line
+                #hobbitf.write(line)
+        #else:
+            ##print line
+            #hobbitf.write(line)
 
 #-----------------------------------------------------------END CLIENT CONFIG
 
diff --git a/abs/core/xymon/led_themes.tar.gz b/abs/core/xymon/led_themes.tar.gz
new file mode 100644
index 0000000..b9bd1e1
Binary files /dev/null and b/abs/core/xymon/led_themes.tar.gz differ
diff --git a/abs/core/xymon/logrotate-client.xymon b/abs/core/xymon/logrotate-client.xymon
new file mode 100644
index 0000000..e1051aa
--- /dev/null
+++ b/abs/core/xymon/logrotate-client.xymon
@@ -0,0 +1,14 @@
+/data/srv/xymon/client/logs/* {
+   missingok
+   daily 
+   rotate 2
+   compress
+   postrotate
+       if [ -f /service/xymon-client/run ]
+       then
+         sv hup xymon-client
+       fi
+
+   endscript
+
+}
diff --git a/abs/core/xymon/logrotate-server.xymon b/abs/core/xymon/logrotate-server.xymon
new file mode 100644
index 0000000..e69c5d9
--- /dev/null
+++ b/abs/core/xymon/logrotate-server.xymon
@@ -0,0 +1,14 @@
+/var/log/hobbit/* {
+   missingok
+   daily 
+   rotate 2
+   compress
+   postrotate
+       if [ -f /service/xymon-server/run ]
+       then
+         sv hup xymon-server 2&>1 > /dev/null
+      fi
+
+   endscript
+
+}
diff --git a/abs/core/xymon/logrotate.xymon b/abs/core/xymon/logrotate.xymon
deleted file mode 100644
index a86a0ba..0000000
--- a/abs/core/xymon/logrotate.xymon
+++ /dev/null
@@ -1,11 +0,0 @@
-/var/log/hobbit/* {
-   missingok
-   daily 
-   rotate 2
-   compress
-   postrotate
-     sv restart xymon-server
-     sv restart xymon-client
-   endscript
-
-}
diff --git a/abs/core/xymon/xymon.install b/abs/core/xymon/xymon.install
index 08fbd8c..ae6d3f1 100644
--- a/abs/core/xymon/xymon.install
+++ b/abs/core/xymon/xymon.install
@@ -26,7 +26,7 @@ post_install() {
   echo "Adding sudo permissions for http {backup_job}"
   LINE="nobody    ALL = NOPASSWD:/usr/bin/certmaster-ca"
   LINE1="http    ALL = NOPASSWD:/usr/MythVantage/bin/backup_job"
- 
+        setfacl -R -m u:nobody:rwx /data/srv/httpd/htdocs 
   for i in "$LINE"  "$LINE1"
   do
           cp /etc/sudoers /etc/sudoers.bak
-- 
cgit v0.12