add dsnetreport shortcode
This commit is contained in:
parent
f37dde571d
commit
47e58213a2
@ -136,7 +136,8 @@ consumed by a web service or DNS integration script, for instance.
|
|||||||
The report contains no sensitive information. At one site I use it together
|
The report contains no sensitive information. At one site I use it together
|
||||||
with [hugo](https://gohugo.io/)
|
with [hugo](https://gohugo.io/)
|
||||||
[shortcodes](https://gohugo.io/templates/shortcode-templates/) to generate a
|
[shortcodes](https://gohugo.io/templates/shortcode-templates/) to generate a
|
||||||
network overview page.
|
network overview page. The shortcode file is included in this repository under
|
||||||
|
`etc/`.
|
||||||
|
|
||||||
"PrivateKey": "uC+xz3v1mfjWBHepwiCgAmPebZcY+EdhaHAvqX2r7U8=",
|
"PrivateKey": "uC+xz3v1mfjWBHepwiCgAmPebZcY+EdhaHAvqX2r7U8=",
|
||||||
|
|
||||||
|
54
etc/dsnetreport.html
Normal file
54
etc/dsnetreport.html
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<!-- This hugo shortcode can be used to render a table from /var/lib/dsnetreport.json if it is copied to the data/ directory -->
|
||||||
|
{{ $report := $.Site.Data.dsnetreport }}
|
||||||
|
|
||||||
|
{{ with $report }}
|
||||||
|
<table class="wide">
|
||||||
|
<caption>
|
||||||
|
{{ $report.PeersOnline }} of {{ $report.PeersTotal }} devices connected
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Hostname</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>IP</th>
|
||||||
|
<th>Owner</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th title="Data send from peer to server">Up</th>
|
||||||
|
<th title="Data sent from server to peer">Down</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{ range $report.Peers }}
|
||||||
|
{{ if .Dormant }}
|
||||||
|
<tr class="dormant">
|
||||||
|
{{ else }}
|
||||||
|
<tr>
|
||||||
|
{{ end }}
|
||||||
|
<td title="{{ .Hostname }}.{{ $report.Domain }}">{{ .Hostname }}</td>
|
||||||
|
|
||||||
|
{{ if .Online }}
|
||||||
|
<td class="indicator-green" title="Handshake in last 3 minutes" nowrap>online</td>
|
||||||
|
|
||||||
|
{{ else }}
|
||||||
|
<td class="indicator-null" title="No handshake since since {{ dateFormat "2 Jan 2006 15:04" .LastHandshakeTime }}" nowrap>offline</td>
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
<td>{{ .IP }}</td>
|
||||||
|
<td>{{ .Owner }}</td>
|
||||||
|
<td>{{ .Description }}</td>
|
||||||
|
<td>{{ .ReceiveBytesSI }}</td>
|
||||||
|
<td>{{ .TransmitBytesSI }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{ else }}
|
||||||
|
<!-- Could be an error callout -->
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
/etc/dsnetreport.json not found or empty
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue
Block a user