Compile snmp-swraid
apt-get install -y git make build-essential libsnmp-dev export GIT_SSL_NO_VERIFY=true git clone https://github.com/jrossi/snmp-swraid.git /tmp/snmp-swraid cd /tmp/snmp-swraid make tar cjf snmp-swraid.ubuntu-$(lsb_release -sr).tar.bz2 SWRAID-MIB.txt swRaidPlugin.so # install apt-get install -y snmpd snmp-mibs-downloader wget -q http://dl.panticz.de/snmp-swraid/snmp-swraid.ubuntu-$(lsb_release -sr).tar.bz2 -O /tmp/snmp-swraid.ubuntu.tar.bz2 tar xjf /tmp/snmp-swraid.ubuntu.tar.bz2 -C /tmp cp /tmp/SWRAID-MIB.txt $(find /var/lib -name ietf) cp /tmp/swRaidPlugin.so /usr/lib echo "dlmod swRaidMIB /usr/lib/swRaidPlugin.so" >> /etc/snmp/snmpd.conf service snmpd restart # snmpwalk -v1 -c public -m+SWRAID-MIB localhost swRaidMIB SWRAID-MIB::swRaidIndex.1 = INTEGER: 1 SWRAID-MIB::swRaidDevice.1 = STRING: md0 SWRAID-MIB::swRaidPersonality.1 = STRING: raid1 SWRAID-MIB::swRaidUnits.1 = STRING: sdb1[1] sda1[0] SWRAID-MIB::swRaidUnitCount.1 = INTEGER: 2 SWRAID-MIB::swRaidStatus.1 = INTEGER: active(2) SWRAID-MIB::swRaidErrorFlag.0 = INTEGER: 0 SWRAID-MIB::swRaidErrMessage.0 = STRING: # snmpwalk -v2c -c public backup.example.com .1.3.6.1.4.1.2021.13.18 iso.3.6.1.4.1.2021.13.18.1.1.1.1 = INTEGER: 1 iso.3.6.1.4.1.2021.13.18.1.1.2.1 = STRING: "md127" iso.3.6.1.4.1.2021.13.18.1.1.3.1 = STRING: "raid1" iso.3.6.1.4.1.2021.13.18.1.1.4.1 = STRING: "sda1[0] sdb1[1](F)" iso.3.6.1.4.1.2021.13.18.1.1.5.1 = INTEGER: 2 iso.3.6.1.4.1.2021.13.18.1.1.6.1 = INTEGER: 3 iso.3.6.1.4.1.2021.13.18.100.0 = INTEGER: 1 iso.3.6.1.4.1.2021.13.18.101.0 = STRING: "Failed RAID devices: md127 " # enable remote access sed -i 's|127.0.0.1||g' /etc/snmp/snmpd.conf sed -i 's|default.*-V.*systemonly||g' /etc/snmp/snmpd.conf service snmpd restart
Example failed raid1 device
$ snmpwalk -v1 -c public -m+SWRAID-MIB host1.example.com swRaidMIB SWRAID-MIB::swRaidIndex.1 = INTEGER: 1 SWRAID-MIB::swRaidDevice.1 = STRING: md127 SWRAID-MIB::swRaidPersonality.1 = STRING: raid1 SWRAID-MIB::swRaidUnits.1 = STRING: sdb1[1](F) sda1[0] SWRAID-MIB::swRaidUnitCount.1 = INTEGER: 2 SWRAID-MIB::swRaidStatus.1 = INTEGER: faulty(3) SWRAID-MIB::swRaidErrorFlag.0 = INTEGER: 1 SWRAID-MIB::swRaidErrMessage.0 = STRING: Failed RAID devices: md127
CISCO switch
https://mlkushan.blogspot.com/2019/08/run-snmpwalk-on-cisco-switch-from.html
snmpwalk -v2c -c 'PASS1234' ${SWITCH_IP} 1.3.6.1.2.1.2
Links
https://wiki.opennms.org/wiki/Linux_Mdadm_monitoring_thru_snmp
https://github.com/jrossi/snmp-swraid