mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 18:38:30 +00:00
Add openstack_swift_stats_ plugin
This commit is contained in:
parent
5c983dbc7d
commit
307795493a
2 changed files with 146 additions and 0 deletions
69
plugins/openstack_swift/openstack_swift_stats_
Executable file
69
plugins/openstack_swift/openstack_swift_stats_
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
|
||||
ME="${0##*/}"
|
||||
CONTAINER=$(printf "$ME" | cut -d'_' -f4 -)
|
||||
# printf "$CONTAINER\n"
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<EOM
|
||||
multigraph openstack_swift_stats_size
|
||||
graph_title Swift container size ($CONTAINER)
|
||||
graph_category cloud
|
||||
graph_vlabel bytes
|
||||
graph_args --base=1024 -l 0
|
||||
graph_period hour
|
||||
size.label Size
|
||||
size.type GAUGE
|
||||
size.draw AREA
|
||||
size.min 0
|
||||
growth.label Growth/\${graph_period}
|
||||
growth.type DERIVE
|
||||
growth.min 0
|
||||
|
||||
multigraph openstack_swift_stats_objects
|
||||
graph_title Swift container object count ($CONTAINER)
|
||||
graph_category cloud
|
||||
graph_vlabel
|
||||
graph_args --base=1000 -l 0
|
||||
graph_period hour
|
||||
objects.label Objects
|
||||
objects.type GAUGE
|
||||
objects.draw AREA
|
||||
objects.min 0
|
||||
objgrowth.label Growth/\${graph_period}
|
||||
objgrowth.type DERIVE
|
||||
objgrowth.min 0
|
||||
EOM
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
IFS=" "
|
||||
STAT_OUTPUT=( $(swift stat $CONTAINER | awk 'NR>=3&&NR<=4 {print $2}' FS=": " ORS=" ") )
|
||||
|
||||
# Size graph
|
||||
printf "multigraph openstack_swift_stats_size\n"
|
||||
|
||||
# Check value is an integer.
|
||||
[ -n "${STAT_OUTPUT[1]}" ] && [ "${STAT_OUTPUT[1]}" -eq "${STAT_OUTPUT[1]}" ] 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
printf "size.value 0\n"
|
||||
printf "Error: no usable size value from swift command.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "size.value ${STAT_OUTPUT[1]}\ngrowth.value ${STAT_OUTPUT[1]}\n"
|
||||
|
||||
# Objects graph
|
||||
printf "multigraph openstack_swift_stats_objects\n"
|
||||
|
||||
[ -n "${STAT_OUTPUT[0]}" ] && [ "${STAT_OUTPUT[0]}" -eq "${STAT_OUTPUT[0]}" ] 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
printf "objects.value 0\n"
|
||||
printf "Error: no usable objects value from swift command.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "objects.value ${STAT_OUTPUT[0]}\nobjgrowth.value ${STAT_OUTPUT[0]}\n"
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue