-
Notifications
You must be signed in to change notification settings - Fork 1
/
eos_mem
77 lines (63 loc) · 1.72 KB
/
eos_mem
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
69
70
71
72
73
74
75
76
#!/bin/sh
output_config() {
echo "graph_title EOS node memory consumption"
echo "graph_category EOS"
echo "graph_args --base 1024"
echo "total.label Total RAM"
echo "total.draw AREA"
echo "size.label Size of state database"
echo "usage.label Usage of state database"
echo "blocks.label Size of blocks database"
echo "revdb.label Size of reversible database"
echo "revdb_usage.label Usage of reversible database"
}
output_values() {
printf "total.value %d\n" $(total_ram)
printf "size.value %d\n" $(statedb_size)
printf "usage.value %d\n" $(statedb_usage)
printf "blocks.value %d\n" $(blocksdb_size)
printf "revdb.value %d\n" $(reversdb_size)
printf "revdb_usage.value %d\n", $(reversdb_usage)
}
total_ram() {
cat /proc/meminfo |grep MemTotal|awk '{print $2*1024}'
}
statedb_size() {
ls -la $DATADIR/state/shared_memory.bin | awk ' { print $5 } '
}
statedb_usage() {
du $DATADIR/state/shared_memory.bin | awk '{print $1 * 1024}'
}
blocksdb_size() {
ls -la $DATADIR/blocks/blocks.log | awk ' { print $5 } '
}
reversdb_size() {
ls -la $DATADIR/blocks/reversible/shared_memory.bin | awk ' { print $5 } '
}
reversdb_usage() {
du $DATADIR/blocks/reversible/shared_memory.bin | awk '{ print $1 * 1024}'
}
output_usage() {
printf >&2 "%s - munin plugin to graph EOS node memory consuption\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