<!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'] = "Monitor PCU View"
+layout_params['page_title'] = "MyOps Detail View"
from monitor.util import diff_time
from monitor import config
from time import mktime
<table py:if="len(sitequery) > 0" id="sub-table" border="1" width="100%">
<thead>
<tr>
+ <th>History</th>
<th>Site name</th>
<th>Enabled</th>
<th>Penalty</th>
</thead>
<tbody>
<tr py:for="i,site in enumerate(sitequery)" class="${i%2 and 'odd' or 'even'}" >
- <td nowrap="true"><a class="ext-link" href="${plc_site_uri(site.loginbase)}">
+ <td><a href="sitehistory?loginbase=${site.loginbase}">history</a></td>
+ <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>
- <td>n/a</td>
+ <td id="site-${site.penalty_level}">${site.penalty_level}</td>
<td>${site.slices_used}/${site.slices_total}</td>
<td>${site.nodes_up} / ${site.nodes_total}</td>
<td id="site-${site.status}" py:content="diff_time(mktime(site.last_changed.timetuple()))"></td>
<thead>
<tr>
<th mochi:format="int"></th>
+ <th>History</th>
<th>PCU Name</th>
<th>Missing Fields</th>
- <th>DNS Status</th>
+ <th nowrap='true'>DNS Status</th>
<th nowrap='true'>Port Status</th>
<th width="80%">Test Results</th>
<th>Model</th>
</tr>
</thead>
<tbody>
- <tr py:for="i,pcu in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
+ <tr py:for="i,agg in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
<td></td>
+ <td><a href="pcuhistory?pcu_id=${agg.pcu.plc_pcuid}">history</a></td>
<td nowrap="true" >
- <a class="ext-link" href="${plc_pcu_uri_id(pcu.plc_pcu_stats['pcu_id'])}">
- <span class="icon">${pcu_name(pcu.plc_pcu_stats)}</span>
+ <a class="ext-link" href="${plc_pcu_uri_id(agg.pcu.plc_pcu_stats['pcu_id'])}">
+ <span class="icon">${pcu_name(agg.pcu.plc_pcu_stats)}</span>
</a>
</td>
- <td py:content="pcu.entry_complete"></td>
- <td id="dns-${pcu.dns_status}" py:content="pcu.dns_status"></td>
+ <td py:content="agg.pcu.entry_complete"></td>
+ <td nowrap='true' id="dns-${agg.pcu.dns_status}" py:content="agg.pcu.dns_status"></td>
<td nowrap='true'>
- <span py:for="port,state in pcu.ports"
+ <span py:for="port,state in agg.ports"
id="port${state}" py:content="'%s, ' % port">80</span>
</td>
- <td width="40" id="status-${pcu.status}"><pre class="results" py:content="pcu.reboot_trial_status"></pre></td>
- <td py:content="pcu.plc_pcu_stats['model']"></td>
- <td py:content="len(pcu.plc_pcu_stats['node_ids'])"></td>
+ <td width="40" id="status-${agg.status}"><pre class="results" py:content="agg.pcu.reboot_trial_status"></pre></td>
+ <td py:content="agg.pcu.plc_pcu_stats['model']"></td>
+ <td py:content="len(agg.pcu.plc_pcu_stats['node_ids'])"></td>
</tr>
</tbody>
</table>
</table>
</span> </a>
</div>
- <h3>Nodes</h3>
+ <h3>Nodes</h3>
<p py:if="len(nodequery) == 0">
There are no registered nodes for this site.
</p>
<thead>
<tr>
<th mochi:format="int"></th>
+ <th>History (scan)</th>
<th>Hostname</th>
- <th>last_contact</th>
- <th>Last_checked</th>
+ <th>last_contact (cached)</th>
+ <th>last_checked</th>
<th nowrap='true'>Port Status</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
- <tr py:for="i,node in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
+ <tr py:for="i,agg in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
<td></td>
- <td id="node-${node.observed_status}" nowrap="true" >
- <a class="ext-link" href="${plc_node_uri(node.hostname)}">
- <span class="icon">${node.hostname}</span></a>
+ <td><a href="nodehistory?hostname=${agg.node.hostname}">status</a>
+ (<a href="nodescanhistory?hostname=${agg.node.hostname}">scan</a>) history</td>
+ <td id="node-${agg.node.observed_status}" nowrap="true" >
+ <a class="ext-link" href="${plc_node_uri_id(agg.node.plc_node_stats['node_id'])}">
+ <span class="icon">${agg.node.hostname}</span></a>
</td>
- <td py:content="diff_time(node.plc_node_stats['last_contact'])"></td>
- <td py:content="diff_time(mktime(node.date_checked.timetuple()))"></td>
+ <td py:content="diff_time(agg.node.plc_node_stats['last_contact'])"></td>
+ <td py:content="diff_time(mktime(agg.node.date_checked.timetuple()))"></td>
<td>
- <span py:for="port,state in node.ports"
+ <span py:for="port,state in agg.ports"
id="port${state}" py:content="'%s, ' % port">80</span>
</td>
<td>
<!-- TODO: add some values/code to authenticate the operation. -->
- <form action="${link('pcuview', hostname=node.hostname)}" name="externalscan${i}" method='post'>
- <input type='hidden' name='hostname' value='${node.hostname}'/>
+ <!--form action="${link('pcuview', hostname=agg.node.hostname)}" name="externalscan${i}" method='post'>
+ <input type='hidden' name='hostname' value='${agg.node.hostname}'/>
<input type='hidden' name='type' value='ExternalScan' />
</form>
- <a onclick='document.externalscan${i}.submit();' href="javascript: void(1);">ExternalScan</a>
+ <a onclick='document.externalscan${i}.submit();' href="javascript: void(1);">ExternalScan</a-->
</td>
<td>
<!-- TODO: add some values/code to authenticate the operation. -->
- <form action="${link('pcuview', hostname=node.hostname)}" name="internalscan${i}" method='post'>
- <input type='hidden' name='hostname' value='${node.hostname}'/>
+ <!--form action="${link('pcuview', hostname=agg.node.hostname)}" name="internalscan${i}" method='post'>
+ <input type='hidden' name='hostname' value='${agg.node.hostname}'/>
<input type='hidden' name='type' value='InternalScan' />
</form>
- <a onclick='javascript: document.internalscan${i}.submit();' href="javascript: void(1);">InternalScan</a>
+ <a onclick='javascript: document.internalscan${i}.submit();' href="javascript: void(1);">InternalScan</a-->
</td>
<td py:if="len(pcuquery) > 0">
<!-- TODO: add some values/code to authenticate the operation. -->
- <form action="${link('pcuview', pcuid=pcu.plc_pcuid)}" name="reboot${i}" method='post'>
- <input type='hidden' name='hostname' value='${node.hostname}'/>
+ <!--form action="${link('pcuview', pcuid=pcu.plc_pcuid)}" name="reboot${i}" method='post'>
+ <input type='hidden' name='hostname' value='${agg.node.hostname}'/>
<input type='hidden' name='type' value='Reboot' />
</form>
- <a onclick='javascript: document.reboot${i}.submit();' href="javascript: void(1);">Reboot</a>
+ <a onclick='javascript: document.reboot${i}.submit();' href="javascript: void(1);">Reboot</a-->
</td>
</tr>
</tbody>
</div>
<div id="status_block" class="flash"
py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
- <h4 py:if="len(pcuquery) > 0">Convenience Calls</h4>
- <?python
- if len(pcuquery) == 0: pcu = None
- ?>
- <div py:if="pcu is not None" class="code">
+
+ <h4>Actions Over the Last ${since} Days</h4>
+ <p py:if="actions and len(actions) == 0">
+ There are no recent actions taken for this site.
+ </p>
+ <table py:if="actions and len(actions) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
+ <thead>
+ <tr>
+ <th mochi:format="int"></th>
+ <th>Date</th>
+ <th>Action taken on</th>
+ <th>Action Type</th>
+ <th>Message ID</th>
+ <th>Errors</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr py:for="i,act in enumerate(actions)" class="${i%2 and 'odd' or 'even'}" >
+ <td></td>
+ <td py:content="act.date_created"></td>
+ <td py:if="act.hostname is not None" nowrap="true" >
+ <a class="ext-link" href="${plc_node_uri(act.hostname)}">
+ <span class="icon">${act.hostname}</span></a>
+ </td>
+ <td py:if="act.hostname is None" nowrap="true">
+ <a class="ext-link" href="${plc_site_uri(act.loginbase)}">
+ <span class="icon">${act.loginbase}</span></a>
+ </td>
+ <!--td py : content="diff_time(mktime(node.date_checked.timetuple()))"></td-->
+ <td py:content="act.action_type"></td>
+ <td><a class="ext-link" href="${plc_mail_uri(act.message_id)}">
+ <span py:if="act.message_id != 0" class="icon">${act.message_id}</span></a></td>
+ <td py:if="'bootmanager' in act.action_type or 'unknown' in act.action_type">
+ <a href="/monitorlog/bm.${act.hostname}.log">latest bm log</a>
+ </td>
+ <td py:if="'bootmanager' not in act.action_type">
+ <pre py:content="act.error_string"></pre></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <!-- TODO: figure out how to make this conditional by model rather than port;
+ it is convenient to have links to ilo, drac, amt, etc.
+ regardless of whether the last PCU scan was successful. -->
+ <!--h4 py:if="len(pcuquery) != 0">Convenience Calls</h4>
+ <div py:if="len(pcuquery) != 0" class="code">
<span py:for="port,state in pcu.ports">
<span class="code" py:if="port == 22 and state == 'open'">
ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no
${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
+ <br/>
</span>
<span class="code" py:if="port == 23 and state == 'open'">
telnet ${pcu_name(pcu.plc_pcu_stats)}
+ <br/>
</span>
<span class="code" py:if="port == 80 and state == 'open'">
<a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
+ <br/>
</span>
<span class="code" py:if="port == 443 and state == 'open'">
<br/>
<a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
<br/>
- curl -s --form 'user=${pcu.plc_pcu_stats['username']}'
- --form 'password=${pcu.plc_pcu_stats['password']}'
- --insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
+ curl -s -form 'user=${pcu.plc_pcu_stats['username']}'
+ -form 'password=${pcu.plc_pcu_stats['password']}'
+ -insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
<br/>
/usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']}
-u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
-user admin -pass '${pcu.plc_pcu_stats['password']}'
</span>
</span>
- </div>
+ </div-->
</div>