summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/hbnotes.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2013-11-26 21:53:44 (GMT)
committerJames Meyer <james.meyer@operamail.com>2013-11-26 21:53:44 (GMT)
commit653c9fdd68704738da04d233dd7bdc8f25e0eaf8 (patch)
tree80f60afde9c5c2e26596e8550e3078d7b32d955a /abs/core/xymon/hbnotes.py
parentc686ac72e3f81c94dcbc1c1996b83fe33161b7a4 (diff)
downloadlinhes_pkgbuild-653c9fdd68704738da04d233dd7bdc8f25e0eaf8.zip
linhes_pkgbuild-653c9fdd68704738da04d233dd7bdc8f25e0eaf8.tar.gz
linhes_pkgbuild-653c9fdd68704738da04d233dd7bdc8f25e0eaf8.tar.bz2
xymon-server: ignore /cdrom /mnt /media for disk checks.
Modify hbnotes.py so that it adds hosts to analysis.cfg. This is needed to define the proper checks per host type. refs #943
Diffstat (limited to 'abs/core/xymon/hbnotes.py')
-rw-r--r--abs/core/xymon/hbnotes.py130
1 files changed, 68 insertions, 62 deletions
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
index d643044..b5ad72a 100644
--- a/abs/core/xymon/hbnotes.py
+++ b/abs/core/xymon/hbnotes.py
@@ -28,7 +28,7 @@ def create_dot_file():
result = cursor.fetchall()
frontonly="_FRONTEND_"
masterbackend="_MASTERBACKEND_"
- masterbacked_w_fe="_MASTERFE_"
+ masterbacked_w_fe="_MASTERFRONTEND_"
slave_w_fe="_SLAVEFE_"
slave="_SLAVEBACKEND_"
stand_alone="_STANDALONE_"
@@ -166,7 +166,8 @@ def create_dot_file():
# cmd="/usr/bin/circo -Tpng -o/data/srv/httpd/htdocs/xymon/gifs/network.png " + dotfilename
results=os.popen(cmd,'r')
-
+ return frontonly,masterbackend,masterbacked_w_fe,slave_w_fe,slave,stand_alone
+
@@ -458,68 +459,73 @@ function Do_it ()
file.write(string)
-def main(argv):
- create_dot_file()
- create_notes()
-
+def create_hobbit_analysis(frontonly,
+ masterbackend,
+ masterbacked_w_fe,
+ slave_w_fe,
+ slave,
+ stand_alone):
-#------------------------------write client-config------------------------------------------------
-
-
- #--------------------------------------------------
- #hobbitfile="/home/xymon/server/etc/hobbit-clients.cfg"
-
- ###WHY WAS THIS HERE??
- #hobbitfile="/home/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
-
- # execute SQL statement
+ hobbitfile="/home/xymon/server/etc/analysis.cfg"
+ hobbitf=open(hobbitfile,'r')
+ hobbitconfig=hobbitf.readlines()
+ hobbitf.close()
+ try:
+ 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)
+ hobbitf.close()
+ except:
+ print "problem writing analysis.cfg"
+def main(argv):
+ frontonly,masterbackend,masterbacked_w_fe,slave_w_fe,slave,stand_alone = create_dot_file()
+ create_notes()
+ create_hobbit_analysis(frontonly,
+ masterbackend,
+ masterbacked_w_fe,
+ slave_w_fe,
+ slave,
+ stand_alone)
+
if __name__ == "__main__":
main(sys.argv[1:])