git clone https://github.com/opennms-config-modules/lsi-megaraid-storcli
The Net-SNMP agents runs as unprivileged user snmp
and isn’t allowed to run storcli
.
With creating a sudoers
file it is possible to let snmp
just run the necessary commands with sudo instead of running the whole Net-SNMP agent with root privileges.
cp snmp-extend/snmp_storcli /etc/sudoers.d/snmp_storcli
The wrapper scripts from this repository can be copied to /usr/local/bin
.
cp snmp-extend/check_storcli_disk.sh /usr/local/bin
cp snmp-extend/check_storcli_raid.sh /usr/local/bin
Note
|
You can use any other location, just make sure the extend commands and the sudoers file match your path. |
extend storcliRaid /bin/bash -c 'sudo /usr/local/bin/check_storcli_raid.sh'
extend storcliDisk /bin/bash -c 'sudo /usr/local/bin/check_storcli_disk.sh'
To enable the extend directive, the SNMP agent needs to be restarted with
systemctl restart snmpd
Test if you can request the OID from your monitoring server with:
snmpwalk -v 2c -c <your-community> <your-server> .1.3.6.1.4.1.8072.1.3.2.4.1.2.11.115.116.111.114.99.108.105.68.105.115.107.1
snmpwalk -v 2c -c <your-community> <your-server> .1.3.6.1.4.1.8072.1.3.2.4.1.2.11.115.116.111.114.99.108.105.82.97.105.100.1
Create a SNMP monitor in Pollerd with the following configuration parameters:
<service name="Storcli-Disk" interval="43200000" user-defined="true" status="on">
<parameter key="oid" value=".1.3.6.1.4.1.8072.1.3.2.4.1.2.11.115.116.111.114.99.108.105.68.105.115.107.1"/>
<parameter key="retry" value="1"/>
<parameter key="timeout" value="3000"/>
<parameter key="port" value="161"/>
<parameter key="operator" value="="/>
<parameter key="operand" value="0"/>
</service>
<service name="Storcli-Raid" interval="43200000" user-defined="true" status="on">
<parameter key="oid" value=".1.3.6.1.4.1.8072.1.3.2.4.1.2.11.115.116.111.114.99.108.105.82.97.105.100.1"/>
<parameter key="retry" value="1"/>
<parameter key="timeout" value="3000"/>
<parameter key="port" value="161"/>
<parameter key="operator" value="="/>
<parameter key="operand" value="0"/>
</service>
<monitor service="Storcli-Disk" class-name="org.opennms.netmgt.poller.monitors.SnmpMonitor"/>
<monitor service="Storcli-Raid" class-name="org.opennms.netmgt.poller.monitors.SnmpMonitor"/>
To enable the services, you have to restart OpenNMS. When OpenNMS is restarted assign the service Storcli-Disk and Storcli-Raid to an SNMP enabled IP interface of your Node in OpenNMS or use an SNMP detector for the given OIDS.