diff options
author | Britney Fransen <brfransen@gmail.com> | 2014-10-26 20:26:56 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2014-10-26 20:26:56 (GMT) |
commit | 01c1a60f3b7f93b3ed7404196c2cf798c4d8c674 (patch) | |
tree | 6de557714e6336282fbc0ab16c6578386dfc6654 /abs/core/xymon/hbnotes.py | |
parent | 3a6f9152e03720d73eaf386fdb203028573aebd0 (diff) | |
parent | 525bfed2bec6b2671ad3a82aa88b9baf1b01111c (diff) | |
download | linhes_pkgbuild-01c1a60f3b7f93b3ed7404196c2cf798c4d8c674.zip linhes_pkgbuild-01c1a60f3b7f93b3ed7404196c2cf798c4d8c674.tar.gz linhes_pkgbuild-01c1a60f3b7f93b3ed7404196c2cf798c4d8c674.tar.bz2 |
Merge branch 'testing' of linhes.org:linhes_pkgbuild into testingR8.2
Diffstat (limited to 'abs/core/xymon/hbnotes.py')
-rwxr-xr-x | abs/core/xymon/hbnotes.py | 64 |
1 files changed, 35 insertions, 29 deletions
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> |