Additional scripts for Zabbix agent on Linux to discover and monitor several services
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
735 B

#!/bin/bash
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
# Return the greatest snapshot allocation
snapshot_max_alloc(){
MAX_PERCENT=0
for PERCENT in $(lvdisplay | grep % | sed -e 's/ Allocated to snapshot //g' -e 's/%//g'); do
if [[ "$PERCENT" > "$MAX_PERCENT" ]]; then
MAX_PERCENT=$PERCENT
fi
done
echo "$MAX_PERCENT"
}
# Number of active snapshots
snapshots(){
echo $(lvdisplay | grep % | wc -l)
}
# Number of logical volumes
lv(){
echo $(lvdisplay | grep 'LV Name' | wc -l)
}
# Number of volume group
vg(){
echo $(vgdisplay | grep 'VG Name' | wc -l)
}
case $1 in
snapshot_max_alloc|snapshots|lv|vg)
$1
;;
*)
echo 'ZBX_NOTSUPPORTED'
esac