modified *list templates with abreviated information
[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>Site name</th>
20                                         <th>Enabled</th>
21                                         <th>Penalty</th>
22                                         <th>Slices/Max</th>
23                                         <th>Nodes/Total</th>
24                                         <th>Status</th>
25                                 </tr>
26                         </thead>
27                         <tbody>
28                                 <tr py:for="i,site in enumerate(sitequery)" class="${i%2 and 'odd' or 'even'}" >
29                                         <td nowrap="true"><a class="ext-link" href="${plc_site_uri(site.loginbase)}">
30                                                         <span class="icon">${site.loginbase}</span></a>
31                                         </td>
32                                         <td py:content="site.enabled"></td>
33                                         <td>n/a</td>
34                                         <td>${site.slices_used}/${site.slices_total}</td>
35                                         <td>${site.nodes_up} / ${site.nodes_total}</td>
36                                         <td id="site-${site.status}" py:content="diff_time(mktime(site.last_changed.timetuple()))"></td>
37                                 </tr>
38                         </tbody>
39                 </table>
40     <h3 py:if="len(pcuquery) != 0" >PCU Status</h3>
41                 <table py:if="len(pcuquery) != 0" id="sortable_table" class="datagrid" border="1" width="100%">
42                         <thead>
43                                 <tr>
44                                         <th mochi:format="int"></th>
45                                         <th>PCU Name</th>
46                                         <th>Missing Fields</th>
47                                         <th>DNS Status</th>
48                                         <th nowrap='true'>Port Status</th>
49                                         <th width="80%">Test Results</th>
50                                         <th>Model</th>
51                                         <th>Nodes</th>
52                                 </tr>
53                         </thead>
54                         <tbody>
55                                 <tr py:for="i,pcu in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
56                                         <td></td>
57                                         <td nowrap="true" >
58                                                 <a class="ext-link" href="${plc_pcu_uri_id(pcu.plc_pcu_stats['pcu_id'])}">
59                                                         <span class="icon">${pcu_name(pcu.plc_pcu_stats)}</span>
60                                                 </a>
61                                         </td>
62                                         <td py:content="pcu.entry_complete"></td>
63                                         <td id="dns-${pcu.dns_status}" py:content="pcu.dns_status"></td>
64                                         <td nowrap='true'>
65                                                 <span py:for="port,state in pcu.ports" 
66                                                 id="port${state}" py:content="'%s, ' % port">80</span>
67                                         </td>
68                                         <td width="40" id="status-${pcu.status}"><pre class="results" py:content="pcu.reboot_trial_status"></pre></td>
69                                         <td py:content="pcu.plc_pcu_stats['model']"></td>
70                                         <td py:content="len(pcu.plc_pcu_stats['node_ids'])"></td>
71                                 </tr>
72                         </tbody>
73                 </table>
74         <div class="oneline" id="legend" py:if="len(pcuquery) == 0">
75                 <em>There no PCUs associated with this host.</em>
76         </div>
77         <div class="oneline" id="legend" py:if="len(pcuquery) > 0">
78                 <em>Legend: </em>
79                 <a class="info" href="#">DNS Status<span>
80                         <table border="1" align="center" width="100%">
81                                 <tr><th colspan="2">Legend for 'DNS Status'</th></tr>
82
83                                 <tr><td id="dns-DNS-OK">DNS-OK</td>
84                                         <td>This indicates that the DNS name and registered IP address match.</td>
85                                 </tr>
86                                 <tr><td id="dns-DNS-MISMATCH">DNS-MISMATCH</td>
87                                         <td>Sometimes, the registered IP and DNS IP address do not match.  
88                                                 In these cases it is not clear which is correct, 
89                                                 so an error is flagged.</td>
90                                 </tr>
91                                 <tr><td id="dns-DNS-NOENTRY">DNS-NOENTRY</td>
92                                         <td>While a hostname is provided in the registration, the hostname is not actually registered in DNS.</td>
93                                 </tr>
94                                 <tr><td id="dns-NOHOSTNAME">NOHOSTNAME</td>
95                                         <td>While we prefer that a hostname be registered, it is not
96                                         strictly required, since simply the IP address, if it is static, is enough to access the PCU.</td>
97                                 </tr>
98                         </table>
99                         </span> </a> &nbsp;
100                 <a class="info" href="#">Port Status<span>
101                 <table border="1" align="center" width="100%">
102                         <tr><th colspan="2">Legend for 'Port Status'</th></tr>
103
104                         <tr><td id="portopen">Open</td>
105                                 <td>Green port numbers are believed to be open.</td>
106                         </tr>
107                         <tr><td id="portfiltered">Filtered</td>
108                                 <td>Gold port numbers are believed to be filtered or simply offline.</td>
109                         </tr>
110                         <tr><td id="portclosed">Closed</td>
111                                 <td>Finally, red ports appear to be closed.</td>
112                         </tr>
113                 </table>
114                                 </span> </a> &nbsp;
115                 <a class="info" href="#">Test Results<span>
116                 <table border="1" align="center" width="100%">
117                         <tr><th colspan="2">Legend for 'Test Results'</th></tr>
118
119                         <tr><td id="status-0">OK</td>
120                                 <td>The PCU is accessible, and short of actually rebooting the node, everything appears to work.</td>
121                         </tr>
122                         <tr><td id="status-NetDown">NetDown</td>
123                                 <td>The PCU is inaccessible from the PlanetLab address block 128.112.139.0/25, or it is simply offline.</td>
124                         </tr>
125                         <tr><td id="status-Not_Run">Not_Run</td>
126                                 <td>Previous errors, such as DNS or an incomplete configuration prevented the actual test from begin performed.</td>
127                         </tr>
128                         <tr><td id="status-error">Other Errors</td>
129                                 <td>Other errors are reported by the test that are more specific to the block encountered by the script.</td>
130                         </tr>
131                 </table>
132                                 </span> </a>
133         </div>
134         <h3>Nodes</h3>
135                 <p py:if="len(nodequery) == 0">
136                         There are no registered nodes for this site.
137                 </p>
138                 <table py:if="len(nodequery) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
139                         <thead>
140                                 <tr>
141                                         <th mochi:format="int"></th>
142                                         <th>Hostname</th>
143                                         <th>last_contact</th>
144                                         <th>Last_checked</th>
145                                         <th nowrap='true'>Port Status</th>
146                                         <th></th>
147                                         <th></th>
148                                         <th></th>
149                                 </tr>
150                         </thead>
151                         <tbody>
152                                 <tr py:for="i,node in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
153                                         <td></td>
154                                         <td id="node-${node.observed_status}" nowrap="true" >
155                                                 <a class="ext-link" href="${plc_node_uri(node.hostname)}">
156                                                         <span class="icon">${node.hostname}</span></a>
157                                         </td>
158                                         <td py:content="diff_time(node.plc_node_stats['last_contact'])"></td>
159                                         <td py:content="diff_time(mktime(node.date_checked.timetuple()))"></td>
160                                         <td>
161                                                 <span py:for="port,state in node.ports" 
162                                                 id="port${state}" py:content="'%s, ' % port">80</span>
163                                         </td>
164                                         <td>
165                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
166                                                 <form action="${link('pcuview', hostname=node.hostname)}" name="externalscan${i}" method='post'>
167                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
168                                                 <input type='hidden' name='type' value='ExternalScan' /> 
169                                                 </form>
170                                                 <a onclick='document.externalscan${i}.submit();' href="javascript: void(1);">ExternalScan</a>
171                                         </td>
172                                         <td>
173                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
174                                                 <form action="${link('pcuview', hostname=node.hostname)}" name="internalscan${i}" method='post'>
175                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
176                                                 <input type='hidden' name='type' value='InternalScan' /> 
177                                                 </form>
178                                                 <a onclick='javascript: document.internalscan${i}.submit();' href="javascript: void(1);">InternalScan</a>
179                                         </td>
180                                         <td py:if="len(pcuquery) > 0">
181                                                 <!-- TODO: add some values/code to authenticate the operation.  -->
182                                                 <form action="${link('pcuview', pcuid=pcu.plc_pcuid)}" name="reboot${i}" method='post'>
183                                                 <input type='hidden' name='hostname' value='${node.hostname}'/> 
184                                                 <input type='hidden' name='type' value='Reboot' /> 
185                                                 </form>
186                                                 <a onclick='javascript: document.reboot${i}.submit();' href="javascript: void(1);">Reboot</a>
187                                         </td>
188                                 </tr>
189                         </tbody>
190                 </table>
191                 <div class="error" py:if="exceptions is not None">
192                         ${exceptions}
193                 </div>
194                 <div id="status_block" class="flash"
195             py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
196         <h4 py:if="len(pcuquery) > 0">Convenience Calls</h4>
197                 <?python 
198                         if len(pcuquery) == 0: pcu = None
199                 ?>
200                 <div py:if="pcu is not None" class="code">
201                         <span   py:for="port,state in pcu.ports">
202                                         <span class="code" py:if="port == 22 and state == 'open'">
203                                                 ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no 
204                                                 ${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
205                                         </span>
206                                         <span class="code" py:if="port == 23 and state == 'open'">
207                                                 telnet ${pcu_name(pcu.plc_pcu_stats)}
208                                         </span>
209                                         <span class="code" py:if="port == 80 and state == 'open'">
210                                                 <a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
211                                         </span>
212                                         <span class="code" py:if="port == 443 and state == 'open'">
213                                                 <br/>
214                                                 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
215                                                 <br/>
216                                                 curl -s --form 'user=${pcu.plc_pcu_stats['username']}' 
217                                                                 --form 'password=${pcu.plc_pcu_stats['password']}' 
218                                                                 --insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
219                                                 <br/>
220                                                 /usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']} 
221                                                         -u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
222                                                 <br/>
223                                                 /usr/share/monitor/pcucontrol/models/hpilo/locfg.pl 
224                                                         -f /usr/share/monitor/pcucontrol/models/hpilo/iloxml/Reset_Server.xml 
225                                                         -s ${pcu_name(pcu.plc_pcu_stats)}
226                                                         -u ${pcu.plc_pcu_stats['username']} 
227                                                         -p '${pcu.plc_pcu_stats['password']} ' | grep MESSAGE" 
228                                         </span>
229                                         <span class="code" py:if="port == 16992 and state == 'open'">
230                                                 /usr/share/monitor/pcucontrol/models/intelamt/remoteControl -A 
231                                                         -verbose 'http://${pcu_name(pcu.plc_pcu_stats)}:16992/RemoteControlService' 
232                                                         -user admin -pass '${pcu.plc_pcu_stats['password']}'
233                                         </span>
234                         </span>
235                 </div>
236
237   </div>
238
239 </html>