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