pull/30/head
Aidaho12 2018-08-07 00:08:52 +06:00
parent 4232833dd1
commit 4279b71e3a
3 changed files with 94 additions and 0 deletions

View File

@ -20,6 +20,14 @@ try:
users = sql.select_users()
groups = sql.select_groups()
token = sql.get_token(user_id.value)
cmd = "ps ax |grep checker_mas |grep -v grep |wc -l"
checker_master, stderr = funct.subprocess_execute(cmd)
cmd = "ps ax |grep checker_worker |grep -v grep |wc -l"
checker_worker, stderr = funct.subprocess_execute(cmd)
cmd = "ps ax |grep metrics_master |grep -v grep |wc -l"
metrics_master, stderr = funct.subprocess_execute(cmd)
cmd = "ps ax |grep metrics_worker |grep -v grep |wc -l"
metrics_worker, stderr = funct.subprocess_execute(cmd)
except:
pass
@ -30,5 +38,10 @@ template = template.render(h2 = 1,
user = user,
users = users,
groups = groups,
metrics_master = ''.join(metrics_master),
metrics_worker = ''.join(metrics_worker),
checker_master = ''.join(checker_master),
checker_worker = ''.join(checker_worker),
error = stderr,
token = token)
print(template)

View File

@ -0,0 +1,43 @@
<table>
<tr class="overviewHead">
<th colspan=13>Metrics</th>
</tr>
<tr>
<th class="padding10 first-collumn overviewTr" rowspan=2>Server</th>
<th colspan=3>Average sessions</th>
<th colspan=3>Peak sessions</th>
<th colspan=3>Average connections</th>
<th colspan=3>Peak connections</th>
</tr>
<tr class="overviewHead">
<th>60 minutes</th>
<th>24 hours</th>
<th>3 days</th>
<th>60 minutes</th>
<th>24 hours</th>
<th>3 days</th>
<th>60 minutes</th>
<th>24 hours</th>
<th>3 days</th>
<th>60 minutes</th>
<th>24 hours</th>
<th>3 days</th>
</tr>
{% for state in table_stat %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn"><span title="{{ state.0 }}">{{ state.1 }}</span></td>
<td>{{ state.2 }}</td>
<td>{{ state.3 }}</td>
<td>{{ state.4 }}</td>
<td>{{ state.5 }}</td>
<td>{{ state.6 }}</td>
<td>{{ state.7 }}</td>
<td>{{ state.8 }}</td>
<td>{{ state.9 }}</td>
<td>{{ state.10 }}</td>
<td>{{ state.11 }}</td>
<td>{{ state.12 }}</td>
<td>{{ state.13 }}</td>
</tr>
{% endfor %}
</table>

View File

@ -50,6 +50,44 @@
{% endif %}
{% endfor %}
</table>
<table class="overview">
<tr class="overviewHead">
<th class="padding10 first-collumn" colspan=4>
Tools status
</th>
</tr>
<tr>
<td class="padding10 first-collumn">
{% if metrics_master|int() >= 1 %}
<span title="running {{ metrics_master }} master processes"><span class="serverUp"> UP</span> Metrics master</span>
{% else %}
<span title="running {{ metrics_master }} master processes"><span class="serverDown"> DOWN</span> running {{metrics_master }} master processes
{% endif %}
</td>
<td>
{% if metrics_worker|int() >= 1 %}
<span title="running {{metrics_worker}} worker processes"><span class="serverUp"> UP</span> Metrics workers</span>
{% else %}
<span title="running {{metrics_worker}} worker processes"><span class="serverDown"> DOWN</span> Metrics workers</span>
{% endif %}
</td>
<td >
{% if checker_master|int() >= 1 %}
<span title="running {{ checker_master }} master processes"><span class="serverUp"> UP</span> Checker master</span>
{% else %}
<span title="running {{ checker_master }} master processes"><span class="serverDown"> DOWN</span> Checker master</span>
{% endif %}
</td>
<td>
{% if checker_worker|int() >= 1 %}
<span title="running {{ checker_worker }} worker processes"><span class="serverUp"> UP</span> Checker workers</span>
{% else %}
<span title="running {{ checker_worker }} worker processes"><span class="serverDown"> DOWN</span> Checker workers</span>
{% endif %}
</td>
</tr>
</table>
{% endif %}
<table class="overview">
<tr class="overviewHead">