Once the snmp-agents/snmpd-mdraid-connector package has been installed some basic configuration is required.
The snmp-agents/snmpd-mdraid-connector configuration file, located at /etc/snmpd-mdraid-connector, is relatively straightforward as shown in the example below.
# List of disk devices to monitor
DEVICES=(/dev/md*[0-9])
# Path to cache directory
CACHEDIR=/tmp/snmp-cache/mdadm
# Command to run mdadm
MDADMCMD="/sbin/mdadm"
# Command to run snmptranslate
SNMP_TRANSLATE="/usr/bin/snmptranslate"
# Define debug to log lots
# DEBUG="true"
As you can see the first line is the only one which may need to be modified for the snmpd-mdraid-connector to function correctly on a standard Gentoo Linux installation. Any MD-RAID devices that you wish to monitor should be added here. The remaining entries allow the cache directory to be relocated, the paths for the required utilities to be specified should they be installed in a non-standard location and debug mode to be activated.
Once you have configured the snmpd-mdraid-connector the cache of MD-RAID state data should be created manually using the update-mdraid-cache application, as shown below, to ensure that it works without problems.
Rebuilding cache files...done.
Assuming that everything works as expected you will want to create a cron entry to execute the update-mdraid-cache application at regular intervals. The data retrieved by the snmpd-mdraid-connector will be read from this cache so will only be updated at the interval you configure here.
The example below shows a crontab entry which would execute the update-mdraid-cache application every five minutes.
*/5 * * * * /usr/sbin/update-mdraid-cache > /dev/null
When you are sure the data collection script is indeed operating correctly the next step is to modify the SNMP daemon configuration so that it will use the snmpd-mdraid-connector script whenever it receives a request for the MD-RAID-MIB::mdRaidTable branch of the OID tree.
The example configuration entry below uses the pass_persist directive to load the snmpd-mdraid-connector script and associate it with the correct OID. This configuration directive should be added to the existing SNMPD configuration.
pass_persist .1.3.6.1.4.1.38696.2.2 /usr/sbin/snmpd-mdraid-connector
Now that we have reconfigured the SNMP daemon to use the snmpd-mdraid-connector we need to restart it so that our changes take effect.
The final step is to test that the new data is indeed available from the SNMP daemon. In the example below we can use the snmptable utility to display the complete MD-RAID-MIB::mdRaidTable for the local machine.
1 /dev/md0 0.90 e6414f84:9563e117:be6508ee:8797bbcc raid1 N/A N/A 128448 128448 true false false 4 4 4 0 0
2 /dev/md1 0.90 bb8e6b0b:e52afea6:42a5569a:f0f6d253 raid10 near=2 64K 497792 248896 true false false 4 4 4 0 0
3 /dev/md2 0.90 2c393ecb:2ce60414:4d9f5052:a44143f0 raid5 left-symmetric 64K 2987712 995904 true false false 4 4 4 0 0
4 /dev/md3 0.90 d5ddef30:6702b071:3ba102da:5f8f7fb5 raid5 left-symmetric 64K 437754816 145918272 true false false 4 4 4 0 0
As you can see in the example above the MD-RAID-MIB::mdRaidTable contains a wealth of information. For your convenience a brief description of each field is given below.
More information and a detailed description of each field can be found in the MD-RAID-MIB details section of the SNMP MIB describing MD-RAID array state documentation.