关闭

SNMP Monitor

901人阅读 评论(0) 收藏 举报

转自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"/>
 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:741186次
    • 积分:9458
    • 等级:
    • 排名:第2168名
    • 原创:143篇
    • 转载:309篇
    • 译文:13篇
    • 评论:82条
    最新评论