Ad Widget

Collapse

snmp patch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zyclonite
    Junior Member
    • Jun 2006
    • 4

    #1

    snmp patch

    /zabbix/src/zabbix_server/poller/checks_snmp.c

    Code:
    diff -Bwac checks_snmp_orig.c checks_snmp.c
    *** checks_snmp_orig.c  2006-06-09 08:42:12.000000000 +0200
    --- checks_snmp.c       2006-06-09 08:40:56.000000000 +0200
    ***************
    *** 85,92 ****
    --- 85,94 ----
            #ifdef NEW_APPROACH
                    snprintf(temp,sizeof(temp)-1,"%s:%d", item->ip, item->snmp_port);
                    session.peername = temp;
    +               session.remote_port = item->snmp_port;
            #else
                    session.peername = item->ip;
    +               session.remote_port = item->snmp_port;
            #endif
            }
            else
    ***************
    *** 94,105 ****
            #ifdef NEW_APPROACH
                    snprintf(temp, sizeof(temp)-1, "%s:%d", item->host, item->snmp_port);
                    session.peername = temp;
            #else
                    session.peername = item->host;
            #endif
            }
    
    !       if( (session.version == SNMP_VERSION_1) || (item->type == ITEM_TYPE_SNMPv2c))
            {
                    session.community = item->snmp_community;
                    session.community_len = strlen(session.community);
    --- 96,109 ----
            #ifdef NEW_APPROACH
                    snprintf(temp, sizeof(temp)-1, "%s:%d", item->host, item->snmp_port);
                    session.peername = temp;
    +               session.remote_port = item->snmp_port;
            #else
                    session.peername = item->host;
    +               session.remote_port = item->snmp_port;
            #endif
            }
    
    !       if( (session.version == SNMP_VERSION_1) || (session.version == SNMP_VERSION_2c))
            {
                    session.community = item->snmp_community;
                    session.community_len = strlen(session.community);
    ***************
    *** 211,225 ****
            zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.2");
    
            pdu = snmp_pdu_create(SNMP_MSG_GET);
    -       read_objid(item->snmp_oid, anOID, &anOID_len);
    -
    - #if OTHER_METHODS
    -       get_node("sysDescr.0", anOID, &anOID_len);
    -       read_objid(".1.3.6.1.2.1.1.1.0", anOID, &anOID_len);
    -       read_objid("system.sysDescr.0", anOID, &anOID_len);
    - #endif
    
            snmp_add_null_var(pdu, anOID, anOID_len);
            zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.3");
    
            status = snmp_synch_response(ss, pdu, &response);
    --- 215,224 ----
            zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.2");
    
            pdu = snmp_pdu_create(SNMP_MSG_GET);
    
    +       snmp_parse_oid(item->snmp_oid, anOID, &anOID_len);
            snmp_add_null_var(pdu, anOID, anOID_len);
    +
            zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.3");
    
            status = snmp_synch_response(ss, pdu, &response);
    ***************
    *** 232,241 ****
            {
    
            zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 2");
    - /*            for(vars = response->variables; vars; vars = vars->next_variable)
    -               {
    -                       print_variable(vars->name, vars->name_length, vars);
    -               }*/
    
                    for(vars = response->variables; vars; vars = vars->next_variable)
                    {
    --- 231,236 ----
    ***************
    *** 245,253 ****
      /*                    if(     (vars->type == ASN_INTEGER) ||*/
                            if(     (vars->type == ASN_UINTEGER)||
                                    (vars->type == ASN_COUNTER) ||
    - #ifdef OPAQUE_SPECIAL_TYPES
                                    (vars->type == ASN_UNSIGNED64) ||
    - #endif
                                    (vars->type == ASN_TIMETICKS) ||
                                    (vars->type == ASN_GAUGE)
                            )
    --- 240,246 ----
    hope this is "readable"... had not much time

    i tried to connect to a snmpV2c agent to get infos out of a jvm - (nondefault port 1161)

    with this patch it is possible now
  • brandy
    Junior Member
    • May 2006
    • 20

    #2
    will this be fixed in the next release?

    cheers brandy

    Comment

    • Alexei
      Founder, CEO
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2004
      • 5654

      #3
      The patch is applied with minor modifications. Not tested on UCD_SNMP yet!
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      • sauron
        Senior Member
        • Jan 2005
        • 215

        #4
        Originally posted by Alexei
        The patch is applied with minor modifications. Not tested on UCD_SNMP yet!
        UCD-SNMP dead and not mantained. It's still need ?

        Comment

        • Alexei
          Founder, CEO
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2004
          • 5654

          #5
          Originally posted by sauron
          UCD-SNMP dead and not mantained. It's still need ?
          Well, if one uses older OS (like 5 years old Linux distros) then answer is Yes
          Alexei Vladishev
          Creator of Zabbix, Product manager
          New York | Tokyo | Riga
          My Twitter

          Comment

          Working...