diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias --- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2010-09-02 17:19:39.000000000 +0200 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2010-09-02 17:19:24.000000000 +0200 @@ -1,5 +1,5 @@ { -my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show, /var/lib/zabbix/bin/sensors *, /usr/sbin/smartctl -A /dev/*'; +my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show, /var/lib/zabbix/bin/sensors *, /var/lib/zabbix/bin/check_lvm *, /usr/sbin/smartctl -A /dev/*'; if ( -x '/opt/MegaRAID/MegaCli/MegaCli' ){ $runasroot .= ', /var/lib/zabbix/bin/megaraid-parser.pl'; } diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm --- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm 2010-09-02 17:18:51.000000000 +0200 @@ -0,0 +1,10 @@ + +# Type: Agent or Agent (active) +# Key: lvm[key] where key can be snapshot_max_allow, snapshots, lv or vg +# Type of information: Numeric (integer 64bit) or characters (for version) +# 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 $1 + diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_lvm mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_lvm --- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_lvm 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_lvm 2010-09-02 17:16:51.000000000 +0200 @@ -0,0 +1,34 @@ +#!/bin/bash + +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" +} + +snapshots(){ + echo $(lvdisplay | grep % | wc -l) +} + +lv(){ + echo $(lvdisplay | grep 'LV Name' | wc -l) +} + +vg(){ + echo $(vgdisplay | grep 'VG Name' | wc -l) +} + +case $1 in + snapshot_max_alloc|snapshots|lv|vg) + $1 + ;; + *) + echo 'ZBX_NOTSUPPORTED' +esac +