Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo "$( wget -qO - localhost:14002/api/sno | jq -r .satellites[].id | while read -r sNode; do echo ','; wget -qO - localhost:14002/api/sno/satellite/$sNode; done )]" | sed -z 's/^,/[/' |
- jq -r '
- "Satellite per day: ",
- (
- .[] |
- (
- " - " + .id + " (" + .audits.satelliteName + ")",
- .bandwidthDaily[] as $bw |
- (.storageDaily | map(select(.intervalStart == $bw.intervalStart)) | .[0].atRestTotalBytes) as $space |
- (.storageDaily | map(select(.intervalStart > $bw.intervalStart)) | .[0]?.atRestTotalBytes) as $spaceTomorrow |
- (($spaceTomorrow // $space) - $space) as $spaceInc |
- ($bw.ingress | .repair + .usage) as $ing |
- (
- " * Date: " + $bw.intervalStart,
- " # IN: " + ($ing / 100000 | round | . / 10 | tostring) + "MB",
- " # Increase used space: " + ($spaceInc / 100000 | round | . / 10 | tostring) + "MB",
- " # Efficiency: " + ($spaceInc / $ing * 100 | round | tostring) + "%"
- )
- )
- ),
- "",
- "Per day: ",
- (
- [.[].bandwidthDaily[]] as $bw |
- [.[].storageDaily[]] as $stor |
- (
- $bw | group_by(.intervalStart)[] | (
- .[0].intervalStart as $today |
- ([$stor[].intervalStart] | map(select(. > $today)) | min) as $tomorrow |
- ($stor | map(select(.intervalStart == $today).atRestTotalBytes) | add) as $space |
- ($stor | map(select(.intervalStart == $tomorrow).atRestTotalBytes) | add) as $spaceTomorrow |
- ( [.[].ingress | (.repair + .usage)] | add ) as $ing |
- (($spaceTomorrow // $space) - $space) as $spaceInc |
- " - Date: " + $today,
- " * IN: " + ($ing / 100000 | round | . / 10 | tostring) + "MB",
- " * Increase used space: " + ($spaceInc / 100000 | round | . / 10 | tostring) + "MB",
- " * Efficiency: " + ($spaceInc / $ing * 100 | round | tostring) + "%"
- )
- ),
- "",
- "Total: ",
- (
- ( [$bw[].ingress | (.repair + .usage)] | add ) as $ing |
- ( [$stor[].intervalStart] | max) as $maxdate |
- ( [$stor[].intervalStart] | min) as $mindate |
- (($stor | map(select(.intervalStart == $maxdate).atRestTotalBytes) | add) - ($stor | map(select(.intervalStart == $mindate).atRestTotalBytes) | add)) as $space |
- " - IN: " + ($ing / 100000 | round | . / 10 | tostring) + "MB",
- " - Total used space: " + ($space / 100000 | round | . / 10 | tostring) + "MB",
- " - Efficiency: " + ($space / $ing * 100 | round | tostring) + "%"
- )
- )'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement