Hello Mickeybyte. Did you get any support?
I am experiencing the same issue with a similar sensor. The whole sensor is in the code snippet below.
I would expect that simple SpeedNet
unit with SpeedSize Byte
will show it as simple as in Byte/s and allow me to change it in the channel unit configuration. But there is nothing about the SpeedNet in channel unit sensor settings.
I tried byte, bit, in VolumeSize, SpeedSize, SpeedTime, nothing lead to success.
So question to the Paessler:
How does this work? What is expected result? How we can reach the state when we can configure the Bytes/s to be Megabytes/s (or alternative) from the UI same as for Bandwidth?
Also from help from speedtest cmd:
Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision
So the $cosi.download.bandwitdth is Byte/s
#!/usr/bin/env pwsh
param([Switch] $Push)
$cosi = '{ "server": { "name": "ahoj", "location": "loc" }, "result": { "url": "url" } }'
#$cosi2 = '{"type":"result","timestamp":"2022-01-02T15:27:25Z","ping":{"jitter":0.71499999999999997,"latency":26.661000000000001},"download":{"bandwidth":1129525,"bytes":14619008,"elapsed":15011},"upload":{"bandwidth":1129272,"bytes":10069392,"elapsed":9003},"packetLoss":0.67796610169491522,"isp":"K-net Technical International Group, s.r.o.","interface":{"internalIp":"....","name":"eth0","macAddr":"DC:A6:32:74:F0:9F","isVpn":false,"externalIp":"...."},"server":{"id":29593,"host":"speed2.brno.master.profihost.cloud","port":8080,"name":"PROFI CLOUD SERVICES s.r.o.","location":"Brno","country":"Czech Republic","ip":"77.93.201.229"},"result":{"id":"57f71161-a25e-4a25-a782-563ed2ec4fde","url":"https://www.speedtest.net/result/c/57f71161-a25e-4a25-a782-563ed2ec4fde","persisted":true}}'
# $cosi = & speedtest --format="json" --accept-license --accept-gdpr
$cosi = $cosi | ConvertFrom-Json
$server = $cosi.server
$server = $server.name + ' - ' + $server.location
$resultURL = $cosi.result.url
$result = @{
'prtg' = @{
'text' = "$server ($resultURL)"
'result' = @(
@{
'Channel' = 'Download Speed'
'Value' = 2125027
# 'Value' = ($cosi.download.bandwidth ?? 0)
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'SpeedNet'
'VolumeSize' = 'Byte'
'SpeedSize' = 'Byte'
'LimitMode' = 1
'LimitMinWarning' = 1
},
@{
'Channel' = 'Downloaded Data'
'Value' = ($cosi.download.bytes ?? 0)
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'BytesBandwidth'
},
@{
'Channel' = 'Upload Speed'
'Value' = 2167276
# 'Value' = ($cosi.upload.bandwidth ?? 0)
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'SpeedNet'
'VolumeSize' = 'Bit'
'SpeedSize' = 'Bit'
},
@{
'Channel' = 'Uploaded Data'
'Value' = ($cosi.upload.bytes ?? 0)
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'BytesBandwidth'
},
@{
'Channel' = 'Latency'
'Value' = $cosi.ping.latency ?? 0
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'TimeResponse'
},
@{
'Channel' = 'Latency Jitter'
'Value' = $cosi.ping.jitter ?? 0
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'TimeResponse'
},
@{
'Channel' = 'Packet Loss'
'Value' = ($cosi.packetloss ?? 0)
'Float' = 1
'DecimalMode' = 'All'
'Unit' = 'Percent'
'LimitMode' = 1
'LimitMaxError' = 60
'LimitMaxWarning' = 30
}
)
}
} | ConvertTo-Json -Depth 20 -Compress
if ($Push) {
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest '<Redacted>' -Method 'Post' -Body $result -Headers @{
'Content-Type' = 'application/json'
} | Out-Null
} else {
return $result
}
Add comment