-
Notifications
You must be signed in to change notification settings - Fork 1
/
eos_net
69 lines (56 loc) · 1.84 KB
/
eos_net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
output_config() {
echo "graph_title EOS NET bandwidth $ACCOUNT"
echo "graph_category EOS"
echo "staked.label Staked, EOS"
echo "delegated.label Delegated, EOS"
echo "used.label Used, KiB"
echo "available.label Available, GiB"
echo "limit.label Limit, GiB"
}
output_values() {
printf "staked.value %d\n" $(staked_net_bandwidth)
printf "delegated.value %d\n" $(delegated_net_bandwidth)
printf "used.value %d\n" $(used_net_bandwidth)
printf "available.value %d\n" $(available_net_bandwidth)
printf "limit.value %d\n" $(limit_net_bandwidth)
}
staked_net_bandwidth() {
$DATADIR/cleos.sh get account $ACCOUNT | grep -A5 -B0 'net bandwidth' | grep 'staked:' | awk -F "." '{print $1}' | awk '{print $2}'
}
delegated_net_bandwidth() {
$DATADIR/cleos.sh get account $ACCOUNT | grep -A5 -B0 'net bandwidth' | grep 'delegated:' | awk -F "." '{print $1}' | awk '{print $2}'
}
used_net_bandwidth() {
$DATADIR/cleos.sh get account $ACCOUNT | grep -A5 -B0 'net bandwidth' | grep 'used:' | awk -F "." '{print $1}' | awk '{print $2}'
}
available_net_bandwidth() {
$DATADIR/cleos.sh get account $ACCOUNT | grep -A5 -B0 'net bandwidth' | grep 'available:' | awk -F "." '{print $1}' | awk '{print $2}'
}
limit_net_bandwidth() {
$DATADIR/cleos.sh get account $ACCOUNT | grep -A5 -B0 'net bandwidth' | grep 'limit:' | awk -F "." '{print $1}' | awk '{print $2}'
}
output_usage() {
printf >&2 "%s - munin plugin to graph EOS net bandwidth\n" ${0##*/}
printf >&2 "Usage: %s [config]\n" ${0##*/}
}
case $# in
0)
output_values
;;
1)
case $1 in
config)
output_config
;;
*)
output_usage
exit 1
;;
esac
;;
*)
output_usage
exit 1
;;
esac