diff options
author | James Meyer <james.meyer@operamail.com> | 2012-09-23 18:39:57 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-09-23 18:39:57 (GMT) |
commit | b2a8f5b6cf0bd826151b23beaade6cc024c96d24 (patch) | |
tree | 74e3ad329f23fd1717635efe500cf439c79a427f /abs/core/xymon | |
parent | be519352aab83e48d3bfaeb2f076f373c1e8e9e4 (diff) | |
download | linhes_pkgbuild-b2a8f5b6cf0bd826151b23beaade6cc024c96d24.zip linhes_pkgbuild-b2a8f5b6cf0bd826151b23beaade6cc024c96d24.tar.gz linhes_pkgbuild-b2a8f5b6cf0bd826151b23beaade6cc024c96d24.tar.bz2 |
supplemental-web/xymon: When restoring the database from the webui, prompt to make sure it's really what the user wants.
Also limit db dropdown to 30 entries
Diffstat (limited to 'abs/core/xymon')
-rwxr-xr-x | abs/core/xymon/PKGBUILD | 4 | ||||
-rw-r--r-- | abs/core/xymon/hbnotes.py | 142 |
2 files changed, 99 insertions, 47 deletions
diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD index b68d1fe..8247592 100755 --- a/abs/core/xymon/PKGBUILD +++ b/abs/core/xymon/PKGBUILD @@ -1,7 +1,7 @@ pkgbase=xymon pkgname=(xymonserver xymonclient) pkgver=4.3.5 -pkgrel=33 +pkgrel=35 pkgdesc="Hobbit is a system for monitoring servers and networks. " license="GPL" arch=('i686' 'x86_64') @@ -119,7 +119,7 @@ md5sums=('31923ec126fe1c264fceb459d2175161' '2d88e59ab17114030da514ba3f0a5b64' 'ee608dcafc050d790e28647a670f6b60' 'b2f98ac0df013332deedc1efae0a270d' - '94e561bc2d9ba5755f04ed642485e83b' + '69439732c9f81c663d1cdd65be453631' '0f70e76a164f648f0a4a01110137cb20' 'f6921f0413215ae174e81306be80d37f' '54ba9d7bff5875150e511c608ffc1e6a' diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py index 6751865..78145f2 100644 --- a/abs/core/xymon/hbnotes.py +++ b/abs/core/xymon/hbnotes.py @@ -24,17 +24,26 @@ def createdropdown(currenthostype): dropdown=" " dropdown=''' <input name="param2" type="radio" value="Restore" />Restore database </> - <select name="param1"> - ''' + <select name="param1">\n''' + os.chdir(dir) if os.path.exists(dir): files = os.listdir(dir) - for file in os.listdir(dir): + files.sort(key=lambda x: os.path.getmtime(x) , reverse=True) + #for file in os.listdir(dir): + if len(files) > 20: + del files[20:] + + + for file in files: if (file.endswith(".tgz")): - dropdown+='<option value="' + file + '">' + file + '</option> ' - dropdown+='</select> <br><input name="param2" type="radio" value="Backup" checked="checked" />Backup database<br /> ' - dropdown+='<input name="param2" type="radio" value="Optimize" />Optimize database<br /> ' + dropdown+=' <option value="' + file + '">' + file + '</option> \n' + dropdown+=''' </select> + <br> + <input name="param2" type="radio" value="Backup" checked="checked" />Backup database<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 (expect MBE)<br /> ' + dropdown+='<input name="param2" type="radio" value="ShutdownAll" />Shutdown All Systems (expect MBE)<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> @@ -43,7 +52,7 @@ def createdropdown(currenthostype): #</br> #</br>''' - dropdown+=''' </br></br>''' + dropdown+=''' </br></br>\n''' return dropdown def main(argv): @@ -266,14 +275,55 @@ def main(argv): file = open(filename,'w') string=''' - <html> - <head> - <style type="text/css">@import "/frame.css";</style> - </head> - ''' +<html> +<head> <style type="text/css">@import "/frame.css";</style> +<SCRIPT> + +function do_submission() +{ + document.form.submit(); +} + + +function Do_it () +{ + chosen = "" + len = document.form.param2.length + for (i = 0; i <len; i++) + { + if (document.form.param2[i].checked) + { + chosen = document.form.param2[i].value + } + } + + + if (chosen == "Restore") + { + if (confirm('Continue with database restore?')) + { + do_submission(); + } + else + { + alert(" database was not restored"); + } + + + } + else + { + //alert("not restore") + do_submission(); + } +} + +</SCRIPT> +</head> + +''' file.write(string) - for i in range( 0 , len(hostvalues)): value=hostvalues[i][0] data=hostvalues[i][1] @@ -284,7 +334,6 @@ def main(argv): found_uuid="true" uuid=data if value == "HostSystemType" : - currenthostname= str(row[0]).strip() currenthostype=str(data).strip() header="<h1>" + currenthostname + " (" + currenthostype + ") </h1>" @@ -292,7 +341,7 @@ def main(argv): if found_uuid == "true" : - string=str("http://smolt.mythvantage.com/client/show?uuid=") + string=str("http://smolt.mythtv.org/client/show?uuid=") string+=str(uuid) file.write("<A href=\"" ) file.write(string) @@ -303,42 +352,45 @@ def main(argv): buttonform_top=''' - <div class="content" style="solid #aaa; width:500px; height:350px; overflow:auto; color:#FFF;text-align:left;"> - <form action="/process.py" method="get"> + <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"> ''' 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=" - ''' - oldurlform=''' - "/> - <input name="param4" 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=" + ''' closetag=''' "/> - </br> - <input id="submitbutton" type="submit" /> - </form> - </div> - ''' + </br> + <!--<input id="submitbutton" type="submit" />--> + <a href="Javascript:Do_it();"> + <img src="/go.png"></a> + </form> + </div> +''' if currenthostype == "Master_backend" or currenthostype == "Standalone": mbeoptions=createdropdown(currenthostype) @@ -356,7 +408,7 @@ def main(argv): file.write(returnurl) file.write(closetag) - string=(' </html>') + string=('</html>') file.write(string) if __name__ == "__main__": |