This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Nested SNMP Query

FormerMember
FormerMember

Windows servers tend to change their interface numbering after a reboot. If you monitor the inteface operational status with snmp this might lead to a false alert after a reboot.

We monitor crosslinks between storageservers (where data get syncronized) to get notfied if the interface goes down and syncronisation would be broken. Now from time to time single storageservers have to be rebootet, e.g. due to newly installed updates. Each time this happens we have to disbale the monitor, change the OID to the new interface number and enable the monitor again. Allthough this is not a time consuming task you can bet no technican will ever remeber about it and and therefore we get false alerts.

Wouldnt it be a good idea to have nested snmp queries in IpMonitor? Windows stores the interface number in an oid called 1.3.6.1.2.1.4.20.1.2. + the interface ip address, e.g. 1.3.6.1.2.1.4.20.1.2.192.168.10.18. If you query that oid you get e.g. 3 as a numeric result. If you append this result to the oid 1.3.6.1.2.1.2.2.1.8. (IfOperStatus) (in this case 1.3.6.1.2.1.2.2.1.8.3) you get the operational status of the interface.

This applies to many other snmp monitors and devices where you know the ip address and want to monitor the interface the ip is bound to. A new snmp monitor type would solve the problem by allowing to get a value from one oid and append it to the oid you want to monitor.

Is such a feature on your todo list or is it already there and we are just blind?

Regards

Michael

  • FormerMember
    0 FormerMember

    Since there was no reply to our question we wrote perl script doing what we want.

    <-- snip -->

    use Net::SNMP;

    my $host = $ARGV[0];
    my $ip = $ARGV[1];
    my $ifnumber = "1.3.6.1.2.1.4.20.1.2.$ip";

    my ($session, $error) = Net::SNMP->session(
                    -hostname  => $host,
                    -version   => 'snmpv2c',
                    -community => 'public',
                    -port      => 161
                    );

    my $result_ifnumber = $session->get_request($ifnumber);
    my $ifoperstatus = "1.3.6.1.2.1.2.2.1.8." . $result_ifnumber->{$ifnumber};
    my $result_ifoperstatus = $session->get_request($ifoperstatus);
    # print $result_ifoperstatus->{$ifoperstatus};

    $session->close;
    exit $result_ifoperstatus->{$ifoperstatus};

    <-- snap -->

    Use this script with an external process monitor. In the Command Line Parameters field just enter the scriptname followed by the ip address of the host you want to monitor and as second parameter the ip address of the interface you want to monitor on that host:

    <file>perl.exe</file>
    <dir>C:\Perl\bin</dir>
    <params>ifoperstatus.pl 192.168.0.21 192.168.10.10</params>
    <startdir>d:\script</startdir>
    <checkenv>false</checkenv>
    <retvalue>1</retvalue>