Ad Widget

Collapse

OSPF neighbors monitoring.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mschedrin
    Senior Member
    • Jun 2009
    • 179

    #1

    OSPF neighbors monitoring.

    I am trying to configure monitoring of ospf peers on several my router via snmp. When session is up I can get all information via snmp:
    Code:
    root@zabbix-main-64:~# snmp ip-addr 1.3.6.1.2.1.14.10.1.6.256.256.144.18.0
    iso.3.6.1.2.1.14.10.1.6.256.256.144.18.0 = INTEGER: 8
    But when interface goes down:
    Code:
    root@zabbix-main-64:~# snmp ip-addr 1.3.6.1.2.1.14.10.1.6.256.256.144.18.0
    iso.3.6.1.2.1.14.10.1.6.256.256.144.18.0 = No Such Instance currently exists at this OID
    OID does not exist any more, item becomes unsupported and I cannot trigger anything on this item. Is there any workarounds?

    Of course I can use external scripts for this check, but I am looking for more tidy solution.
    And yes, I know about https://support.zabbix.com/browse/ZBXNEXT-341
  • ktstyle
    Junior Member
    • Oct 2012
    • 6

    #2
    It's real problem. And i not understand why zabbix not have a trigger for status "Not supported".

    UP.

    Comment

    • mirddin
      Junior Member
      • Nov 2013
      • 22

      #3
      Does anybody know any workaround for this issue?

      Comment

      • mschedrin
        Senior Member
        • Jun 2009
        • 179

        #4
        Ok guys, 4 years later I will post the solution here, as zabbix still can't handle this issue properly(shame!).
        I've made a simple script called snmp-wrapper which returns proper integer value, understandable by zabbix, instead of "No Such Instance currently exists at this OID" like snmpget does. The script has been working for a couple years in my production environment and proved itself to be reliable enough.

        Configure zabbix item to use external check, thus the script. See comments in the script for more details.

        PHP Code:
        #!/usr/bin/php
        <?php
        //This is just a wrapper to snmp get query. If SNMP OID does not exist it returns specified value which will indicate a failure.
        //arguments: snmp version= 1 or 2, snmp community, IP, OID, what to return on failure
        // call from zabbix as external check: snmp-wrapper.php[snmp_version,{$SNMP_COMMUNITY},{HOST.CONN},'.1.3.6.1.4.1.8059.1.2.2.1.1.1.2.1.2.{#SNMPINDEX}',0]
        // example call from CLI: ./snmp-wrapper.php 1 community 172.27.252.60 .1.3.6.1.4.1.8059.1.2.2.1.1.1.2.1.2.1 0
        if (count($argv) < 6) exit("not enough command line arguments!\n"); 
        $snmp_ver $argv[1];
        $snmp_comm $argv[2];
        $ip $argv[3];
        $snmp_oid $argv[4];
        $return_on_fail $argv[5];

        /*//this debug will appear in zabbix log:
        $STDERR = fopen('php://stderr', 'w+');
        fwrite($STDERR, "DEBUG:$snmp_oid\n");
        echo '1';
        die;*/

        if ($snmp_ver == 1) {$ret=@snmpget($ip$snmp_comm$snmp_oid30*10000005);}
        else if (
        $snmp_ver == 2) {$ret=@snmp2_get($ip$snmp_comm$snmp_oid30*10000005);}
        else die(
        "unsupported snmp version $snmp_ver\n");
        if (!
        $ret || strlen($ret)<9) {echo $return_on_fail;}
        else {
                
        $ret substr($ret9);
                echo 
        $ret;
        }
        //var_dump($ret);
        ?>
        Last edited by mschedrin; 20-07-2016, 14:32.

        Comment

        • mschedrin
          Senior Member
          • Jun 2009
          • 179

          #5
          P.S. Go and vote for https://support.zabbix.com/browse/ZBXNEXT-1791
          if you wish to have zabbix to handle this type of checks natively, without any kludges.

          Comment

          • grmnrvs
            Member
            • Jun 2018
            • 35

            #6
            Originally posted by mschedrin
            Ok guys, 4 years later I will post the solution here, as zabbix still can't handle this issue properly(shame!).
            I've made a simple script called snmp-wrapper which returns proper integer value, understandable by zabbix, instead of "No Such Instance currently exists at this OID" like snmpget does. The script has been working for a couple years in my production environment and proved itself to be reliable enough.

            Configure zabbix item to use external check, thus the script. See comments in the script for more details.

            PHP Code:
            #!/usr/bin/php
            <?php
            //This is just a wrapper to snmp get query. If SNMP OID does not exist it returns specified value which will indicate a failure.
            //arguments: snmp version= 1 or 2, snmp community, IP, OID, what to return on failure
            // call from zabbix as external check: snmp-wrapper.php[snmp_version,{$SNMP_COMMUNITY},{HOST.CONN},'.1.3.6.1.4.1.8059.1.2.2.1.1.1.2.1.2.{#SNMPINDEX}',0]
            // example call from CLI: ./snmp-wrapper.php 1 community 172.27.252.60 .1.3.6.1.4.1.8059.1.2.2.1.1.1.2.1.2.1 0
            if (count($argv) < 6) exit("not enough command line arguments!\n");
            $snmp_ver $argv[1];
            $snmp_comm $argv[2];
            $ip $argv[3];
            $snmp_oid $argv[4];
            $return_on_fail $argv[5];

            /*//this debug will appear in zabbix log:
            $STDERR = fopen('php://stderr', 'w+');
            fwrite($STDERR, "DEBUG:$snmp_oid\n");
            echo '1';
            die;*/

            if ($snmp_ver == 1) {$ret=@snmpget($ip$snmp_comm$snmp_oid30*10000005);}
            else if (
            $snmp_ver == 2) {$ret=@snmp2_get($ip$snmp_comm$snmp_oid30*10000005);}
            else die(
            "unsupported snmp version $snmp_ver\n");
            if (!
            $ret || strlen($ret)<9) {echo $return_on_fail;}
            else {
            $ret substr($ret9);
            echo 
            $ret;
            }
            //var_dump($ret);
            ?>
            Hi can you resolve it? Because i've a similar problem with OSPF protocol over HP Switch.

            I will like to monitor when the adjacent routes are down but i can't get results... i'm using the Stephen Fritz template version 2.0 available on the next link

            These is when OSPF Neighbor State its ok.
            Click image for larger version

Name:	jfj9ew.png
Views:	3757
Size:	79.6 KB
ID:	369769

            These is when OSPF Neighbor State its down.

            Click image for larger version

Name:	vrbrpl.png
Views:	3751
Size:	74.0 KB
ID:	369770

            And these are the mistakes that I get (Items)
            The red letters says:
            SNMP error: (genError) A general failure occured
            Click image for larger version

Name:	2z7eceu.png
Views:	3717
Size:	87.9 KB
ID:	369771

            And these are the mistakes that I get (Triggers)
            The red letters says: Cannot evaluate expression: "Cannot evaluate function "Jocoli: ospfNbrState[10.0.15.1].last()": item is not supported.".
            Cannot evaluate expression: "Cannot evaluate function "Jocoli: ospfIfAdminStat[10.0.15.2].last()": item is not supported.".
            Click image for larger version

Name:	al6fwi.png
Views:	3663
Size:	51.1 KB
ID:	369772


            Any ideas about these errors?

            Thank you very much for your attention

            Comment

            Working...