-
Notifications
You must be signed in to change notification settings - Fork 6
/
bitcoind_mempool_bytes
executable file
·62 lines (42 loc) · 1 KB
/
bitcoind_mempool_bytes
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
#!/bin/sh
# -*- sh -*-
# vim: ft=sh
: << =cut
=head1 NAME
bitcoind_mempool - Plugin to monitor the size of the mempool
=head1 CONFIGURATION
[bitcoind*]
user bitcoin
env.binary bitcoin-cli
env.data_dir /var/lib/bitcoin
=head1 AUTHOR
Cedric Felizard
=head1 LICENSE
AGPLv3+
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
METRIC=${0##*/bitcoind_mempool_}
case $METRIC in
size|bytes);;
*) exit 1;;
esac
BINARY=${binary:-"/usr/bin/bitcoin-cli"}
DATA_DIR=${data_dir:-"/var/lib/bitcoin"}
if [ "$1" = "autoconf" ]; then
autoconf="yes"
command -v $BINARY >/dev/null || autoconf="no"
echo $autoconf
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Mempool ${METRIC}"
echo "graph_vlabel ${METRIC}"
echo "graph_category bitcoind"
echo "${METRIC}.label mempool (${METRIC})"
exit 0
fi
mempool="$($BINARY -datadir=$DATA_DIR getmempoolinfo)"
value=$(echo "$mempool" | grep $METRIC | grep -o '[0-9]*')
echo "${METRIC}.value $(echo $value)"