added actionlist_template to display action list consistently on different pages
[monitor.git] / web / MonitorWeb / monitorweb / templates / detailview.kid
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <?python
3 layout_params['page_title'] = "MyOps Detail View"
4 from monitor.util import diff_time
5 from monitor import config
6 from time import mktime
7 from pcucontrol.reboot import pcu_name, model_to_object
8 from links import *
9 ?>
10 <html py:layout="'sitemenu.kid'"
11       xmlns:py="http://purl.org/kid/ns#"
12           xmlns:mochi="http://www.mochi.org">
13
14   <div py:match="item.tag == 'content'">
15     <h3 py:if="len(sitequery) > 0">Site Status</h3>
16                 <table py:if="len(sitequery) > 0" id="sub-table" border="1" width="100%">
17                         <thead>
18                                 <tr>
19                                         <th>History</th>
20                                         <th>Status Since</th>
21                                         <th>Site Name</th>
22                                         <th>Enabled</th>
23                                         <th>Penalty</th>
24                                         <th>Slices/Max</th>
25                                         <th>Nodes/Total</th>
26                                 </tr>
27                         </thead>
28                         <tbody>
29                                 <tr py:for="i,site in enumerate(sitequery)" class="${i%2 and 'odd' or 'even'}" >
30                                         <td><a href="sitehistory?loginbase=${site.loginbase}">history</a></td>
31                                         <td id="site-${site.status}" py:content="diff_time(mktime(site.last_changed.timetuple()))"></td>
32                                         <td id="site-${site.status}" nowrap="true"><a class="ext-link" href="${plc_site_uri_id(site.plc_siteid)}">
33                                                         <span class="icon">${site.loginbase}</span></a>
34                                         </td>
35                                         <td py:content="site.enabled"></td>
36                                         <td id="site-${site.penalty_level}">${site.penalty_level}</td>
37                                         <td>${site.slices_used}/${site.slices_total}</td>
38                                         <td>${site.nodes_up} / ${site.nodes_total}</td>
39                                 </tr>
40                         </tbody>
41                 </table>
42     <h3 py:if="len(pcuquery) != 0" >PCU Status</h3>
43                 <table py:if="len(pcuquery) != 0" id="sortable_table" class="datagrid" border="1" width="100%">
44                         <thead>
45                                 <tr>
46                                         <th>History</th>
47                                         <th>Status Since</th>
48                                         <th>PCU Name</th>
49                                         <th>Missing Fields</th>
50                                         <th nowrap='true'>DNS Status</th>
51                                         <th nowrap='true'>Port Status</th>
52                                         <th width="80%">Test Results</th>
53                                         <th>Model</th>
54                                         <th>Nodes</th>
55                                 </tr>
56                         </thead>
57                         <tbody>
58                                 <tr py:for="i,agg in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
59                                         <td><a href="pcuhistory?pcu_id=${agg.pcu.plc_pcuid}">history</a></td>
60                                         <td nowrap="true" id="site-${agg.pcuhist.status}" py:content="diff_time(mktime(agg.pcuhist.last_changed.timetuple()))"></td>
61                                         <td nowrap="true" id="status-${agg.status}">
62                                                 <a class="ext-link" href="${plc_pcu_uri_id(agg.pcu.plc_pcu_stats['pcu_id'])}">
63                                                         <span class="icon">${pcu_name(agg.pcu.plc_pcu_stats)}</span>
64                                                 </a>
65                                         </td>
66                                         <td py:content="agg.pcu.entry_complete"></td>
67                                         <td nowrap='true' id="dns-${agg.pcu.dns_status}" py:content="agg.pcu.dns_status"></td>
68                                         <td nowrap='true'>
69                                                 <span py:for="port,state in agg.ports" 
70                                                 id="port${state}" py:content="'%s, ' % port">80</span>
71                                         </td>
72                                         <td width="40" id="status-${agg.status}"><pre class="results" py:content="agg.pcu.reboot_trial_status"></pre></td>
73                                         <td py:content="agg.pcu.plc_pcu_stats['model']"></td>
74                                         <td py:content="len(agg.pcu.plc_pcu_stats['node_ids'])"></td>
75                                 </tr>
76                         </tbody>
77                 </table>
78         <div class="oneline" id="legend" py:if="len(pcuquery) == 0">
79                 <em>There are no PCUs associated with this host.</em>
80         </div>
81         <div class="oneline" id="legend" py:if="len(pcuquery) > 0">
82                 <em>Legend: </em>
83                 <a class="info" href="#">DNS Status<span>
84                         <table border="1" align="center" width="100%">
85                                 <tr><th colspan="2">Legend for 'DNS Status'</th></tr>
86
87                                 <tr><td id="dns-DNS-OK">DNS-OK</td>
88                                         <td>This indicates that the DNS name and registered IP address match.</td>
89                                 </tr>
90                                 <tr><td id="dns-DNS-MISMATCH">DNS-MISMATCH</td>
91                                         <td>Sometimes, the registered IP and DNS IP address do not match.  
92                                                 In these cases it is not clear which is correct, 
93                                                 so an error is flagged.</td>
94                                 </tr>
95                                 <tr><td id="dns-DNS-NOENTRY">DNS-NOENTRY</td>
96                                         <td>While a hostname is provided in the registration, the hostname is not actually registered in DNS.</td>
97                                 </tr>
98                                 <tr><td id="dns-NOHOSTNAME">NOHOSTNAME</td>
99                                         <td>While we prefer that a hostname be registered, it is not
100                                         strictly required, since simply the IP address, if it is static, is enough to access the PCU.</td>
101                                 </tr>
102                         </table>
103                         </span> </a> &nbsp;
104                 <a class="info" href="#">Port Status<span>
105                 <table border="1" align="center" width="100%">
106                         <tr><th colspan="2">Legend for 'Port Status'</th></tr>
107
108                         <tr><td id="portopen">Open</td>
109                                 <td>Green port numbers are believed to be open.</td>
110                         </tr>
111                         <tr><td id="portfiltered">Filtered</td>
112                                 <td>Gold port numbers are believed to be filtered or simply offline.</td>
113                         </tr>
114                         <tr><td id="portclosed">Closed</td>
115                                 <td>Finally, red ports appear to be closed.</td>
116                         </tr>
117                 </table>
118                                 </span> </a> &nbsp;
119                 <a class="info" href="#">Test Results<span>
120                 <table border="1" align="center" width="100%">
121                         <tr><th colspan="2">Legend for 'Test Results'</th></tr>
122
123                         <tr><td id="status-0">OK</td>
124                                 <td>The PCU is accessible, and short of actually rebooting the node, everything appears to work.</td>
125                         </tr>
126                         <tr><td id="status-NetDown">NetDown</td>
127                                 <td>The PCU is inaccessible from the PlanetLab address block 128.112.139.0/25, or it is simply offline.</td>
128                         </tr>
129                         <tr><td id="status-Not_Run">Not_Run</td>
130                                 <td>Previous errors, such as DNS or an incomplete configuration prevented the actual test from begin performed.</td>
131                         </tr>
132                         <tr><td id="status-error">Other Errors</td>
133                                 <td>Other errors are reported by the test that are more specific to the block encountered by the script.</td>
134                         </tr>
135                 </table>
136                                 </span> </a>
137         </div>
138         <h3>Nodes</h3> 
139                 <p py:if="len(nodequery) == 0">
140                         There are no registered nodes for this site.
141                 </p>
142                 <table py:if="len(nodequery) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
143                         <thead>
144                                 <tr>
145                                         <th>History (scan)</th>
146                                         <th>Status Since</th>
147                                         <th>Hostname</th>
148                                         <th>Resolves?</th>
149                                         <th>SSH</th>
150                                         <th>last_contact (cached)</th>
151                                         <th>Last Checked</th>
152                                         <th nowrap='true'>Port Status</th>
153                                         <th>Blocked Ports?</th>
154                                 </tr>
155                         </thead>
156                         <tbody>
157                                 <span py:for="i,agg in enumerate(nodequery)">
158                                 <tr class="${i%2 and 'odd' or 'even'}" >
159                                         <td><a href="nodehistory?hostname=${agg.node.hostname}">status</a>
160                                                 (<a href="nodescanhistory?hostname=${agg.node.hostname}">scan</a>)</td>
161                                         <td id="site-${agg.history.status}" py:content="diff_time(mktime(agg.history.last_changed.timetuple()))"></td>
162                                         <td id="node-${agg.node.observed_status}" nowrap="true" >
163                                                 <a class="ext-link" href="${plc_node_uri_id(agg.node.plc_node_stats['node_id'])}">
164                                                         <span class="icon">${agg.node.hostname}</span></a>
165                                         </td>
166                                         <td py:content="agg.node.external_dns_status"></td>
167                                         <td py:content="agg.node.ssh_status"></td>
168                                         <td py:content="diff_time(agg.node.plc_node_stats['last_contact'])"></td>
169                                         <td py:content="diff_time(mktime(agg.node.date_checked.timetuple()))"></td>
170                                         <td>
171                                                 <span py:for="port,state in agg.ports" 
172                                                 id="port${state}" py:content="'%s, ' % port">80</span>
173                                         </td>
174                                         <td py:content="agg.node.firewall"></td>
175                                 </tr>
176                                 <tr>
177                                         <td></td>
178                                         <th>Kernel:</th>
179                                         <td colspan="3" py:content="agg.kernel"> </td>
180                                 </tr>
181                                 <tr>
182                                         <td></td>
183                                         <th>DNS Status:</th>
184                                         <td colspan="3"><pre py:content="agg.node.dns_status"> </pre></td>
185                                 </tr>
186                                 <tr>
187                                         <td></td>
188                                         <th>Traceroute:</th>
189                                         <td colspan="3"><pre py:content="agg.node.traceroute"> </pre></td>
190                                 </tr>
191                                 </span>
192                         </tbody>
193                 </table>
194                 <div class="error" py:if="exceptions is not None">
195                         ${exceptions}
196                 </div>
197                 <div id="status_block" class="flash"
198             py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
199
200         ${actionlist_widget.display(since=since, actions=actions)}
201
202         <!-- TODO: figure out how to make this conditional by model rather than port;
203                                 it is convenient to have links to ilo, drac, amt, etc.
204                                 regardless of whether the last PCU scan was successful.  -->
205         <!--h4 py:if="len(pcuquery) != 0">Convenience Calls</h4>
206                 <div py:if="len(pcuquery) != 0" class="code"> 
207                         <span   py:for="port,state in pcu.ports">
208                                         <span class="code" py:if="port == 22 and state == 'open'">
209                                                 ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no 
210                                                 ${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
211                                                 <br/>
212                                         </span>
213                                         <span class="code" py:if="port == 23 and state == 'open'">
214                                                 telnet ${pcu_name(pcu.plc_pcu_stats)}
215                                                 <br/>
216                                         </span>
217                                         <span class="code" py:if="port == 80 and state == 'open'">
218                                                 <a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
219                                                 <br/>
220                                         </span>
221                                         <span class="code" py:if="port == 443 and state == 'open'">
222                                                 <br/>
223                                                 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
224                                                 <br/>
225                                                 curl -s -form 'user=${pcu.plc_pcu_stats['username']}' 
226                                                                 -form 'password=${pcu.plc_pcu_stats['password']}' 
227                                                                 -insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
228                                                 <br/>
229                                                 /usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']} 
230                                                         -u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
231                                                 <br/>
232                                                 /usr/share/monitor/pcucontrol/models/hpilo/locfg.pl 
233                                                         -f /usr/share/monitor/pcucontrol/models/hpilo/iloxml/Reset_Server.xml 
234                                                         -s ${pcu_name(pcu.plc_pcu_stats)}
235                                                         -u ${pcu.plc_pcu_stats['username']} 
236                                                         -p '${pcu.plc_pcu_stats['password']} ' | grep MESSAGE" 
237                                         </span>
238                                         <span class="code" py:if="port == 16992 and state == 'open'">
239                                                 /usr/share/monitor/pcucontrol/models/intelamt/remoteControl -A 
240                                                         -verbose 'http://${pcu_name(pcu.plc_pcu_stats)}:16992/RemoteControlService' 
241                                                         -user admin -pass '${pcu.plc_pcu_stats['password']}'
242                                         </span>
243                         </span>
244                 </div-->
245
246   </div>
247
248 </html>