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