Категории

понедельник, 16 марта 2015 г.

Мониторинг LSI MegaRAID в Zabbix

Скрипт мониторит по-умолчанию адаптер 0, т.е. когда в системе только одна плата Raid контроллера (опция -a0), но можно указать конкретный номер адаптера, если это необходимо.

Скрипт имеет встроенную справку:
# ./lsimegaraid_discovery_trapper.sh help
WARNING: Correctly setup 'Hostname=' in config is REQUIRED!

INFO: Number of array is default 0;
 Examples:
    Discovery is default action:
        ./lsimegaraid_discovery_trapper.sh                            - physdiscovery disks for default array 0.
        ./lsimegaraid_discovery_trapper.sh discovery                  - physdiscovery disks for default array 0.
        ./lsimegaraid_discovery_trapper.sh discovery virtdiscovery    - virtdiscovery disks for custom array 0.
        ./lsimegaraid_discovery_trapper.sh discovery virtdiscovery 1  - virtdiscovery disks for custom array 1.
        ./lsimegaraid_discovery_trapper.sh discovery physdiscovery 1  - physdiscovery disks for custom array 1.
    Data sending to zabbix-server:
        ./lsimegaraid_discovery_trapper.sh trapper    - send data to zabbix for default array 0.
        ./lsimegaraid_discovery_trapper.sh trapper 1  - send data to zabbix for custom array 1.

03.2015 - metajiji@gmail.com
Скрипт поддерживает обнаружение (discovery) виртуальных и физических дисков в слотах. Отправка данных осуществляется через zabbix_sender.
Установка довольно тривиальна:
mkdir /etc/zabbix/scripts
chown root:zabbix -R /etc/zabbix/scripts
chmod 750 /etc/zabbix/scripts
Код скрипта /etc/zabbix/scripts/lsimegaraid_discovery_trapper.sh:
#!/bin/sh

MEGACLI='/usr/local/sbin/MegaCli'
ZABBIX_SENDER='/usr/local/bin/zabbix_sender'
CONFIG='/etc/zabbix/zabbix_agentd.conf'

usage() {
 cat <<-_EOF
 WARNING: Correctly setup 'Hostname=' in config is REQUIRED!

 INFO: Number of array is default 0;
  Examples:
     Discovery is default action:
         ./$(basename $0)                            - physdiscovery disks for default array 0.
         ./$(basename $0) discovery                  - physdiscovery disks for default array 0.
         ./$(basename $0) discovery virtdiscovery    - virtdiscovery disks for custom array 0.
         ./$(basename $0) discovery virtdiscovery 1  - virtdiscovery disks for custom array 1.
         ./$(basename $0) discovery physdiscovery 1  - physdiscovery disks for custom array 1.
     Data sending to zabbix-server:
         ./$(basename $0) trapper    - send data to zabbix for default array 0.
         ./$(basename $0) trapper 1  - send data to zabbix for custom array 1.

 03.2015 - metajiji@gmail.com
_EOF
}

LC_ALL=""
LANG="en_US.UTF-8"

discovery() {
 local TYPE=${1:-'physdiscovery'}  # Set Default value to physdiscovery.
 local ARRAY_NUM=${2:-'0'}  # Default value of array number is 0.
 if [ "$TYPE" == "virtdiscovery" ]; then
  $MEGACLI -LDInfo -LAll -a$ARRAY_NUM -NoLog | awk '
   BEGIN {
    out = "{\n\t\"data\":[\n"
    f = 0
   }
   /Virtual Drive:/ {
    if (f == 1) out = out",\n"
    out=out "\t\t{\"{#VIRTNUM}\":\"VirtualDrive"$3"\"}"
    f = 1
   }
   END {
    if (f == 0) {
     print "{}"
    } else {
     print out"\n\t]\n}"
    }
   }'
 elif [ "$TYPE" == 'physdiscovery' ]; then
  $MEGACLI -PDlist -a$ARRAY_NUM -NoLog | awk -F ': ' '
   BEGIN {
    out = "{\n\t\"data\":[\n"
    f = 0
   }
   /Slot Number:/ {
    if (f == 1) out = out",\n"
    out=out "\t\t{\"{#PHYSNUM}\":\"DriveSlot"$2"\"}"
    f = 1
   }
   END {
    if (f == 0) {
     print "{}"
    } else {
     print out"\n\t]\n}"
    }
   }'
 else
  >&2 echo 'ERROR  : Discovery TYPE "'$TYPE'" is not correct!'
  echo '{}'  # Return empty json, if TYPE is not correct.
 fi
}

