added actionlist_template to display action list consistently on different pages
[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         ${actionlist_widget.display(since=since, actions=actions)}
109         <!-- TODO: figure out how to make this conditional by model rather than port;
110                                 it is convenient to have links to ilo, drac, amt, etc.
111                                 regardless of whether the last PCU scan was successful.  -->
112         <!--h4 py:if="len(pcuquery) != 0">Convenience Calls</h4>
113                 <div py:if="len(pcuquery) != 0" class="code"> 
114                         <span   py:for="port,state in pcu.ports">
115                                         <span class="code" py:if="port == 22 and state == 'open'">
116                                                 ssh -o PasswordAuthentication=yes -o PubkeyAuthentication=no 
117                                                 ${pcu.plc_pcu_stats['username']}@${pcu_name(pcu.plc_pcu_stats)}
118                                                 <br/>
119                                         </span>
120                                         <span class="code" py:if="port == 23 and state == 'open'">
121                                                 telnet ${pcu_name(pcu.plc_pcu_stats)}
122                                                 <br/>
123                                         </span>
124                                         <span class="code" py:if="port == 80 and state == 'open'">
125                                                 <a href="http://${pcu_name(pcu.plc_pcu_stats)}">http://${pcu_name(pcu.plc_pcu_stats)}</a>
126                                                 <br/>
127                                         </span>
128                                         <span class="code" py:if="port == 443 and state == 'open'">
129                                                 <br/>
130                                                 <a href="https://${pcu_name(pcu.plc_pcu_stats)}">https://${pcu_name(pcu.plc_pcu_stats)}</a>
131                                                 <br/>
132                                                 curl -s -form 'user=${pcu.plc_pcu_stats['username']}' 
133                                                                 -form 'password=${pcu.plc_pcu_stats['password']}' 
134                                                                 -insecure https://${pcu_name(pcu.plc_pcu_stats)}/cgi-bin/webcgi/index
135                                                 <br/>
136                                                 /usr/share/monitor/pcucontrol/models/racadm.py -r ${pcu.plc_pcu_stats['ip']} 
137                                                         -u ${pcu.plc_pcu_stats['username']} -p '${pcu.plc_pcu_stats['password']}'
138                                                 <br/>
139                                                 /usr/share/monitor/pcucontrol/models/hpilo/locfg.pl 
140                                                         -f /usr/share/monitor/pcucontrol/models/hpilo/iloxml/Reset_Server.xml 
141                                                         -s ${pcu_name(pcu.plc_pcu_stats)}
142                                                         -u ${pcu.plc_pcu_stats['username']} 
143                                                         -p '${pcu.plc_pcu_stats['password']} ' | grep MESSAGE" 
144                                         </span>
145                                         <span class="code" py:if="port == 16992 and state == 'open'">
146                                                 /usr/share/monitor/pcucontrol/models/intelamt/remoteControl -A 
147                                                         -verbose 'http://${pcu_name(pcu.plc_pcu_stats)}:16992/RemoteControlService' 
148                                                         -user admin -pass '${pcu.plc_pcu_stats['password']}'
149                                         </span>
150                         </span>
151                 </div-->
152
153      </div>
154   </div>
155
156 </html>