summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/hbnotes.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/xymon/hbnotes.py')
-rwxr-xr-x[-rw-r--r--]abs/core/xymon/hbnotes.py129
1 files changed, 68 insertions, 61 deletions
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
index b5ad72a..d14d62a 100644..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 "
@@ -167,7 +169,7 @@ def create_dot_file():
results=os.popen(cmd,'r')
return frontonly,masterbackend,masterbacked_w_fe,slave_w_fe,slave,stand_alone
-
+
@@ -176,7 +178,7 @@ def createdropdown(currenthostype):
dir = "/data/storage/disk0/backup/system_backups"
dropdown='''
</br>
- <input name="param2" type="radio" value="Restore" />Restore database </>
+ <input name="param2" type="radio" value="Restore" />Restore Database: </>
<select name="param1">\n'''
os.chdir(dir)
if os.path.exists(dir):
@@ -195,18 +197,18 @@ def createdropdown(currenthostype):
<input type="checkbox" name="param8" >Partial Restore<br>
<br>
- <input name="param2" type="radio" value="Upload" />Upload file to restore </>
+ <input name="param2" type="radio" value="Upload" />Upload File to Restore: </>
<input name="uFile" type="file" size="40">
<br><br>
- <input name="param2" type="radio" value="Backup" checked="checked" />Backup database<br />
+ <input name="param2" type="radio" value="Backup" checked="checked" />Backup System<br />
'''
#This is for the d/l backup option
dropdown+='''
-
- <input name="param2" type="radio" value="Dbackup" />Download backup </>
+ </br>
+ <input name="param2" type="radio" value="Dbackup" />Download Backup: </>
<select name="param7">\n\n </br>'''
for file in files:
@@ -216,18 +218,16 @@ def createdropdown(currenthostype):
dropdown+='''
</select>
- <br>
- <input name="param2" type="radio" value="Optimize" />Optimize database<br />
+ </br>
+ </br>
+ <input name="param2" type="radio" value="Optimize" />Optimize Database<br />
'''
+
if currenthostype == "Master_backend":
- dropdown+='<input name="param2" type="radio" value="ShutdownAll" />Shutdown All Systems (except master backend)<br /> \n'
- #dropdown+='''<input name="param2" type="radio" value="UpdateAll" />Update All Systems </> <select name="param5">
- #<option value="Myth_only">Myth only</option>
- #<option value="All"> Full System</option>
- #</select>
- #</br>
- #</br>
- #</br>'''
+ dropdown+='</br><input name="param2" type="radio" value="ShutdownAll" />Shutdown All Systems (except master backend)<br /> \n'
+
+ #Add option to restart MBE
+ dropdown+='</br> <input name="param2" type="radio" value="RestartMBE" />Restart MBE service<br /> \n'
dropdown+=''' </br></br>\n'''
return dropdown
@@ -250,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>
@@ -284,7 +288,7 @@ function Do_it ()
}
else
{
- alert(" database was not restored");
+ alert("The database was not restored.");
}
}
else if (chosen == "Backup")
@@ -295,14 +299,13 @@ function Do_it ()
}
else
{
- alert(" backup cancelled");
+ alert("Backup cancelled.");
}
}
else if (chosen == "Upload")
{
- if (confirm('About to upload the backup file to server'))
+ if (confirm('Upload the backup file to the server?'))
{
- alert("Uploading file to server");
do_submission();
}
}
@@ -314,7 +317,7 @@ function Do_it ()
}
else
{
- alert("Optimization cancelled");
+ alert("Optimization cancelled.");
}
}
@@ -325,7 +328,7 @@ function Do_it ()
if (confirm('Continue with server shutdown?'))
{
do_submission();
- alert("system is powering off");
+ alert("The system is powering off.");
}
}
@@ -334,7 +337,7 @@ function Do_it ()
if (confirm('Continue with server restart?'))
{
do_submission();
- alert("system is restarting");
+ alert("The system is restarting.");
}
}
@@ -343,7 +346,7 @@ function Do_it ()
if (confirm('Continue with powering off all servers except master backend?'))
{
do_submission();
- alert("systems are powering off");
+ alert("Systems are powering off.");
}
}
@@ -353,7 +356,6 @@ function Do_it ()
if (confirm('Continue with applying updates?'))
{
do_submission();
- alert("system is updating");
}
}
@@ -403,23 +405,27 @@ function Do_it ()
buttonform_bottom='''
- <input name="param2" type="radio" value="Update" />Update System </>
+ </br>
+ <input name="param2" type="radio" value="Update" />Update System: </>
<select name="param3">
<option value="Myth_only">Myth only</option>
<option value="All"> Full System</option>
</select>
</br>
-
- <input name="param2" type="radio" value="Kill" />Restart interface: </>
+ </br>
+ <input name="param2" type="radio" value="Kill" />Restart Interface: </>
<select name="param6">
- <option value="killX">Full UI</option>
<option value="killmyth">MythFrontend</option>
+ <option value="killX">Full UI</option>
</select>
</br>
-
+ </br>
<input name="param2" type="radio" value="Shutdown" />Shutdown System<br />
+ </br>
<input name="param2" type="radio" value="Reboot" />Reboot System<br />
- <input name="param2" type="radio" value="WOL" />Wake on Lan<br />
+ </br>
+ <input name="param2" type="radio" value="WOL" />Wake on LAN<br />
+ </br>
<input name="hiddenparam" type="hidden" value="
'''
@@ -441,6 +447,7 @@ function Do_it ()
if currenthostype == "Master_backend" or currenthostype == "Standalone":
mbeoptions=createdropdown(currenthostype)
+
else:
mbeoptions=''
returnurl="/xymon/notes/"
@@ -525,7 +532,7 @@ def main(argv):
slave_w_fe,
slave,
stand_alone)
-
+
if __name__ == "__main__":
main(sys.argv[1:])