1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-31 13:23:42 +00:00

Cater for newer OS dependencies - python and ceph updates

system default python is now usually python3 - better make our code
compliant with it

`ceph` CLI itself has some slightly different usage and outputs

jq used instead of cut in a few places, because was easier to work out
what the original commands were intending to grab, now that those
outputs have moved location.  Yes, jq is a new dependency for some of
the plugins, but it was already implicitly depended upon in ceph_osd
plugin
This commit is contained in:
Tim Connors 2023-10-16 22:51:27 +11:00
parent 9c17efc39b
commit 5b1300aebf
3 changed files with 25 additions and 22 deletions

View file

@ -35,6 +35,8 @@ fi
WARNING_LEVEL=${warning_level:-"80"}
CRITICAL_LEVEL=${critical_level:-"90"}
CEPH_STATUS=$(ceph -s --format=json)
if [ "$1" = "config" ]; then
echo 'graph_title CEPH capacity'
@ -43,7 +45,7 @@ if [ "$1" = "config" ]; then
echo 'graph_info CEPH cluster capacity'
echo 'graph_args --base 1000 -l 0'
CAPACITY=$(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 3 | cut -d '/' -f 2 | awk '{ print $1 }')
CAPACITY=$(echo "$CEPH_STATUS" | jq '.pgmap.bytes_total')
WARNING=$(echo "scale=2;$CAPACITY * ($WARNING_LEVEL/100)" | bc -l | cut -d '.' -f 1)
CRITICAL=$(echo "scale=2;$CAPACITY * ($CRITICAL_LEVEL/100)" | bc -l | cut -d '.' -f 1)
echo "capacity.label Capacity"
@ -57,6 +59,6 @@ if [ "$1" = "config" ]; then
exit 0
fi
echo "capacity.value $(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 3 | cut -d '/' -f 2 | awk '{ print $1 }')"
echo "used.value $(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 2 | awk '{ print $1 }')"
echo "data.value $(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 1 | awk '{ print $1 }')"
echo "capacity.value $(echo "$CEPH_STATUS" | jq '.pgmap.bytes_total')"
echo "used.value $(echo "$CEPH_STATUS" | jq '.pgmap.bytes_used')"
echo "data.value $(echo "$CEPH_STATUS" | jq '.pgmap.data_bytes')" # no idea of the intention of this metric; could be bytes_avail