File: test_export_json.sh

package info (click to toggle)
glances 4.3.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,540 kB
  • sloc: python: 16,525; makefile: 453; javascript: 347; sh: 315
file content (19 lines) | stat: -rwxr-xr-x 671 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

# Exit on error
set -e

# Run glances with export to JSON file, stopping after 3 writes (to be sure rates are included)
# This will run synchronously now since we're using --stop-after
echo "Glances starts to export system stats to JSON file /tmp/glances.json (duration: ~ 10 seconds)"
rm -f /tmp/glances.json
./venv/bin/python -m glances --export json --export-json-file /tmp/glances.json --stop-after 3 --quiet

echo "Checking JSON file..."
jq . /tmp/glances.json
jq .cpu /tmp/glances.json
jq .cpu.total /tmp/glances.json
jq .mem /tmp/glances.json
jq .mem.total /tmp/glances.json
jq .processcount /tmp/glances.json
jq .processcount.total /tmp/glances.json