flash("Welcome To MyOps!")
return dict(now=time.ctime())
- @expose(template="monitorweb.templates.nodelist")
+ @expose(template="monitorweb.templates.nodelist", allow_json=True)
+ def node3(self, filter=None):
+ nhquery = HistoryNodeRecord.query.all()
+ query = []
+ for nh in nhquery:
+ if filter:
+ if nh.status == filter:
+ query.append(nh)
+ else:
+ query.append(nh)
+
+ rquery=[]
+ for q in query:
+ fb = FindbadNodeRecord.get_latest_by(hostname=q.hostname)
+ rquery.append(fb)
+
+ return dict(now=time.ctime(), query=rquery)
+
+ @expose(template="monitorweb.templates.nodelist", allow_json=True)
def node2(self, filter=None):
nhquery = HistoryNodeRecord.query.all()
query = []
@expose(template="monitorweb.templates.nodescanhistory")
def nodescanhistory(self, hostname=None, length=10):
try: length = int(length)
- except: length = 10
+ except: length = 21
fbnode = FindbadNodeRecord.get_by(hostname=hostname)
# TODO: add links for earlier history if desired.
agg = prep_node_for_display(node, pcuhash=None, preppcu=False, asofdate=node.timestamp)
query.append(agg)
- return dict(query=query, hostname=hostname)
+ if 'length' in request.params:
+ del request.params['length']
+ return dict(query=query, hostname=hostname, params=request.params)
@expose(template="monitorweb.templates.nodehistory")
def nodehistory(self, hostname=None):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?python
-layout_params['page_title'] = "MyOps Node List"
+layout_params['page_title'] = "MyOps Node Scan History"
from monitor.util import diff_time
from time import mktime
from links import *
+from cherrypy import request, response
?>
<html py:layout="'sitemenu.kid'"
<script type="text/javascript">
function nodelist_paginator(opts) { plekit_table_paginator(opts, "nodelist"); }
</script>
+ <table width="100%">
+ <thead>
+ <tr>
+ <th><a href="${link('nodescanhistory', length=42, **params)}">Last Week</a></th>
+ <th><a href="${link('nodescanhistory', length=180, **params)}">Last Month</a></th>
+ <th><a href="${link('nodescanhistory', length=1000, **params)}">Last 1000</a></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="5">
<table id="nodelist" cellpadding="0" border="0" class="plekit_table sortable-onload-2 colstyle-alt no-arrow paginationcallback-nodelist_paginator max-pages-10 paginate-25">
<thead>
</tbody>
</table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>