SNMP Monitor

转自http://www.opennms.org/index.php/SNMP_Monitor

In order to use the SNMP monitor to check out values for particular SNMP OIDs, you'll need to first configure capsd-configuration.xml to discover the service, and then configure the poller to monitor the service.

为了利用SNMP监视功能来检测SNMP OID对象的实际数值,你需要首先配置capsd-configuration.xml,然后配置要被监测的端口.

The normal SNMP plugin looks like this:

通常的SNMP插件如下所示:

        <protocol-plugin protocol="SNMP" class-name="org.opennms.netmgt.capsd.SnmpPlugin" scan="on" user-defined="false">
                <property key="timeout" value="2000"/>
                <property key="retry" value="2"/>
        </protocol-plugin>

Suppose you wanted to make sure at least one user was logged into a system at an time. You could use hrSystemNumUsers (.1.3.6.1.2.1.25.1.5.0) to test this:

假设你想要明确在某一时刻最后一个登录系统的用户,你可以使用hrSystmNumUsers(.1.3.6.1.2.1.25.1.5.0)进行如下的测试:

        <protocol-plugin protocol="NumUsers" class-name="org.opennms.netmgt.capsd.SnmpPlugin" scan="on" user-defined="false">
                <property key="timeout" value="2000"/>
                <property key="retry" value="2"/>
		<property key="vbname" value=".1.3.6.1.2.1.25.1.5.0"/>
        </protocol-plugin>

This plugin will test if the OID exists, and if so it will assign the NumUsers service to the IP address. You can also test for a specific value (vbvalue). This would be useful if there is an OID that indicates if a service is active, such as ipForwarding that indicates a device is a Router:

        <protocol-plugin protocol="Router" class-name="org.opennms.netmgt.capsd.SnmpPlugin" scan="on" user-defined="false">
                <property key="vbname" value=".1.3.6.1.2.1.4.1.0"/>
                <property key="vbvalue" value="1"/>
                <property key="timeout" value="2000"/>
                <property key="retry" value="2"/>
        </protocol-plugin>

Once the service has been discovered, a monitor can be added to poller-configuration.xml. Again, the default monitor looks like this:

                <service name="SNMP" interval="300000" user-defined="false" status="on">
                        <parameter key="retry" value="2"/>
                        <parameter key="timeout" value="3000"/>
                        <parameter key="port" value="161"/>
                        <parameter key="oid" value=".1.3.6.1.2.1.1.2.0"/>
                </service>

For the NumUsers service to see if at least one person is logged in:

                <service name="NumUsers" interval="300000" user-defined="false" status="on">
                        <parameter key="retry" value="2"/>
                        <parameter key="timeout" value="3000"/>
                        <parameter key="port" value="161"/>
                        <parameter key="oid" value=".1.3.6.1.2.1.25.1.5.0"/>
                        <parameter key="operator" value="&gt;="/>
                        <parameter key="operand" value="1"/>
                </service>

Note that there are two new parameters: operator and operand. The operator can be one of:

  • Less than: "<" (you will need to use an entity &lt;)
  • Greater than: ">" (&gt;)
  • Less than or equals: "<=" (&lt;)
  • Greater than or equals: ">=" (&gt;=)
  • Equals: "="
  • Does not equal: "!="
  • Matches regular expression: "~"

The last value is used when the OID returns a string.

Be sure to add the monitor line at the bottom of the poller-configuration.xml file when adding new monitors:

        <monitor service="NumUsers"         class-name="org.opennms.netmgt.poller.monitors.SnmpMonitor"/>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值