trapper() {
 local ARRAY_NUM=${1:-'0'}  # Default value of array number is 0.
 ($MEGACLI -PDlist -a$ARRAY_NUM -NoLog | awk -F':' '
  function ltrim(s) {sub(/^[ \t]+/, "", s);return s}
  function rtrim(s) {sub(/[ \t]+$/, "", s);return s}
  function trim(s)  {return rtrim(ltrim(s))}
  /Slot Number/              {slotcounter += 1; slot[slotcounter] = trim($2)}
  /Firmware state/           {state[slotcounter]        = trim($2)}
  /S.M.A.R.T/                {smart[slotcounter]        = trim($2)}
  /Inquiry Data/             {inquiry[slotcounter]      = trim($2)}
  /Media Error Count/        {mediaerror[slotcounter]   = trim($2)}
  /Other Error Count/        {othererror[slotcounter]   = trim($2)}
  /Drive Temperature/        {temperature[slotcounter]  = trim($2)}
  /Predictive Failure Count/ {failurecount[slotcounter] = trim($2)}
  END {
   for (i = 1; i <= slotcounter; i += 1) {
    printf ("- lsimegaraid.data[DriveSlot%d,state] %s\n",        slot[i], state[i])
    printf ("- lsimegaraid.data[DriveSlot%d,smart] %s\n",        slot[i], smart[i])
    printf ("- lsimegaraid.data[DriveSlot%d,inquiry] %s\n",      slot[i], inquiry[i])
    printf ("- lsimegaraid.data[DriveSlot%d,mediaerror] %d\n",   slot[i], mediaerror[i])
    printf ("- lsimegaraid.data[DriveSlot%d,othererror] %d\n",   slot[i], othererror[i])
    printf ("- lsimegaraid.data[DriveSlot%d,temperature] %d\n",  slot[i], temperature[i])
    printf ("- lsimegaraid.data[DriveSlot%d,failurecount] %d\n", slot[i], failurecount[i])
   }
  }'; [ $? -gt 1 ] && echo 'ERROR  : MegaCli failed while getting phusical drives data!' && exit 1

 ${MEGACLI} -LDInfo -LAll -a$ARRAY_NUM -NoLog | awk -F':' '
  function ltrim(s) {sub(/^[ \t]+/, "", s);return s}
  function rtrim(s) {sub(/[ \t]+$/, "", s);return s}
  function trim(s)  {return rtrim(ltrim(s))}
  /Virtual Drive:/  {drivecounter += 1; slot[drivecounter] = trim($2)}
  /State/           {state[drivecounter]    = trim($2)}
  /Bad Blocks/      {badblock[drivecounter] = trim($2)}
  END {
   for (i = 1; i <= drivecounter; i += 1) {
    printf ("- lsimegaraid.data[VirtualDrive%d,state] %s\n", slot[i], state[i])
    printf ("- lsimegaraid.data[VirtualDrive%d,badblock] %s\n", slot[i], badblock[i]?badblock[i]:"Unknown")
   }
  }'; [ $? -gt 1 ] && echo 'ERROR  : MegaCli failed while getting virtual drives data!' && exit 1
 ) | $ZABBIX_SENDER --config $CONFIG -vv --input-file - >/dev/null 2>&1
 [ $? -gt 1 ] && echo 0 && exit 1
 echo 1 # 1 - Ok | 0 - Fail
}

case "$1" in
 help|usage|-h|--help) usage ;;
 discovery) discovery $2 $3 ;;
 trapper) trapper $2 ;;
 *) discovery ;;
