1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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
10 <html py:layout="'sitemenu.kid'"
11 xmlns:py="http://purl.org/kid/ns#"
12 xmlns:mochi="http://www.mochi.org">
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%">
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>
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>
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%">
46 <th mochi:format="int"></th>
48 <th>Missing Fields</th>
50 <th nowrap='true'>Port Status</th>
51 <th width="80%">Test Results</th>
57 <tr py:for="i,pcu in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
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>
64 <td py:content="pcu.entry_complete"></td>
65 <td id="dns-${pcu.dns_status}" py:content="pcu.dns_status"></td>
67 <span py:for="port,state in pcu.ports"
68 id="port${state}" py:content="'%s, ' % port">80</span>
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>
76 <div class="oneline" id="legend" py:if="len(pcuquery) == 0">
77 <em>There no PCUs associated with this host.</em>
79 <div class="oneline" id="legend" py:if="len(pcuquery) > 0">
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>
85 <tr><td id="dns-DNS-OK">DNS-OK</td>
86 <td>This indicates that the DNS name and registered IP address match.</td>
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>
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>
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>
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>
106 <tr><td id="portopen">Open</td>
107 <td>Green port numbers are believed to be open.</td>
109 <tr><td id="portfiltered">Filtered</td>
110 <td>Gold port numbers are believed to be filtered or simply offline.</td>
112 <tr><td id="portclosed">Closed</td>
113 <td>Finally, red ports appear to be closed.</td>
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>
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>
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>
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>
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>
137 <p py:if="len(nodequery) == 0">
138 There are no registered nodes for this site.
140 <table py:if="len(nodequery) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
143 <th mochi:format="int"></th>
146 <th>last_contact</th>
147 <th>last_checked</th>
148 <th nowrap='true'>Port Status</th>
155 <tr py:for="i,node in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
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>
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>
165 <span py:for="port,state in node.ports"
166 id="port${state}" py:content="'%s, ' % port">80</span>
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' />
174 <a onclick='document.externalscan${i}.submit();' href="javascript: void(1);">ExternalScan</a>
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' />
182 <a onclick='javascript: document.internalscan${i}.submit();' href="javascript: void(1);">InternalScan</a>
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' />
190 <a onclick='javascript: document.reboot${i}.submit();' href="javascript: void(1);">Reboot</a>
195 <div class="error" py:if="exceptions is not None">
198 <div id="status_block" class="flash"
199 py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
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.
205 <table py:if="actions and len(actions) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
208 <th mochi:format="int"></th>
210 <th>Action taken on</th>
217 <tr py:for="i,act in enumerate(actions)" class="${i%2 and 'odd' or 'even'}" >
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>
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>
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>
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)}
248 <span class="code" py:if="port == 23 and state == 'open'">
249 telnet ${pcu_name(pcu.plc_pcu_stats)}
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>
256 <span class="code" py:if="port == 443 and state == 'open'">
258 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
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
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']}'
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"
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']}'