diff options
author | Britney Fransen <brfransen@gmail.com> | 2013-11-26 22:13:09 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2013-11-26 22:13:09 (GMT) |
commit | 6aa403867e2dcd53a0caca1def2090d8a3e82b5d (patch) | |
tree | fc154da14c260e92c273b29c85ac11ac238533f2 /abs/core/xymon/hbnotes.py | |
parent | 9f21e0cd8f7b16213e1170f17ec76fe4c97effb9 (diff) | |
parent | 653c9fdd68704738da04d233dd7bdc8f25e0eaf8 (diff) | |
download | linhes_pkgbuild-6aa403867e2dcd53a0caca1def2090d8a3e82b5d.zip linhes_pkgbuild-6aa403867e2dcd53a0caca1def2090d8a3e82b5d.tar.gz linhes_pkgbuild-6aa403867e2dcd53a0caca1def2090d8a3e82b5d.tar.bz2 |
Merge branch 'testing' of linhes.org:linhes_pkgbuild into testing
Diffstat (limited to 'abs/core/xymon/hbnotes.py')
-rw-r--r-- | abs/core/xymon/hbnotes.py | 130 |
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:]) |