Ad Widget

Collapse

Zabbix: Additional Functionality (netflow, traffic stats)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcarbonneaux
    Member
    • Jul 2007
    • 31

    #16
    i have the same problem...

    and i think is the type of the oid where are the probleme :"Gauge32"

    because on the same equipement other oid with other type work fine...
    onlye gauge32 dont work (but work with snmpwalk shell cmd).

    and i use the same snmp version in zabbix and snmpwalk cmd...

    i used net-snmp 5.4 and zabbix 1.4.1...

    that where strange, is the returned type (81 in hex):

    # find /product/net-snmp/include/ -type f | xargs grep 81
    /product/net-snmp/include/net-snmp/library/snmp.h:#define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
    # find /product/net-snmp/include/ -type f | xargs grep 129
    /product/net-snmp/include/net-snmp/library/snmp.h:#define SNMP_VERSION_2p 129 /* no longer supported by this code (> 4.0) */
    /product/net-snmp/include/net-snmp/library/snmp.h:#define SNMP_MSG_INTERNAL_OBJECT_LOOKUP 129
    /product/net-snmp/include/net-snmp/library/snmp.h:#define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
    but i don't know why they respond this code in type field !!!!

    the debug trace of the snmp get:
    13210:20070725:000608 In get_value()
    13210:20070725:000608 In get_value_SNMP()
    13210:20070725:000608 SNMP [[email protected]:161:161]
    13210:20070725:000608 OID [.1.3.6.1.4.1.1872.2.5.4.2.5.2]
    13210:20070725:000608 In get_value_SNMP() 0.2
    13210:20070725:000608 In get_value_SNMP() 0.3
    13210:20070725:000608 Status send [0]
    13210:20070725:000608 In get_value_SNMP() 0.4
    13210:20070725:000608 In get_value_SNMP() 1
    13210:20070725:000608 In get_value_SNMP() 2
    13210:20070725:000608 AV loop()
    13210:20070725:000608 OID [.1.3.6.1.4.1.1872.2.5.4.2.5.2] value #2 has unknow type [81]
    13210:20070725:000608 End get_value()
    Last edited by mcarbonneaux; 25-07-2007, 00:28.

    Comment

    • mcarbonneaux
      Member
      • Jul 2007
      • 31

      #17
      i think the probleme is near:
      13209:20070725:000609 SNMP [[email protected]:161:161]

      in "src/zabbix_server/poller/checks_snmp.c"
      zabbix_log( LOG_LEVEL_DEBUG, "SNMP [%s@%s:%d]",
      session.community,
      session.peername,
      session.remote_port);
      only one ":" are in log format string...
      only possibility are the "session.remote_port" variable contain "161:161" or session.peername "x.x.x.x:161" !!!

      after verifying, is session.peername that containe the port...
      if(item->useip == 1)
      {
      #ifdef NEW_APPROACH
      zbx_snprintf(temp,sizeof(temp),"%s:%d",
      item->host_ip,
      item->snmp_port);
      session.peername = temp;
      session.remote_port = item->snmp_port;
      #else
      session.peername = item->host_ip;
      session.remote_port = item->snmp_port;
      #endif
      }
      else
      {
      #ifdef NEW_APPROACH
      zbx_snprintf(temp, sizeof(temp), "%s:%d",
      item->host_dns,
      item->snmp_port);
      session.peername = temp;
      session.remote_port = item->snmp_port;
      #else
      session.peername = item->host_dns;
      session.remote_port = item->snmp_port;
      #endif
      }
      because of the new approche...

      i'm not sure is ok!!! i don't masterize net-snmp lib!

      but i'm not sure to have the port in peername and remote_port at same time are ok....
      Last edited by mcarbonneaux; 25-07-2007, 00:30.

      Comment

      • mcarbonneaux
        Member
        • Jul 2007
        • 31

        #18
        i've found where is the probleme...

        when i make a snmpwalk on .1.3.6.1.4.1.1872.2.5.4.2.5.2 return:
        .1.3.6.1.4.1.1872.2.5.4.2.5.2.0 = Gauge32: 1318
        but when snmpget on the same OID return:
        .1.3.6.1.4.1.1872.2.5.4.2.5.2 = No Such Instance currently exists at this OID

        in fact the walk, walk throug the hierachy...
        the correct oid are: .1.3.6.1.4.1.1872.2.5.4.2.5.2.0
        and work fine...


        to ameliorate the error logging for this type of probleme i suggest to add similar peace of code like that (extract from print_variable net-snmp code "snmplib/mib.c")

        if (variable->type == SNMP_NOSUCHOBJECT) {
        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
        (const u_char *)
        "No Such Object available on this agent at this OID");
        } else if (variable->type == SNMP_NOSUCHINSTANCE) {
        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
        (const u_char *)
        "No Such Instance currently exists at this OID");
        } else if (variable->type == SNMP_ENDOFMIBVIEW) {
        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
        (const u_char *)
        "No more variables left in this MIB View (It is past the end of the MIB tree)");
        in place of sending unknown type ...

        seem to be more user friendly!

        Comment

        • mcarbonneaux
          Member
          • Jul 2007
          • 31

          #19
          one little patch to correct this probleme plus two other i've found...


          Code:
          diff -u -r zabbix-1.4.1/src/zabbix_server/poller/checks_external.c zabbix-1.4.1-patched/src/zabbix_server/poller/checks_external.c
          --- zabbix-1.4.1/src/zabbix_server/poller/checks_external.c     2007-06-29 22:50:26.000000000 +0200
          +++ zabbix-1.4.1-patched/src/zabbix_server/poller/checks_external.c     2007-07-20 02:14:58.000000000 +0200
          @@ -56,22 +56,22 @@
                  init_result(result);
          
                  strscpy(key, item->key);
          -       if((p2=strstr(key,"(")) != NULL)
          +       if((p2=strstr(key,"[")) != NULL)
                  {
                          *p2=0;
                          strscpy(scriptname,key);
          -               *p2='(';
          +               *p2='[';
                          p2++;
                  }
                  else    ret = NOTSUPPORTED;
          
                  if(ret == SUCCEED)
                  {
          -               if((ret == SUCCEED) && (p=strstr(p2,")")) != NULL)
          +               if((ret == SUCCEED) && (p=strstr(p2,"]")) != NULL)
                          {
                                  *p=0;
                                  strscpy(params,p2);
          -                       *p=')';
          +                       *p=']';
                                  p++;
                          }
                          else    ret = NOTSUPPORTED;
          @@ -84,7 +84,10 @@
                          return NOTSUPPORTED;
                  }
          
          -       zbx_snprintf(cmd, MAX_STRING_LEN-1, "%s/%s %s %s", CONFIG_EXTERNALSCRIPTS, scriptname, item->host_name, params);
          +       if (item->useip==1)
          +         zbx_snprintf(cmd, MAX_STRING_LEN-1, "%s/%s %s %s", CONFIG_EXTERNALSCRIPTS, scriptname, item->host_ip, params);
          +       else
          +         zbx_snprintf(cmd, MAX_STRING_LEN-1, "%s/%s %s %s", CONFIG_EXTERNALSCRIPTS, scriptname, item->host_dns, params);
                  zabbix_log( LOG_LEVEL_DEBUG, cmd );
                  if (NULL == (fp = popen(cmd, "r")))
                  {
          diff -u -r zabbix-1.4.1/src/zabbix_server/poller/checks_simple.c zabbix-1.4.1-patched/src/zabbix_server/poller/checks_simple.c
          --- zabbix-1.4.1/src/zabbix_server/poller/checks_simple.c       2007-06-29 22:50:26.000000000 +0200
          +++ zabbix-1.4.1-patched/src/zabbix_server/poller/checks_simple.c       2007-07-25 02:00:30.836587875 +0200
          @@ -59,7 +59,7 @@
                                  {
                                          zbx_snprintf(c,sizeof(c),"net.tcp.service[%s,%s]",
                                                  item->key,
          -                                       item->host_ip);
          +                                       item->host_dns);
                                  }
                          }
                  }
          diff -u -r zabbix-1.4.1/src/zabbix_server/poller/checks_snmp.c zabbix-1.4.1-patched/src/zabbix_server/poller/checks_snmp.c
          --- zabbix-1.4.1/src/zabbix_server/poller/checks_snmp.c 2007-06-29 22:50:26.000000000 +0200
          +++ zabbix-1.4.1-patched/src/zabbix_server/poller/checks_snmp.c 2007-07-25 01:57:09.883471108 +0200
          @@ -113,7 +113,7 @@
                  {
                          session.community = (u_char *)item->snmp_community;
                          session.community_len = strlen((void *)session.community);
          -               zabbix_log( LOG_LEVEL_DEBUG, "SNMP [%s@%s:%d]",
          +               zabbix_log( LOG_LEVEL_DEBUG, "SNMP [%s@'%s':%d]",
                                  session.community,
                                  session.peername,
                                  session.remote_port);
          @@ -195,7 +195,7 @@
                                          return NOTSUPPORTED;
                                  }
                          }
          -               zabbix_log( LOG_LEVEL_DEBUG, "SNMPv3 [%s@%s:%d]",
          +               zabbix_log( LOG_LEVEL_DEBUG, "SNMPv3 [%s@'%s':%d]",
                                  session.securityName,
                                  session.peername,
                                  session.remote_port);
          @@ -264,6 +264,7 @@
                                  int count=1;
                                  zabbix_log( LOG_LEVEL_DEBUG, "AV loop()");
          
          +
           /*                     if(     (vars->type == ASN_INTEGER) ||*/
                                  if(     (vars->type == ASN_UINTEGER)||
                                          (vars->type == ASN_COUNTER) ||
          @@ -406,8 +407,53 @@
                                                  }
                                          }
                                  }
          +                       else if (vars->type == SNMP_NOSUCHOBJECT)
          +                       {
          +                               count++;
          +
          +                               zbx_snprintf(error,sizeof(error),"OID [%s] value #%d No Such Object available on this agent at this OID",
          +                                       item->snmp_oid,
          +                                       count);
          +
          +                               zabbix_log( LOG_LEVEL_ERR, "%s",
          +                                       error);
          +                               SET_MSG_RESULT(value, strdup(error));
          +
          +                               ret  = NOTSUPPORTED;
          +
          +                       }
          +                       else if (vars->type == SNMP_NOSUCHINSTANCE)
          +                       {
          +                               count++;
          +
          +                               zbx_snprintf(error,sizeof(error),"OID [%s] value #%d No Such Instance currently exists at this OID",
          +                                       item->snmp_oid,
          +                                       count);
          +
          +                               zabbix_log( LOG_LEVEL_ERR, "%s",
          +                                       error);
          +                               SET_MSG_RESULT(value, strdup(error));
          +
          +                               ret  = NOTSUPPORTED;
          +                       }
          +                       else if (vars->type == SNMP_ENDOFMIBVIEW)
          +                       {
          +                               count++;
          +
          +                               zbx_snprintf(error,sizeof(error),"OID [%s] value #%d No more variables left in this MIB View (It is past the end of the MIB tree)",
          +                                       item->snmp_oid,
          +                                       count);
          +
          +                               zabbix_log( LOG_LEVEL_ERR, "%s",
          +                                       error);
          +                               SET_MSG_RESULT(value, strdup(error));
          +
          +                               ret  = NOTSUPPORTED;
          +                       }
                                  else
          +
                                  {
          +
           /* count is not really used. Has to be removed */
                                          count++;
          Best Regards,
          Mathieu

          Comment

          Working...