50775012962255bc6b9b2c4e5e7e2953fdaa5b8c
[monitor.git] / web / MonitorWeb / monitorweb / templates / simpleview.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'] = "MyOps Detail 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   <div py:if="len(sitequery) == 0">
16         <p>Your 'quick jump' query failed to find a matching site or hostname.</p>
17         <p>MyOps recognizes three types of expressions:
18         <ul>
19             <li>Site names, e.g. princeton, utah, nyu, etc</li>
20             <li>Host names, e.g. planetlab-1.cs.princeton.edu, pl1.university.edu, etc</li>
21             <li>Prefix a pattern with "site:" or "node:" to return all sites or
22                 nodes that match a pattern.  e.g. site:mlab* node:*redclara*</li>
23         </ul>
24         </p>
25   </div>
26   <div py:if="len(sitequery) != 0">
27     <h3 py:if="len(sitequery) > 0">Site Status</h3>
28                 <table py:if="len(sitequery) > 0" id="sub-table" border="1" width="100%">
29                         <thead>
30                                 <tr>
31                                         <th>Status Since</th>
32                                         <th>Site Name</th>
33                                         <th>Enabled</th>
34                                         <th>Penalty</th>
35                                         <th>Slices/Max</th>
36                                 </tr>
37                         </thead>
38                         <tbody>
39                                 <tr py:for="i,site in enumerate(sitequery)" class="${i%2 and 'odd' or 'even'}" >
40                                         <td id="site-${site.status}" py:content="diff_time(mktime(site.last_changed.timetuple()))"></td>
41                                         <td id="site-${site.status}" nowrap="true"><a class="ext-link" href="${plc_site_uri_id(site.plc_siteid)}">
42                                                         <span class="icon">${site.loginbase}</span></a>
43                                         </td>
44                                         <td py:content="site.enabled"></td>
45                                         <td id="site-${site.penalty_level}">${site.penalty_level}</td>
46                                         <td>${site.slices_used}/${site.slices_total}</td>
47                                         <td nowrap="true" width="70em"><a href="${link('detailview', loginbase=site.loginbase)}">More Details</a></td>
48                                 </tr>
49                         </tbody>
50                 </table>
51     <h3 py:if="len(pcuquery) != 0" >PCU Status</h3>
52                 <table py:if="len(pcuquery) != 0" id="sortable_table" class="datagrid" border="1" width="100%">
53                         <thead>
54                                 <tr>
55                                         <th>Status Since</th>
56                                         <th>PCU Name</th>
57                                         <th>Model</th>
58                                         <th>Nodes</th>
59                                 </tr>
60                         </thead>
61                         <tbody>
62                                 <tr py:for="i,agg in enumerate(pcuquery)" class="${i%2 and 'odd' or 'even'}" >
63                                         <td id="site-${agg.pcuhist.status}" py:content="diff_time(mktime(agg.pcuhist.last_changed.timetuple()))"></td>
64                                         <td nowrap="true" id="status-${agg.status}">
65                                                 <a class="ext-link" href="${plc_pcu_uri_id(agg.pcu.plc_pcu_stats['pcu_id'])}">
66                                                         <span class="icon">${pcu_name(agg.pcu.plc_pcu_stats)}</span>
67                                                 </a>
68                                         </td>
69                                         <td py:content="agg.pcu.plc_pcu_stats['model']"></td>
70                                         <td py:content="len(agg.pcu.plc_pcu_stats['node_ids'])"></td>
71                                         <td nowrap="true" width="70em"><a href="${link('detailview', pcuid=agg.pcu.plc_pcuid)}">More Details</a></td>
72                                 </tr>
73                         </tbody>
74                 </table>
75         <div class="oneline" id="legend" py:if="len(pcuquery) == 0">
76                 <h3>PCUs: None</h3>
77         </div>
78         <h3>Nodes</h3> 
79                 <p py:if="len(nodequery) == 0">
80                         There are no registered nodes for this site.
81                 </p>
82                 <table py:if="len(nodequery) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
83                         <thead>
84                                 <tr>
85                                         <th>Status Since</th>
86                                         <th>Hostname</th>
87                                         <th>last_checked</th>
88                                 </tr>
89                         </thead>
90                         <tbody>
91                                 <tr py:for="i,agg in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
92                                         <td id="site-${agg.history.status}" py:content="diff_time(mktime(agg.history.last_changed.timetuple()))"></td>
93                                         <td id="node-${agg.node.observed_status}" nowrap="true" >
94                                                 <a class="ext-link" href="${plc_node_uri_id(agg.node.plc_node_stats['node_id'])}">
95                                                         <span class="icon">${agg.node.hostname}</span></a>
96                                         </td>
97                                         <td py:content="diff_time(mktime(agg.node.date_checked.timetuple()))"></td>
98                                         <td nowrap="true" width="70em"><a href="${link('detailview', hostname=agg.node.hostname)}">More Details</a></td>
99                                 </tr>
100                         </tbody>
101                 </table>
102                 <div class="error" py:if="exceptions is not None">
103                         ${exceptions}
104                 </div>
105                 <div id="status_block" class="flash"
106             py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
107
108         <h4>Actions Over the Last ${since} Days</h4>
109                 <p py:if="actions and len(actions) == 0">
110                         There are no recent actions taken for this site.
111                 </p>
112                 <table py:if="actions and len(actions) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
113                         <thead>
114                                 <tr>
115                                         <th mochi:format="int"></th>
116                                         <th>Date</th>
117                                         <th>Action taken on</th>
118                                         <th>Action Type</th>
119                                         <th>Message ID</th>
120                                         <th>Errors</th>
121                                 </tr>
122                         </thead>
123                         <tbody>
124                                 <tr py:for="i,act in enumerate(actions)" class="${i%2 and 'odd' or 'even'}" >
125                                         <td></td>
126                                         <td py:content="act.date_created"></td>
127                                         <td py:if="act.hostname is not None" nowrap="true" >
128                                                 <a class="ext-link" href="${plc_node_uri(act.hostname)}">
129                                                         <span class="icon">${act.hostname}</span></a>
130                                         </td>
131                                         <td py:if="act.hostname is None" nowrap="true">
132                                                 <a class="ext-link" href="${plc_site_uri(act.loginbase)}">
133                                                         <span class="icon">${act.loginbase}</span></a>
134                                         </td>
135                                         <!--td py : content="diff_time(mktime(node.date_checked.timetuple()))"></td-->
136                                         <td py:content="act.action_type"></td>
137                                         <td><a class="ext-link" href="${plc_mail_uri(act.message_id)}">
138                                                         <span py:if="act.message_id != 0" class="icon">${act.message_id}</span></a></td>
139                                         <td py:if="'bootmanager' in act.action_type or 'unknown' in act.action_type">
140                                                 <a href="/monitorlog/bm.${act.hostname}.log">latest bm log</a>
141                                         </td>
142                                         <td py:if="'bootmanager' not in act.action_type">
143                                                 <pre py:content="act.error_string"></pre></td>
144                                 </tr>
145                         </tbody>
146                 </table>
147
148         <!-- TODO: figure out how to make this conditional by model rather than port;
149                                 it is convenient to have links to ilo, drac, amt, etc.
150                                 regardless of whether the last PCU scan was successful.  -->
151         <!--h4 py:if="len(pcuquery) != 0">Convenience Calls</h4>
152                 <div py:if="len(pcuquery) != 0" class="code"> 
153                         <span   py:for="port,state in pcu.ports">
154                                         <span class="code" py:if="port == 22 and state == 'open'">
155                                                 ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no 
156                                                 ${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
157                                                 <br/>
158                                         </span>
159                                         <span class="code" py:if="port == 23 and state == 'open'">
160                                                 telnet ${pcu_name(pcu.plc_pcu_stats)}
161                                                 <br/>
162                                         </span>
163                                         <span class="code" py:if="port == 80 and state == 'open'">
164                                                 <a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
165                                                 <br/>
166                                         </span>
167                                         <span class="code" py:if="port == 443 and state == 'open'">
168                                                 <br/>
169                                                 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
170                                                 <br/>
171                                                 curl -s -form 'user=${pcu.plc_pcu_stats['username']}' 
172                                                                 -form 'password=${pcu.plc_pcu_stats['password']}' 
173                                                                 -insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
174                                                 <br/>
175                                                 /usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']} 
176                                                         -u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
177                                                 <br/>
178                                                 /usr/share/monitor/pcucontrol/models/hpilo/locfg.pl 
179                                                         -f /usr/share/monitor/pcucontrol/models/hpilo/iloxml/Reset_Server.xml 
180                                                         -s ${pcu_name(pcu.plc_pcu_stats)}
181                                                         -u ${pcu.plc_pcu_stats['username']} 
182                                                         -p '${pcu.plc_pcu_stats['password']} ' | grep MESSAGE" 
183                                         </span>
184                                         <span class="code" py:if="port == 16992 and state == 'open'">
185                                                 /usr/share/monitor/pcucontrol/models/intelamt/remoteControl -A 
186                                                         -verbose 'http://${pcu_name(pcu.plc_pcu_stats)}:16992/RemoteControlService' 
187                                                         -user admin -pass '${pcu.plc_pcu_stats['password']}'
188                                         </span>
189                         </span>
190                 </div-->
191
192      </div>
193   </div>
194
195 </html>