esac
Установка прав на скрипт:
chown root:zabbix /etc/zabbix/scripts/lsimegaraid_discovery_trapper.sh
chmod 750 /etc/zabbix/scripts/lsimegaraid_discovery_trapper.sh
Не забываем про настройки в скрипте, где нужно указать полные пути до необходимых программ и конфигурационных файлов:
MEGACLI='/usr/local/sbin/MegaCli'
ZABBIX_SENDER='/usr/local/bin/zabbix_sender'
CONFIG='/etc/zabbix/zabbix_agentd.conf'
Конфигурационный файл: /etc/zabbix/zabbix_agentd.conf.d/lsimegaraid.conf
UserParameter=lsimegaraid.discovery[*],/usr/local/etc/zabbix24/scripts/lsimegaraid_discovery_trapper.sh "discovery" $1 $2
UserParameter=lsimegaraid.trapper[*],/usr/local/etc/zabbix24/scripts/lsimegaraid_discovery_trapper.sh "trapper" $1
Шаблон для zabbix:
<zabbix_export>
    <version>2.0</version>
    <date>2015-03-16T07:54:05Z</date>
    <groups>
        <group>
            <name>MyTemplates</name>
        </group>
    </groups>
    <templates>
        <template>
            <template>Template LSIMegaRaid_trapper</template>
            <name>Template LSIMegaRaid_trapper</name>
            <description/>
            <groups>
                <group>
                    <name>MyTemplates</name>
                </group>
            </groups>
            <applications>
                <application>
                    <name>LSI MegaRaid</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>Trapper</name>
                    <type>0</type>
                    <snmp_community/>
                    <multiplier>0</multiplier>
                    <snmp_oid/>
                    <key>lsimegaraid.trapper[0]</key>
                    <delay>30</delay>
                    <history>90</history>
                    <trends>365</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>LSI MegaRaid</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
            </items>
            <discovery_rules>
                <discovery_rule>
                    <name>LSIMegaRaid: Physical disks slot discovery</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>lsimegaraid.discovery[physdiscovery,0]</key>
                    <delay>3600</delay>
                    <status>0</status>
                    <allowed_hosts/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <filter>
                        <evaltype>0</evaltype>
                        <formula/>
                        <conditions/>
                    </filter>
                    <lifetime>30</lifetime>
                    <description/>
                    <item_prototypes>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Firmware State</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},state]</key>
                            <delay>0</delay>
                            <history>365</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>4</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 has flagged a S.M.A.R.T alert</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},smart]</key>
                            <delay>0</delay>
                            <history>365</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>4</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Inquiry Data</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},inquiry]</key>
                            <delay>0</delay>
                            <history>365</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>4</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Media Error Count</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},mediaerror]</key>
                            <delay>0</delay>
                            <history>7</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Other Error Count</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},othererror]</key>
                            <delay>0</delay>
                            <history>7</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Predictive Failure Count</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},failurecount]</key>
                            <delay>0</delay>
                            <history>7</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Temperature</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#PHYSNUM},temperature]</key>
                            <delay>0</delay>
                            <history>7</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>C</units>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},smart].str(No)}=0</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} has flagged a S.M.A.R.T alert on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},inquiry].diff(0)}&gt;0</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} inquiry data changed on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>1</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},mediaerror].last(0)}&gt;0</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} Media Error Count on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},othererror].last(0)}&gt;0</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} Other Error Count on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},failurecount].last(0)}&gt;0</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} Predictive Failure Count on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},state].str(Online)}=0</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} state is not online on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},temperature].last(0)}&gt;45</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} temperature is high on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>4</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#PHYSNUM},temperature].last(0)}&gt;49</expression>
                            <name>LSIMegaRaid: {#PHYSNUM} temperature is very high on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                    </trigger_prototypes>
                    <graph_prototypes/>
                    <host_prototypes/>
                </discovery_rule>
                <discovery_rule>
                    <name>LSIMegaRaid: Virtual disks discovery</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>lsimegaraid.discovery[virtdiscovery,0]</key>
                    <delay>3600</delay>
                    <status>0</status>
                    <allowed_hosts/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <filter>
                        <evaltype>0</evaltype>
                        <formula/>
                        <conditions/>
                    </filter>
                    <lifetime>30</lifetime>
                    <description/>
                    <item_prototypes>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 Bad Blocks Exist</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#VIRTNUM},badblock]</key>
                            <delay>0</delay>
                            <history>365</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>1</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>LSIMegaRaid: $1 State</name>
                            <type>2</type>
                            <snmp_community/>
                            <multiplier>0</multiplier>
                            <snmp_oid/>
                            <key>lsimegaraid.data[{#VIRTNUM},state]</key>
                            <delay>0</delay>
                            <history>365</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>1</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>LSI MegaRaid</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#VIRTNUM},badblock].str(No)}=0</expression>
                            <name>LSIMegaRaid: {#VIRTNUM} Bad Blocks Exist on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{Template LSIMegaRaid_trapper:lsimegaraid.data[{#VIRTNUM},state].str(Optimal)}=0</expression>
                            <name>LSIMegaRaid: {#VIRTNUM} state is not optimal on {HOST.NAME}</name>
                            <url/>
                            <status>0</status>
                            <priority>5</priority>
                            <description/>
                            <type>0</type>
                        </trigger_prototype>
                    </trigger_prototypes>
                    <graph_prototypes/>
                    <host_prototypes/>
                </discovery_rule>
            </discovery_rules>
            <macros/>
            <templates/>
            <screens/>
        </template>
    </templates>
</zabbix_export>

1. Мониторинг LSI MegaRAID в Zabbix
2. Мониторинг состояния HDD в RAID контроллере LSI MegaRAID под Linux, средствами Nagios.
3. Intel Raid Controller RS2BL040 Slow Performance – BBU problems.
4. Perc RAID Controllers
5. Adding a Hard Drive back into RAID on a Web Gateway 5000 or 5500 Intel based Appliance

2 комментария:

Анонимный комментирует...

Добрый день!

Хотел воспользоваться Вашим шаблоном, но при обнаружении возникает ошибка "Cannot find the "data" array in the received JSON object"

Так же просьба выложить Ваши скрипты архивом, ибо при копировании исходного кода добавляются скрытые поля и приходится их вычищать grep-ом.

Спасибо!

METAJIJI комментирует...

Выложил кодик на github: https://github.com/METAJIJI/zabbix_lsi-megaraid
Все писалось и тестировалось под FreeBSD, так что под другие ОС вероятно могут потребоваться переделки.

Отправить комментарий