- no alternate colors for tables
[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>PCU Name</th>
48                                         <th>Missing Fields</th>
49                                         <th>DNS Status</th>
50                                         <th nowrap='true'>Port Status</th>
51                                         <th width="80%">Test Results</th>
52                                         <th>Model</th>
53                                         <th>Nodes</th>
54                                 </tr>
55                         </thead>
56                         <tbody>
57                                 <tr py:for="i,pcu in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
58                                         <td></td>
59                                         <td nowrap="true" >
60                                                 <a class="ext-link" href="${plc_pcu_uri_id(pcu.plc_pcu_stats['pcu_id'])}">
61                                                         <span class="icon">${pcu_name(pcu.plc_pcu_stats)}</span>
62                                                 </a>
63                                         </td>
64                                         <td py:content="pcu.entry_complete"></td>
65                                         <td id="dns-${pcu.dns_status}" py:content="pcu.dns_status"></td>
66                                         <td nowrap='true'>
67                                                 <span py:for="port,state in pcu.ports" 
68                                                 id="port${state}" py:content="'%s, ' % port">80</span>
69                                         </td>
70                                         <td width="40" id="status-${pcu.status}"><pre class="results" py:content="pcu.reboot_trial_status"></pre></td>
71                                         <td py:content="pcu.plc_pcu_stats['model']"></td>
72                                         <td py:content="len(pcu.plc_pcu_stats['node_ids'])"></td>
73                                 </tr>
74                         </tbody>
75                 </table>
76         <div class="oneline" id="legend" py:if="len(pcuquery) == 0">
77                 <em>There no PCUs associated with this host.</em>
78         </div>
79         <div class="oneline" id="legend" py:if="len(pcuquery) > 0">
80                 <em>Legend: </em>
81                 <a class="info" href="#">DNS Status<span>
82                         <table border="1" align="center" width="100%">
83                                 <tr><th colspan="2">Legend for 'DNS Status'</th></tr>
84
85                                 <tr><td id="dns-DNS-OK">DNS-OK</td>
86                                         <td>This indicates that the DNS name and registered IP address match.</td>
87                                 </tr>
88                                 <tr><td id="dns-DNS-MISMATCH">DNS-MISMATCH</td>
89                                         <td>Sometimes, the registered IP and DNS IP address do not match.  
90                                                 In these cases it is not clear which is correct, 
91                                                 so an error is flagged.</td>
92                                 </tr>
93                                 <tr><td id="dns-DNS-NOENTRY">DNS-NOENTRY</td>
94                                         <td>While a hostname is provided in the registration, the hostname is not actually registered in DNS.</td>
95                                 </tr>
96                                 <tr><td id="dns-NOHOSTNAME">NOHOSTNAME</td>
97                                         <td>While we prefer that a hostname be registered, it is not
98                                         strictly required, since simply the IP address, if it is static, is enough to access the PCU.</td>
99                                 </tr>
100                         </table>
101                         </span> </a> &nbsp;
102                 <a class="info" href="#">Port Status<span>
103                 <table border="1" align="center" width="100%">
104                         <tr><th colspan="2">Legend for 'Port Status'</th></tr>
105
106                         <tr><td id="portopen">Open</td>
107                                 <td>Green port numbers are believed to be open.</td>
108                         </tr>
109                         <tr><td id="portfiltered">Filtered</td>
110                                 <td>Gold port numbers are believed to be filtered or simply offline.</td>
111                         </tr>
112                         <tr><td id="portclosed">Closed</td>
113                                 <td>Finally, red ports appear to be closed.</td>
114                         </tr>
115                 </table>
116                                 </span> </a> &nbsp;
117                 <a class="info" href="#">Test Results<span>
118                 <table border="1" align="center" width="100%">
119                         <tr><th colspan="2">Legend for 'Test Results'</th></tr>
120
121                         <tr><td id="status-0">OK</td>
122                                 <td>The PCU is accessible, and short of actually rebooting the node, everything appears to work.</td>
123                         </tr>
124                         <tr><td id="status-NetDown">NetDown</td>
125                                 <td>The PCU is inaccessible from the PlanetLab address block 128.112.139.0/25, or it is simply offline.</td>
126                         </tr>
127                         <tr><td id="status-Not_Run">Not_Run</td>
128                                 <td>Previous errors, such as DNS or an incomplete configuration prevented the actual test from begin performed.</td>
129                         </tr>
130                         <tr><td id="status-error">Other Errors</td>
131                                 <td>Other errors are reported by the test that are more specific to the block encountered by the script.</td>
132                         </tr>
133                 </table>
134                                 </span> </a>
135         </div>
136         <h3>Nodes</h3> 
137                 <p py:if="len(nodequery) == 0">
138                         There are no registered nodes for this site.
139                 </p>
140                 <table py:if="len(nodequery) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
141                         <thead>
142                                 <tr>
143                                         <th mochi:format="int"></th>
144                                         <th>History</th>
145                                         <th>Hostname</th>
146                                         <th>last_contact</th>
147                                         <th>last_checked</th>
148                                         <th nowrap='true'>Port Status</th>
149                                         <th></th>
150                                         <th></th>
151                                         <th></th>
152                                 </tr>
153                         </thead>
154                         <tbody>
155                                 <tr py:for="i,node in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
156                                         <td></td>
157                                         <td><a href="nodehistory?hostname=${node.hostname}">history</a></td>
158                                         <td id="node-${node.observed_status}" nowrap="true" >
159                                                 <a class="ext-link" href="${plc_node_uri(node.hostname)}">
160                                                         <span class="icon">${node.hostname}</span></a>
161                                         </td>
162                                         <td py:content="diff_time(node.plc_node_stats['last_contact'])"></td>
163                                         <td py:content="diff_time(mktime(node.date_checked.timetuple()))"></td>
164                                         <td>
165                                                 <span py:for="port,state in node.ports" 
166                                                 id="port${state}" py:content="'%s, ' % port">80</span>
167                                         </td>
168                                         <td>
169                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
170                                                 <form action="${link('pcuview', hostname=node.hostname)}" name="externalscan${i}" method='post'>
171                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
172                                                 <input type='hidden' name='type' value='ExternalScan' /> 
173                                                 </form>
174                                                 <a onclick='document.externalscan${i}.submit();' href="javascript: void(1);">ExternalScan</a>
175                                         </td>
176                                         <td>
177                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
178                                                 <form action="${link('pcuview', hostname=node.hostname)}" name="internalscan${i}" method='post'>
179                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
180                                                 <input type='hidden' name='type' value='InternalScan' /> 
181                                                 </form>
182                                                 <a onclick='javascript: document.internalscan${i}.submit();' href="javascript: void(1);">InternalScan</a>
183                                         </td>
184                                         <td py:if="len(pcuquery) > 0">
185                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
186                                                 <form action="${link('pcuview', pcuid=pcu.plc_pcuid)}" name="reboot${i}" method='post'>
187                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
188                                                 <input type='hidden' name='type' value='Reboot' /> 
189                                                 </form>
190                                                 <a onclick='javascript: document.reboot${i}.submit();' href="javascript: void(1);">Reboot</a>
191                                         </td>
192                                 </tr>
193                         </tbody>
194                 </table>
195                 <div class="error" py:if="exceptions is not None">
196                         ${exceptions}
197                 </div>
198                 <div id="status_block" class="flash"
199             py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
200
201         <h4>Actions Over the Last Week</h4>
202                 <p py:if="actions and len(actions) == 0">
203                         There are no recent actions taken for this site.
204                 </p>
205                 <table py:if="actions and len(actions) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
206                         <thead>
207                                 <tr>
208                                         <th mochi:format="int"></th>
209                                         <th>Date</th>
210                                         <th>Action taken on</th>
211                                         <th>Action Type</th>
212                                         <th>Message ID</th>
213                                         <th>Errors</th>
214                                 </tr>
215                         </thead>
216                         <tbody>
217                                 <tr py:for="i,act in enumerate(actions)" class="${i%2 and 'odd' or 'even'}" >
218                                         <td></td>
219                                         <td py:content="act.date_created"></td>
220                                         <td py:if="act.hostname is not None" nowrap="true" >
221                                                 <a class="ext-link" href="${plc_node_uri(act.hostname)}">
222                                                         <span class="icon">${act.hostname}</span></a>
223                                         </td>
224                                         <td py:if="act.hostname is None" nowrap="true">
225                                                 <a class="ext-link" href="${plc_site_uri(act.loginbase)}">
226                                                         <span class="icon">${act.loginbase}</span></a>
227                                         </td>
228                                         <!--td py : content="diff_time(mktime(node.date_checked.timetuple()))"></td-->
229                                         <td py:content="act.action_type"></td>
230                                         <td><a class="ext-link" href="${plc_mail_uri(act.message_id)}">
231                                                         <span py:if="act.message_id != 0" class="icon">${act.message_id}</span></a></td>
232                                         <td><pre py:content="act.error_string"></pre></td>
233                                 </tr>
234                         </tbody>
235                 </table>
236
237         <!-- TODO: figure out how to make this conditional by model rather than port;
238                                 it is convenient to have links to ilo, drac, amt, etc.
239                                 regardless of whether the last PCU scan was successful.  -->
240         <h4 py:if="len(pcuquery) != 0">Convenience Calls</h4>
241                 <div py:if="len(pcuquery) != 0" class="code"> <!-- pcu is not None" class="code"-->
242                         <span   py:for="port,state in pcu.ports">
243                                         <span class="code" py:if="port == 22 and state == 'open'">
244                                                 ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no 
245                                                 ${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
246                                                 <br/>
247                                         </span>
248                                         <span class="code" py:if="port == 23 and state == 'open'">
249                                                 telnet ${pcu_name(pcu.plc_pcu_stats)}
250                                                 <br/>
251                                         </span>
252                                         <span class="code" py:if="port == 80 and state == 'open'">
253                                                 <a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
254                                                 <br/>
255                                         </span>
256                                         <span class="code" py:if="port == 443 and state == 'open'">
257                                                 <br/>
258                                                 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
259                                                 <br/>
260                                                 curl -s --form 'user=${pcu.plc_pcu_stats['username']}' 
261                                                                 --form 'password=${pcu.plc_pcu_stats['password']}' 
262                                                                 --insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
263                                                 <br/>
264                                                 /usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']} 
265                                                         -u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
266                                                 <br/>
267                                                 /usr/share/monitor/pcucontrol/models/hpilo/locfg.pl 
268                                                         -f /usr/share/monitor/pcucontrol/models/hpilo/iloxml/Reset_Server.xml 
269                                                         -s ${pcu_name(pcu.plc_pcu_stats)}
270                                                         -u ${pcu.plc_pcu_stats['username']} 
271                                                         -p '${pcu.plc_pcu_stats['password']} ' | grep MESSAGE" 
272                                         </span>
273                                         <span class="code" py:if="port == 16992 and state == 'open'">
274                                                 /usr/share/monitor/pcucontrol/models/intelamt/remoteControl -A 
275                                                         -verbose 'http://${pcu_name(pcu.plc_pcu_stats)}:16992/RemoteControlService' 
276                                                         -user admin -pass '${pcu.plc_pcu_stats['password']}'
277                                         </span>
278                         </span>
279                 </div>
280
281   </div>
282
283 </html>