-
Notifications
You must be signed in to change notification settings - Fork 1
/
eos_chain
51 lines (42 loc) · 1.1 KB
/
eos_chain
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
#!/bin/sh
output_config() {
echo "graph_title EOS Chain"
echo "graph_category EOS"
echo "graph_args --base 1000"
echo "head_block_num.label Head block number"
echo "last_irreversible_block_num.label Last irreversible block num"
}
output_values() {
printf "head_block_num.value %d\n" $(head_block_num)
printf "last_irreversible_block_num.value %d\n" $(last_irreversible_block_num)
}
head_block_num() {
$DATADIR/cleos.sh get info | grep 'head_block_num' | awk -F "," '{print $1}'| awk '{print $2}'
}
last_irreversible_block_num() {
$DATADIR/cleos.sh get info | grep 'last_irreversible_block_num' | awk -F "," '{print $1}'| awk '{print $2}'
}
output_usage() {
printf >&2 "%s - munin plugin to graph EOS Chain\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