Advertisement
Guest User

Untitled

a guest
May 13th, 2023
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. 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/^,/[/' |
  2. jq -r '
  3. "Satellite per day: ",
  4. (
  5. .[] |
  6. (
  7. " - " + .id + " (" + .audits.satelliteName + ")",
  8. .bandwidthDaily[] as $bw |
  9. (.storageDaily | map(select(.intervalStart == $bw.intervalStart)) | .[0].atRestTotalBytes) as $space |
  10. (.storageDaily | map(select(.intervalStart > $bw.intervalStart)) | .[0]?.atRestTotalBytes) as $spaceTomorrow |
  11. (($spaceTomorrow // $space) - $space) as $spaceInc |
  12. ($bw.ingress | .repair + .usage) as $ing |
  13. (
  14. " * Date: " + $bw.intervalStart,
  15. " # IN: " + ($ing / 100000 | round | . / 10 | tostring) + "MB",
  16. " # Increase used space: " + ($spaceInc / 100000 | round | . / 10 | tostring) + "MB",
  17. " # Efficiency: " + ($spaceInc / $ing * 100 | round | tostring) + "%"
  18. )
  19. )
  20. ),
  21. "",
  22. "Per day: ",
  23. (
  24. [.[].bandwidthDaily[]] as $bw |
  25. [.[].storageDaily[]] as $stor |
  26. (
  27. $bw | group_by(.intervalStart)[] | (
  28. .[0].intervalStart as $today |
  29. ([$stor[].intervalStart] | map(select(. > $today)) | min) as $tomorrow |
  30. ($stor | map(select(.intervalStart == $today).atRestTotalBytes) | add) as $space |
  31. ($stor | map(select(.intervalStart == $tomorrow).atRestTotalBytes) | add) as $spaceTomorrow |
  32. ( [.[].ingress | (.repair + .usage)] | add ) as $ing |
  33. (($spaceTomorrow // $space) - $space) as $spaceInc |
  34. " - Date: " + $today,
  35. " * IN: " + ($ing / 100000 | round | . / 10 | tostring) + "MB",
  36. " * Increase used space: " + ($spaceInc / 100000 | round | . / 10 | tostring) + "MB",
  37. " * Efficiency: " + ($spaceInc / $ing * 100 | round | tostring) + "%"
  38. )
  39. ),
  40. "",
  41. "Total: ",
  42. (
  43. ( [$bw[].ingress | (.repair + .usage)] | add ) as $ing |
  44. ( [$stor[].intervalStart] | max) as $maxdate |
  45. ( [$stor[].intervalStart] | min) as $mindate |
  46. (($stor | map(select(.intervalStart == $maxdate).atRestTotalBytes) | add) - ($stor | map(select(.intervalStart == $mindate).atRestTotalBytes) | add)) as $space |
  47. " - IN: " + ($ing / 100000 | round | . / 10 | tostring) + "MB",
  48. " - Total used space: " + ($space / 100000 | round | . / 10 | tostring) + "MB",
  49. " - Efficiency: " + ($space / $ing * 100 | round | tostring) + "%"
  50. )
  51. )'
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement