remove unnecessary informatiton on pcuview page
[monitor.git] / web / MonitorWeb / monitorweb / templates / pcuview.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'] = "Monitor PCU 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>Site name</th>
21                                         <th>Enabled</th>
22                                         <th>Penalty</th>
23                                         <th>Slices/Max</th>
24                                         <th>Nodes/Total</th>
25                                         <th>Status</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 nowrap="true"><a class="ext-link" href="${plc_site_uri(site.loginbase)}">
32                                                         <span class="icon">${site.loginbase}</span></a>
33                                         </td>
34                                         <td py:content="site.enabled"></td>
35                                         <td id="site-${site.penalty_level}">${site.penalty_level}</td>
36                                         <td>${site.slices_used}/${site.slices_total}</td>
37                                         <td>${site.nodes_up} / ${site.nodes_total}</td>
38                                         <td id="site-${site.status}" py:content="diff_time(mktime(site.last_changed.timetuple()))"></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 mochi:format="int"></th>
47                                         <th>History</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,pcu in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
59                                         <td></td>
60                                         <td><a href="pcuhistory?pcu_id=${pcu.plc_pcuid}">history</a></td>
61                                         <td nowrap="true" >
62                                                 <a class="ext-link" href="${plc_pcu_uri_id(pcu.plc_pcu_stats['pcu_id'])}">
63                                                         <span class="icon">${pcu_name(pcu.plc_pcu_stats)}</span>
64                                                 </a>
65                                         </td>
66                                         <td py:content="pcu.entry_complete"></td>
67                                         <td id="dns-${pcu.dns_status}" py:content="pcu.dns_status"></td>
68                                         <td nowrap='true'>
69                                                 <span py:for="port,state in pcu.ports" 
70                                                 id="port${state}" py:content="'%s, ' % port">80</span>
71                                         </td>
72                                         <td width="40" id="status-${pcu.status}"><pre class="results" py:content="pcu.reboot_trial_status"></pre></td>
73                                         <td py:content="pcu.plc_pcu_stats['model']"></td>
74                                         <td py:content="len(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 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 mochi:format="int"></th>
146                                         <th>History</th>
147                                         <th>Hostname</th>
148                                         <th>last_contact</th>
149                                         <th>last_checked</th>
150                                         <th nowrap='true'>Port Status</th>
151                                         <th></th>
152                                         <th></th>
153                                         <th></th>
154                                 </tr>
155                         </thead>
156                         <tbody>
157                                 <tr py:for="i,node in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
158                                         <td></td>
159                                         <td><a href="nodehistory?hostname=${node.hostname}">history</a></td>
160                                         <td id="node-${node.observed_status}" nowrap="true" >
161                                                 <a class="ext-link" href="${plc_node_uri(node.hostname)}">
162                                                         <span class="icon">${node.hostname}</span></a>
163                                         </td>
164                                         <td py:content="diff_time(node.plc_node_stats['last_contact'])"></td>
165                                         <td py:content="diff_time(mktime(node.date_checked.timetuple()))"></td>
166                                         <td>
167                                                 <span py:for="port,state in node.ports" 
168                                                 id="port${state}" py:content="'%s, ' % port">80</span>
169                                         </td>
170                                         <td>
171                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
172                                                 <!--form action="${link('pcuview', hostname=node.hostname)}" name="externalscan${i}" method='post'>
173                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
174                                                 <input type='hidden' name='type' value='ExternalScan' /> 
175                                                 </form>
176                                                 <a onclick='document.externalscan${i}.submit();' href="javascript: void(1);">ExternalScan</a-->
177                                         </td>
178                                         <td>
179                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
180                                                 <!--form action="${link('pcuview', hostname=node.hostname)}" name="internalscan${i}" method='post'>
181                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
182                                                 <input type='hidden' name='type' value='InternalScan' /> 
183                                                 </form>
184                                                 <a onclick='javascript: document.internalscan${i}.submit();' href="javascript: void(1);">InternalScan</a-->
185                                         </td>
186                                         <td py:if="len(pcuquery) > 0">
187                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
188                                                 <!--form action="${link('pcuview', pcuid=pcu.plc_pcuid)}" name="reboot${i}" method='post'>
189                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
190                                                 <input type='hidden' name='type' value='Reboot' /> 
191                                                 </form>
192                                                 <a onclick='javascript: document.reboot${i}.submit();' href="javascript: void(1);">Reboot</a-->
193                                         </td>
194                                 </tr>
195                         </tbody>
196                 </table>
197                 <div class="error" py:if="exceptions is not None">
198                         ${exceptions}
199                 </div>
200                 <div id="status_block" class="flash"
201             py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
202
203         <h4>Actions Over the Last Week</h4>
204                 <p py:if="actions and len(actions) == 0">
205                         There are no recent actions taken for this site.
206                 </p>
207                 <table py:if="actions and len(actions) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
208                         <thead>
209                                 <tr>
210                                         <th mochi:format="int"></th>
211                                         <th>Date</th>
212                                         <th>Action taken on</th>
213                                         <th>Action Type</th>
214                                         <th>Message ID</th>
215                                         <th>Errors</th>
216                                 </tr>
217                         </thead>
218                         <tbody>
219                                 <tr py:for="i,act in enumerate(actions)" class="${i%2 and 'odd' or 'even'}" >
220                                         <td></td>
221                                         <td py:content="act.date_created"></td>
222                                         <td py:if="act.hostname is not None" nowrap="true" >
223                                                 <a class="ext-link" href="${plc_node_uri(act.hostname)}">
224                                                         <span class="icon">${act.hostname}</span></a>
225                                         </td>
226                                         <td py:if="act.hostname is None" nowrap="true">
227                                                 <a class="ext-link" href="${plc_site_uri(act.loginbase)}">
228                                                         <span class="icon">${act.loginbase}</span></a>
229                                         </td>
230                                         <!--td py : content="diff_time(mktime(node.date_checked.timetuple()))"></td-->
231                                         <td py:content="act.action_type"></td>
232                                         <td><a class="ext-link" href="${plc_mail_uri(act.message_id)}">
233                                                         <span py:if="act.message_id != 0" class="icon">${act.message_id}</span></a></td>
234                                         <td><pre py:content="act.error_string"></pre></td>
235                                 </tr>
236                         </tbody>
237                 </table>
238
239         <!-- TODO: figure out how to make this conditional by model rather than port;
240                                 it is convenient to have links to ilo, drac, amt, etc.
241                                 regardless of whether the last PCU scan was successful.  -->
242         <!--h4 py:if="len(pcuquery) != 0">Convenience Calls</h4>
243                 <div py:if="len(pcuquery) != 0" class="code"> 
244                         <span   py:for="port,state in pcu.ports">
245                                         <span class="code" py:if="port == 22 and state == 'open'">
246                                                 ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no 
247                                                 ${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
248                                                 <br/>
249                                         </span>
250                                         <span class="code" py:if="port == 23 and state == 'open'">
251                                                 telnet ${pcu_name(pcu.plc_pcu_stats)}
252                                                 <br/>
253                                         </span>
254                                         <span class="code" py:if="port == 80 and state == 'open'">
255                                                 <a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
256                                                 <br/>
257                                         </span>
258                                         <span class="code" py:if="port == 443 and state == 'open'">
259                                                 <br/>
260                                                 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
261                                                 <br/>
262                                                 curl -s -form 'user=${pcu.plc_pcu_stats['username']}' 
263                                                                 -form 'password=${pcu.plc_pcu_stats['password']}' 
264                                                                 -insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
265                                                 <br/>
266                                                 /usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']} 
267                                                         -u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
268                                                 <br/>
269                                                 /usr/share/monitor/pcucontrol/models/hpilo/locfg.pl 
270                                                         -f /usr/share/monitor/pcucontrol/models/hpilo/iloxml/Reset_Server.xml 
271                                                         -s ${pcu_name(pcu.plc_pcu_stats)}
272                                                         -u ${pcu.plc_pcu_stats['username']} 
273                                                         -p '${pcu.plc_pcu_stats['password']} ' | grep MESSAGE" 
274                                         </span>
275                                         <span class="code" py:if="port == 16992 and state == 'open'">
276                                                 /usr/share/monitor/pcucontrol/models/intelamt/remoteControl -A 
277                                                         -verbose 'http://${pcu_name(pcu.plc_pcu_stats)}:16992/RemoteControlService' 
278                                                         -user admin -pass '${pcu.plc_pcu_stats['password']}'
279                                         </span>
280                         </span>
281                 </div-->
282
283   </div>
284
285 </html>