Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{% if "SECTION_UPTIME_SUMMARY" in options %}
<h3>➡️ Uptime Monitor Summary</h3>
{% if uptimedata is defined and uptimedata[site.id] is defined %}
<table class="table table-condensed table-bordered table-sm">
<thead>
<tr>
<th></th>
<th>1 Day</th>
<th>1 Week</th>
<th>1 Month</th>
<th>1 Year</th>
</tr>
</thead>
<tbody>
<tr>
<td>Uptime Ratio</td>
<td>{{ uptimedata[site.id].custom_uptime_ratio[0]~'%' }}</td>
<td>{{ uptimedata[site.id].custom_uptime_ratio[1]~'%' }}</td>
<td>{{ uptimedata[site.id].custom_uptime_ratio[2]~'%' }}</td>
<td>{{ uptimedata[site.id].custom_uptime_ratio[3]~'%' }}</td>
</tr>
<tr>
<td>Down Duration</td>
<td>{{ uptimedata[site.id].custom_down_durations[0] }}</td>
<td>{{ uptimedata[site.id].custom_down_durations[1] }}</td>
<td>{{ uptimedata[site.id].custom_down_durations[2] }}</td>
<td>{{ uptimedata[site.id].custom_down_durations[3] }}</td>
</tr>
</tbody>
</table>
{% else %}
<div class="alert alert-warning">Could not find any Uptime data for this site - are you sure there
is a
monitor enabled?
</div>
{% endif %}
{% endif %}
{% if "SECTION_UPTIME_LOG" in options %}
<h3>➡️ Uptime Log For Period</h3>
{% if uptimedata is defined and uptimedata[site.id] is defined and uptimedata[site.id].logs is defined and uptimedata[site.id].logs|length %}
<table class="table table-condensed table-bordered table-sm">
<thead>
<tr>
<th>Type</th>
<th>Date</th>
<th>Duration</th>
<th>Reason</th>
</tr>
</thead>
<tbody>
{% for l in uptimedata[site.id].logs %}
<tr>
<td>{{ uptimelogstatusconvert[l.type] }}</td>
<td>{{ l.datetime|date('Y-m-d H:i:s') }}</td>
<td>{{ l.durationString }}</td>
<td>{{ l.reason.detail }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="alert alert-success">No data for period</div>
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment