Skip to content

Instantly share code, notes, and snippets.

@Giwi

Giwi/warp10-raspi-monitoring.html Secret

Last active May 3, 2021
Embed
What would you like to do?
<html>
<head>
<title>Raspi-1 dashboard</title>
</head>
<body>
<discovery-dashboard url="your warp 10" cols="12">
// Variables
'your token' 'token' STORE
'2592000000000' 'duration' STORE
'rasp1-1' 'hname' STORE
{
'title' 'Raspi-1'
'options' { 'scheme' 'CHARTANA' 'autoRefresh' 30 }
'tiles' [
{
'title' 'Disks'
'x' 0 'y' 0 'w' 3 'h' 1
'type' 'gauge' 'unit' 'Gb'
'data' [ $token '~linux.df.bytes.(capacity|free)' { 'hname' $hname 'device' '~/dev/.*' } NOW -1 ] FETCH
[ SWAP bucketizer.last NOW 0 1 ] BUCKETIZE [ 'device' 'mountpoint' ] PARTITION 'gts' STORE
[] 'data' STORE
[] 'params' STORE
$gts KEYLIST <%
'k' STORE
{
$gts $k GET
<% 'g' STORE
$g NAME 'linux.df.bytes.' '' REPLACE
$g VALUES REVERSE 0 GET
%> FOREACH
} 'vals' STORE
$data {
'key' $k 'device' GET ' (' + $k 'mountpoint' GET + ')' +
'value' $vals 'capacity' GET $vals 'free' GET - 1024 / 1024 / 1024.0 / 100 * ROUND 100.0 /
} +! DROP
$params { 'maxValue' $vals 'capacity' GET 1024 / 1024 / 1024 / } +! DROP
%> ASREGS FOREACH
{ 'data' $data 'params' $params }
}
{
'title' 'Network'
'x' 0 'y' 1 'w' 3 'h' 1
'type' 'area'
'data' [ $token '~linux.proc.net.dev.(receive|transmit).bytes' { 'hname' $hname 'iface' 'eth0' } NOW $duration TOLONG ] FETCH
false RESETS 'gts' STORE
[
[ $gts [] 'linux.proc.net.dev.receive.bytes' filter.byclass ] FILTER
[ $gts [] 'linux.proc.net.dev.transmit.bytes' filter.byclass ] FILTER
] FLATTEN [ SWAP bucketizer.mean NOW 1 h 0 ] BUCKETIZE
[ SWAP mapper.delta 1 0 0 ] MAP
}
{
'title' 'Load'
'x' 3 'y' 1 'w' 9 'h' 1
'type' 'area'
'data' <%
[ $token '~linux.proc.stat.userhz.(user|nice|system|idle|iowait)' { 'hname' $hname 'cpu' 'cpu' } NOW $duration TOLONG ] FETCH
[ SWAP bucketizer.mean NOW 1 h 0 ] BUCKETIZE 'gts' STORE
[ $gts [] '~linux.proc.stat.userhz.(user|nice|system|idle|iowait)' filter.byclass ] FILTER [ SWAP [] reducer.sum ] REDUCE 0 GET 'cpuGTS' STORE
[ $gts [] 'linux.proc.stat.userhz.idle' filter.byclass ] FILTER 0 GET 'idleGTS' STORE
[ $gts [] '~linux.proc.stat.userhz.(iowait|idle)' filter.byclass ] FILTER [ SWAP [] reducer.sum ] REDUCE 0 GET 'iowaitGTS' STORE
[ $gts [] '~linux.proc.stat.userhz.(system|idle)' filter.byclass ] FILTER [ SWAP [] reducer.sum ] REDUCE 0 GET 'systemGTS' STORE
[
[ [ $cpuGTS $idleGTS ] [] <%
'd' STORE
$d 7 GET 0 GET 'cpu' STORE
$d 7 GET 1 GET 'idle' STORE
1000.0 $cpu $idle - * $cpu 5 + / 10 / 'v' STORE
[ $d 0 GET NaN NaN NaN $v ]
%> ASREGS MACROREDUCER ] REDUCE 0 GET 'CPU' RENAME
[ [ $iowaitGTS $idleGTS ] [] <%
'd' STORE
$d 7 GET 0 GET 'cpu' STORE
$d 7 GET 1 GET 'idle' STORE
1000.0 $cpu $idle - * $cpu 5 + / 10 / 'v' STORE
[ $d 0 GET NaN NaN NaN $v ]
%> ASREGS MACROREDUCER ] REDUCE 0 GET 'Disk IO' RENAME
[ [ $systemGTS $idleGTS ] [] <%
'd' STORE
$d 7 GET 0 GET 'cpu' STORE
$d 7 GET 1 GET 'idle' STORE
1000.0 $cpu $idle - * $cpu 5 + / 10 / 'v' STORE
[ $d 0 GET NaN NaN NaN $v ]
%> ASREGS MACROREDUCER ] REDUCE 0 GET 'System' RENAME
] %> <% [] %> <% %> TRY
}
{
'title' 'RAM/Swap'
'x' 3 'y' 0 'w' 9 'h' 1
'type' 'area'
'data' [ $token '~linux.proc.meminfo.(MemFree|SwapFree)' { 'hname' $hname } NOW $duration TOLONG ] FETCH
[ SWAP bucketizer.mean NOW 1 h 0 ] BUCKETIZE
[ SWAP 1.0 1024.0 1024.0 * 1024.0 * / mapper.mul 0 0 0 ] MAP
}
]
}</discovery-dashboard>
<script nomodule src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.js"></script>
<script type="module" src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.esm.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment