add plc_nodeid and plc_siteid to history records so that the web templates can
authorStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 10 Jun 2009 21:54:45 +0000 (21:54 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 10 Jun 2009 21:54:45 +0000 (21:54 +0000)
reference sites and nodes by id rather than name, since the site_pattern and
nodepattern references do not exist any more in the new 4.3 wwwgui.

monitor/database/info/history.py
nodebad.py
sitebad.py
web/MonitorWeb/monitorweb/templates/links.py
web/MonitorWeb/monitorweb/templates/nodeview.kid
web/MonitorWeb/monitorweb/templates/pculist.kid
web/MonitorWeb/monitorweb/templates/pcuview.kid
web/MonitorWeb/monitorweb/templates/sitehistory.kid
web/MonitorWeb/monitorweb/templates/sitelist.kid
web/MonitorWeb/monitorweb/templates/siteview.kid

index 6d2ed83..19929a6 100644 (file)
@@ -16,6 +16,8 @@ class HistoryNodeRecord(Entity):
        last_changed = Field(DateTime,default=datetime.now)
        status = Field(String,default="unknown")
        haspcu = Field(Boolean,default=False)
+       plc_nodeid = Field(Int,default=1)
+
        acts_as_versioned(ignore=['last_changed', 'last_checked'])
 
        @classmethod
@@ -41,6 +43,7 @@ class HistoryPCURecord(Entity):
 
 class HistorySiteRecord(Entity):
        loginbase = Field(String(250),primary_key=True)
+       plc_siteid = Field(Int,default=1)
 
        last_checked = Field(DateTime,default=datetime.now)
        last_changed = Field(DateTime,default=datetime.now)
index 659591d..7f512e1 100755 (executable)
@@ -41,6 +41,7 @@ def check_node_state(rec, node):
                print rec.plc_node_stats
                boot_state = rec.plc_node_stats['boot_state']
                last_contact = rec.plc_node_stats['last_contact']
+               node.plc_nodeid = rec.plc_node_stats['node_id']
        else:
                boot_state = "unknown"
                last_contact = None
@@ -53,6 +54,7 @@ def check_node_state(rec, node):
        else:
                node.haspcu = False
 
+
        # NOTE: 'DOWN' and 'DEBUG'  are temporary states, so only need
        #                       'translations' into the node.status state
        #               'BOOT' is a permanent state, but we want it to have a bit of
index 6c09c1c..df4e522 100755 (executable)
@@ -110,6 +110,7 @@ def checkAndRecordState(l_sites, l_plcsites):
                                                                                                                        'penalty_level' : 0})
                        sitehist.last_checked = datetime.now()
 
+                       sitehist.plc_siteid = d_site['site_id']
                        sitehist.slices_total = d_site['max_slices']
                        sitehist.slices_used = len(d_site['slice_ids'])
                        sitehist.nodes_total = len(lb2hn[sitename])
index 2bc6917..e07d8f1 100644 (file)
@@ -6,6 +6,8 @@ def plc_mail_uri(ticketid):
        return config.RT_WEB_SERVER + "/Ticket/Display.html?id=" + str(ticketid)
 def plc_node_uri(hostname):
        return "https://" + config.PLC_WWW_HOSTNAME + "/db/nodes/index.php?nodepattern=" + str(hostname)
+def plc_node_uri_id(node_id):
+       return "https://" + config.PLC_WWW_HOSTNAME + "/db/nodes/index.php?id=" + str(node_id)
 def plc_site_uri(loginbase):
        return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?site_pattern=" + str(loginbase)
 def plc_site_uri_id(site_id):
index dc2820e..1b36b5c 100644 (file)
@@ -32,7 +32,7 @@ from links import *
                                                        <span class="icon">${node.loginbase}</span></a>
                                        </td>
                                        <td id="node-${node.observed_status}" nowrap="true" >
-                                               <a class="ext-link" href="${plc_node_uri(node.hostname)}">
+                                               <a class="ext-link" href="${plc_node_uri_id(node.plc_nodeid)}">
                                                        <span class="icon">${node.hostname}</span></a>
                                        </td>
                                        <td py:content="node.ping_status"></td>
index db3cef4..6671c70 100644 (file)
@@ -58,7 +58,7 @@ from links import *
       <td nowrap='true'>
        <div class='oneline'>
          <a class='left' href="${link('pcuview', loginbase=node.loginbase)}">${node.loginbase}</a>
-         <a class='right' href="${plc_site_uri(node.loginbase)}">
+         <a class='right' href="${plc_site_uri_id(node.plc_pcu_stats['site_id'])}">
            <img style='display: inline' border='0' src="static/images/extlink.gif" align='right'/></a>
        </div>
       </td>
index 56660a1..6e241d5 100644 (file)
@@ -28,7 +28,7 @@ from links import *
                        <tbody>
                                <tr py:for="i,site in enumerate(sitequery)" class="${i%2 and 'odd' or 'even'}" >
                                        <td><a href="sitehistory?loginbase=${site.loginbase}">history</a></td>
-                                       <td nowrap="true"><a class="ext-link" href="${plc_site_uri(site.loginbase)}">
+                                       <td nowrap="true"><a class="ext-link" href="${plc_site_uri_id(site.plc_siteid)}">
                                                        <span class="icon">${site.loginbase}</span></a>
                                        </td>
                                        <td py:content="site.enabled"></td>
@@ -158,7 +158,7 @@ from links import *
                                        <td></td>
                                        <td><a href="nodehistory?hostname=${node.hostname}">history</a></td>
                                        <td id="node-${node.observed_status}" nowrap="true" >
-                                               <a class="ext-link" href="${plc_node_uri(node.hostname)}">
+                                               <a class="ext-link" href="${plc_node_uri_id(node.plc_node_stats['node_id'])}">
                                                        <span class="icon">${node.hostname}</span></a>
                                        </td>
                                        <td py:content="diff_time(node.plc_node_stats['last_contact'])"></td>
index 03143a7..68e3c45 100644 (file)
@@ -33,7 +33,7 @@ from links import *
                                        <td nowrap="true">
                                                <div class='oneline'>
                                                <a class='left' href="${link('pcuview', loginbase=site.loginbase)}">${site.loginbase}</a>
-                                               <a class='right' href="${plc_site_uri(site.loginbase)}">
+                                               <a class='right' href="${plc_site_uri_id(site.plc_siteid)}">
                                                        <img style='display: inline' border='0' src="static/images/extlink.gif" align='right'/></a>
                                                </div>
                                        </td>
index 1f218f7..ec56bf1 100644 (file)
@@ -57,7 +57,7 @@ from links import *
       <td nowrap="true">
        <div class='oneline'>
          <a class='left' href="${link('pcuview', loginbase=site.loginbase)}">${site.loginbase}</a>
-         <a class='right' href="${plc_site_uri(site.loginbase)}">
+         <a class='right' href="${plc_site_uri_id(site.plc_siteid)}">
            <img style='display: inline' border='0' src="static/images/extlink.gif" align='right'/></a>
        </div>
       </td>
index ea9a762..bf24fe5 100644 (file)
@@ -24,7 +24,7 @@ from links import *
                        </thead>
                        <tbody>
                                <tr py:for="i,site in enumerate(sitequery)">
-                                       <td nowrap="true"><a class="ext-link" href="${plc_site_uri(site.loginbase)}">
+                                       <td nowrap="true"><a class="ext-link" href="${plc_site_uri_id(site.plc_siteid)}">
                                                        <span class="icon">${site.loginbase}</span></a>
                                        </td>
                                        <td py:content="site.enabled"></td>