and tg server start up.
template improvements otherwise.
fi
}
+function create_httpd_conf ()
+{
+ MONITOR_HTTP_CONF=/etc/httpd/conf.d/monitorweb.conf
+
+ if [ ! -f ${MONITOR_HTTP_CONF} ] ; then
+ # note: we need to either start this script before httpd, or always
+ # restart httpd, since there's no way to know beyond file's existence
+ # whether the values have changed or not.
+ WROTE_HTTP_CONFIG="true"
+ fi
+
+ # TODO: make http port configurable.
+ # TODO: make proxy port configurable.
+
+ cat <<EOF > ${MONITOR_HTTP_CONF}
+NameVirtualHost ${PLC_MONITOR_IP}:80
+
+<VirtualHost ${PLC_MONITOR_IP}:80>
+ ServerName ${PLC_MONITOR_HOST}
+ ServerAdmin ${PLC_MONITOR_EMAIL}
+ UseCanonicalName Off
+ ServerSignature Off
+
+ DocumentRoot ${MONITORPATH}/web/MonitorWeb/monitorweb
+
+ <Directory "${MONITORPATH}/web/MonitorWeb/monitorweb">
+ Options Indexes FollowSymLinks
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ #LogLevel debug
+ Errorlog /var/log/httpd/monitorwebapp-error_log
+ Customlog /var/log/httpd/monitorwebapp-access_log common
+
+ AddDefaultCharset utf-8
+
+ #NOTE: This doesn't work as expected.
+ # Load everything out of the DocumentRoot that is static
+ # ProxyPass /monitor/static !
+
+ ProxyPass /tg_js http://127.0.0.1:8080/tg_js
+ ProxyPassReverse /tg_js http://127.0.0.1:8080/tg_js
+
+ ProxyPass /monitor http://127.0.0.1:8080
+ ProxyPassReverse /monitor http://127.0.0.1:8080
+
+ ProxyPreserveHost On
+ ProxyRequests Off
+
+</VirtualHost>
+EOF
+}
+
+function start_tg_server ()
+{
+ pushd ${MONITORPATH}/web/MonitorWeb/
+ ./start-monitorweb.py ${MONITORPATH}/web/MonitorWeb/prod.cfg &> /var/log/monitorweb.log
+ popd
+}
+
function check_zab_server ()
{
ZABBIXCFG=/etc/zabbix
if [ -n "$WROTE_PG_CONFIG" ] ; then
# NOTE: restart db to enable access by users granted above.
service plc restart postgresql
+ service plc restart httpd
fi
check_zabbix_schema_and_data
# WRITE default /etc/monitor.conf
check_monitor_conf
+ # create /etc/httpd/conf.d/monitorweb.conf
+ create_httpd_conf
+ if [ -n "$WROTE_HTTP_CONFIG" ] ; then
+ # NOTE: restart web server to enable access web cfg
+ service plc restart httpd
+ fi
+ start_tg_server
+
# START zabbix services. SETUP default config files.
check_zab_server
check_zab_agentd
# TODO: send email message to monitor admin requesting manual
# intervention. This should always be an option for ridiculous,
# custom jobs.
+ pass
return 0
### rebooting european BlackBox PSE boxes
query = []
filtercount = {'DOWN' : 0, 'BOOT': 0, 'DEBUG' : 0, 'neverboot' : 0, 'pending' : 0, 'all' : 0}
for node in fbquery:
+ # NOTE: reformat some fields.
if node.plc_pcuid:
pcu = FindbadPCURecord.get_latest_by(plc_pcuid=node.plc_pcuid).first()
if pcu:
else:
node.kernel = ""
+ try:
+ node.loginbase = site_id2lb[node.plc_node_stats['site_id']]
+ except:
+ node.loginbase = "unknown"
+
# NOTE: count filters
if node.observed_status != 'DOWN':
from time import mktime
?>
<html py:layout="'sitemenu.kid'"
- xmlns:py="http://purl.org/kid/ns#">
+ xmlns:py="http://purl.org/kid/ns#"
+ xmlns:mochi="http://www.mochi.org">
<div py:match="item.tag == 'content'">
<table width="100%">
<tbody>
<tr>
<td colspan="5">
- <table id="sub-table" border="1" width="100%">
+ <table id="sortable_table" class="datagrid" border="1" width="100%">
<thead>
<tr>
+ <th mochi:format="int"></th>
+ <th mochi:format="str">Site</th>
<th>Hostname</th>
<th>ping</th>
<!--th>ssh</th-->
</thead>
<tbody>
<tr py:for="i,node in enumerate(query)" class="${i%2 and 'odd' or 'even'}" >
+ <td></td>
+ <td><a href="">${node.loginbase}</a></td>
<td nowrap="true" py:content="node.hostname"></td>
<td py:content="node.ping_status"></td>
<!--td py:content="node.ssh_status"></td-->
server.socket_host="127.0.0.1"
server.socket_port=8080
-server.webpath="/monitor/"
base_url_filter.on = False
-base_url_filter.base_url = "http://127.0.0.1:8080/monitor"
base_url_filter.use_x_forwarded_host = True
+#server.webpath="/monitor/"
+#base_url_filter.base_url = "http://127.0.0.1:8080/monitor"
+
# Auto-Reload after code modification
# autoreload.on = True
UseCanonicalName Off
ServerSignature Off
- DocumentRoot /usr/share/monitor/tgweb/MonitorWeb/monitorweb
+ DocumentRoot /usr/share/monitor/web/MonitorWeb/monitorweb
- <Directory "/usr/share/monitor/tgweb/MonitorWeb/monitorweb">
+ <Directory "/usr/share/monitor/web/MonitorWeb/monitorweb">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
AddDefaultCharset utf-8
- # Load everything out of the DocumentRoot that is static
- ProxyPass /monitor/static !
+ #NOTE: This doesn't work as expected.
+ # Load everything out of the DocumentRoot that is static
+ # ProxyPass /monitor/static !
+
+ ProxyPass /tg_js http://127.0.0.1:8080/tg_js
+ ProxyPassReverse /tg_js http://127.0.0.1:8080/tg_js
+
+ ProxyPass /monitor http://127.0.0.1:8080
+ ProxyPassReverse /monitor http://127.0.0.1:8080
- ProxyPass /monitor http://127.0.0.1:8080/
- ProxyPassReverse /monitor http://127.0.0.1:8080/
- ProxyPass /monitor/ http://127.0.0.1:8080/
- ProxyPassReverse /monitor/ http://127.0.0.1:8080/
ProxyPreserveHost On
ProxyRequests Off