Object Identifiers
The Net-SNMP Agent allows to define extensions via executable programs, see the snmpd.conf(5)
man-page.
This page provides a MIB and a awk(1)
script, which can be used to read live data of Linux-Software-RAID (LSR) devices from /proc/mdstat
via the SNMP.
The RAID-MIB defines several tables, one for each dataset.
- The first table names lists the names of all raid partitions (without
/dev/
). All other tables are built in the same order, so that this table should be used to asociate an entry with the respective raid-device. In the following i stands for an index into the respective table. - .1.3.6.1.4.1.22692.2.7243.1: names :
- ?MagmaSoft.names.i lists the names of each raid-device
- .1.3.6.1.4.1.22692.2.7243.2: status :
- ?MagmaSoft.status.101.i lists the active/total status, where active ist the number of active devices and total the total number of devices shared by this raid-device
- .1.3.6.1.4.1.22692.2.7243.3: up :
- ?MagmaSoft.up.i lists the [UU] status, where 'U' means up, and '_' means down.
- .1.3.6.1.4.1.22692.2.7243.4: adminstatus :
- ?MagmaSoft.adminstatus.101.i is either 'active' or
- ... 'inactive'?
- .1.3.6.1.4.1.22692.2.7243.5: blocks :
- ?MagmaSoft.blocks.101.i is the number of blocks on this RAID device
- .1.3.6.1.4.1.22692.2.7243.6: partitions :
- ?MagmaSoft.partitions.101.i lists all hard-disk partitions assembled in this RAID device
- .1.3.6.1.4.1.22692.2.7243.7: info :
- ?MagmaSoft.info.101.i lists data about the Linux-Software RAID:
1. Global Status, on of "Ok" or "Failed"
1. list of colon separated personalities registered by the LSR-Subsystem
1. list of colon separated disc partitions involved in all RAID devices together
1. list of unused partitions
snmpd.conf
The following awk script: attachment:raid_snmp.awk, reads /proc/mdstat
. It has to be called with the name of a table as parameter. The respective table is then generated on stdout
. If no table is specified the status
table is selected by default
You can insert the file attachment:raid_snmp.conf into /etc/snmp/snmpd.conf
or into /etc/snmp/snmpd.local.conf
. Then reload the configuration files. attachment:raid_snmp.conf expects attachment:raid_snmp.awk to be located in /usr/local/bin
.
Nagios
The following two very simple minded configuration snippets define check_commands
for Nagios:
Check the status of a specific RAID-Device
define command { command_name snmp_raid command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.22692.2.7243.2.101.$ARG2$ -l "Raid Device $ARG2$" -s \"$ARG3$\" }
The respective Service Definition command would look like:
define service { service_description md1 check_command snmp_raid!public!1!2/2 ... }
Check the global Status of all Arrays:
define command { command_name snmp_raid_ok command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.22692.2.7243.8.101.1 -l R AID -s \"Ok\" }
The respective Service Definition command:
define service { service_description raid check_command snmp_raid_ok!public ... }