Add LVM script and conf

tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 12 years ago
parent f922de9d81
commit 23fc1f92de
  1. 8
      conf/lvm.conf
  2. 38
      scripts/check_lvm_sudo

@ -0,0 +1,8 @@
# Type: Agent or Agent (active)
# Key: lvm[key] where key can be snapshot_max_alloc, snapshots, lv or vg
# Type of information: Numeric (integer 64bit)
# Units: depends on the key (snapshot_max_alloc is in %)
# Custom multiplier: Do not use
# Store Value: As is
UserParameter=lvm[*],/usr/bin/sudo /var/lib/zabbix/bin/check_lvm_sudo $1

@ -0,0 +1,38 @@
#!/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
Loading…
Cancel
Save