summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/hbnotes.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2013-01-05 02:41:23 (GMT)
committerJames Meyer <james.meyer@operamail.com>2013-01-05 02:41:23 (GMT)
commitc2e98d262d9e6003dfe7aadee5713028fb4d27cb (patch)
tree5300eb75b5934718cffc8e7437467eb2ead86fda /abs/core/xymon/hbnotes.py
parent8535c8a04075454c676a548dbec40673b0ad62e0 (diff)
downloadlinhes_pkgbuild-c2e98d262d9e6003dfe7aadee5713028fb4d27cb.zip
linhes_pkgbuild-c2e98d262d9e6003dfe7aadee5713028fb4d27cb.tar.gz
linhes_pkgbuild-c2e98d262d9e6003dfe7aadee5713028fb4d27cb.tar.bz2
xymon: hbnotes, for MBE systems generate a notes file that allows the download/upload of backup files.
refs #893
Diffstat (limited to 'abs/core/xymon/hbnotes.py')
-rw-r--r--abs/core/xymon/hbnotes.py127
1 files changed, 92 insertions, 35 deletions
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
index 8d73dbf..be34dc6 100644
--- a/abs/core/xymon/hbnotes.py
+++ b/abs/core/xymon/hbnotes.py
@@ -173,8 +173,8 @@ def create_dot_file():
def createdropdown(currenthostype):
dir = "/data/storage/disk0/backup/system_backups"
- dropdown=" "
dropdown='''
+ </br>
<input name="param2" type="radio" value="Restore" />Restore database </>
<select name="param1">\n'''
os.chdir(dir)
@@ -185,13 +185,37 @@ def createdropdown(currenthostype):
if len(files) > 20:
del files[20:]
-
for file in files:
if (file.endswith(".tgz")):
dropdown+=' <option value="' + file + '">' + file + '</option> \n'
- dropdown+=''' </select>
+ dropdown+='''
+ </select>
+ </br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp
+ <input type="checkbox" name="param8" >Partial Restore<br>
+
<br>
+ <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 />
+ '''
+
+ #This is for the d/l backup option
+ dropdown+='''
+
+
+ <input name="param2" type="radio" value="Dbackup" />Download backup </>
+ <select name="param7">\n\n </br>'''
+
+ for file in files:
+ if (file.endswith(".tgz")):
+ dropdown+=' <option value="' + file + '">' + file + '</option> \n'
+
+ dropdown+='''
+ </select>
+
+ <br>
<input name="param2" type="radio" value="Optimize" />Optimize database<br />
'''
if currenthostype == "Master_backend":
@@ -215,7 +239,8 @@ def create_notes():
cursor.execute("SELECT DISTINCT(hostname) from settings")
result = cursor.fetchall()
for row in result:
- cursor.execute("select value,data from settings where hostname=%s and value in ('HostSystemType','HostHwuuid');",(row))
+ #cursor.execute("select value,data from settings where hostname=%s and value in ('HostSystemType','HostHwuuid');",(row))
+ cursor.execute("select value,data from settings where hostname=%s and value in ('HostSystemType','HardwareProfilePublicUUID');",(row))
hostvalues=cursor.fetchall()
#This is here to ignore non LinHES hosts, or those that don't have a HostSystemType
if len(hostvalues) == 0:
@@ -261,6 +286,38 @@ function Do_it ()
alert(" database was not restored");
}
}
+ else if (chosen == "Backup")
+ {
+ if (confirm('Continue with database backup?'))
+ {
+ do_submission();
+ }
+ else
+ {
+ alert(" backup cancelled");
+ }
+ }
+ else if (chosen == "Upload")
+ {
+ if (confirm('About to upload the backup file to server'))
+ {
+ alert("Uploading file to server");
+ do_submission();
+ }
+ }
+ else if (chosen == "Optimize")
+ {
+ if (confirm('Continue with database maintenance?'))
+ {
+ do_submission();
+ }
+ else
+ {
+ alert("Optimization cancelled");
+ }
+ }
+
+
else if (chosen == "Shutdown")
{
@@ -318,7 +375,8 @@ function Do_it ()
data=hostvalues[i][1]
currenthostype=''
currenthostname=''
- if value == "HostHwuuid" :
+ #if value == "HostHwuuid" :
+ if value == "HardwareProfilePublicUUID" :
if data != "blank" :
found_uuid="true"
uuid=data
@@ -337,46 +395,45 @@ function Do_it ()
file.write("\" >" + str(uuid) + "</A>")
else:
file.write( "uuid not found, please submit a hardware profile" )
-
-
-
buttonform_top='''
- <div class="content" style="solid #aaa; width:500px; height:350px; overflow:auto; color:#FFF;text-align:left;">
- <form name="form" action="/process.py" method="get">
- '''
+ <div id="resultbox" >
+ <form name="form" action="/process.py" enctype="multipart/form-data" method="POST" >
+ '''
buttonform_bottom='''
- <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: </>
- <select name="param6">
- <option value="killX">Full UI</option>
- <option value="killmyth">MythFrontend</option>
- </select>
- </br>
-
- <input name="param2" type="radio" value="Shutdown" />Shutdown System<br />
- <input name="param2" type="radio" value="Reboot" />Reboot System<br />
- <input name="param2" type="radio" value="WOL" />Wake on Lan<br />
- <input name="hiddenparam" type="hidden" value=" '''
+ <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: </>
+ <select name="param6">
+ <option value="killX">Full UI</option>
+ <option value="killmyth">MythFrontend</option>
+ </select>
+ </br>
+
+ <input name="param2" type="radio" value="Shutdown" />Shutdown System<br />
+ <input name="param2" type="radio" value="Reboot" />Reboot System<br />
+ <input name="param2" type="radio" value="WOL" />Wake on Lan<br />
+ <input name="hiddenparam" type="hidden" value="
+ '''
oldurlform=''' "/>
- <input name="param4" type="hidden" value="
+ <input name="param4" type="hidden" value="
'''
-
-
closetag='''
"/>
+ </br>
+ </div>
</br>
- <!--<input id="submitbutton" type="submit" />-->
- <a href="Javascript:Do_it();">
- <img src="/go.png"></a>
+ <div id="center_button" >
+ <!--<input id="submitbutton" type="submit" />-->
+ <a href="Javascript:Do_it();">
+ <img src="/go.png"></a>
</form>
</div>
'''