Add monitoring for filesystems other than root

We have hosts with an extra volume mounted to e.g. /opt, we want to
monitor disk space for those volumes, too.

For reference, this is how a sample list of hrStorageDescr looks like
before filtering:

$ php -q add_graphs.php --host-id=$HOST_ID --list-snmp-values
--snmp-field=hrStorageDescr
Known values for hrStorageDescr for host 350: (name)
/
/dev/shm
/opt
/opt/dib_tmp/dib_build.yFIsY6K6/mnt/tmp/yum
/run
/run/lock
/run/user/0
/sys/fs/cgroup
Cached memory
Memory buffers
Physical memory
Shared memory
Swap space
Virtual memory

Change-Id: Ia75448f68a0cee50a3a164a483869ab526bb8ad7
This commit is contained in:
Jens Harbott 2019-03-28 10:22:54 +00:00
parent 327cfa7893
commit b6fb20f982

View File

@ -54,8 +54,11 @@ function add_ds_graph {
SNMP_QUERY_ID=`php -q add_graphs.php --host-id=$HOST_ID --list-snmp-queries | \ SNMP_QUERY_ID=`php -q add_graphs.php --host-id=$HOST_ID --list-snmp-queries | \
grep "SNMP - Get Mounted Partitions"|cut -f 1` grep "SNMP - Get Mounted Partitions"|cut -f 1`
for mountpoint in $(php -q /usr/share/cacti/cli/add_graphs.php --host-id=$HOST_ID --snmp-field=hrStorageDescr --list-snmp-values | \
grep /|grep -v -e dev -e dib_tmp -e run -e sys) ; do
add_ds_graph "Host MIB - Available Disk Space" "Available Disk Space" \ add_ds_graph "Host MIB - Available Disk Space" "Available Disk Space" \
"hrStorageDescr" "/" "hrStorageDescr" "$mountpoint"
done
SNMP_QUERY_ID=`php -q add_graphs.php --host-id=$HOST_ID --list-snmp-queries | \ SNMP_QUERY_ID=`php -q add_graphs.php --host-id=$HOST_ID --list-snmp-queries | \
grep "SNMP - Interface Statistics"|cut -f 1` grep "SNMP - Interface Statistics"|cut -f 1`