diff options
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:]) |