Ad Widget

Collapse

snmp_normalize patch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frozen
    Junior Member
    • Nov 2008
    • 5

    #1

    snmp_normalize patch

    I'm tinkering with the snmp support in Zabbix, currently you can if you want use "OID" names for a few common "OID"'s like ifSpeed for example.

    However it's pretty simple to do this translation for any "OID" name. The code below is a replacement for the snmp_normalize function in the zabbix_server/poller/checks_snmp.c file and it will map any name "OID" to it's octal values -- well as long as it finds it in your mibs ... The code is not really tested yet since my work is not really focusing on that part but on snmp table handling.



    Code:
    static void snmp_normalize(char *buf, char *oid, int maxlen) {
    
    
            char           *current_name = NULL,
            oid             name[MAX_OID_LEN];
            size_t          name_length;
    
    
            current_name = oid;
    
            zabbix_log( LOG_LEVEL_DEBUG, "In snmp_normalize(oid:%s)",
                    current_name);
    
            if (current_name == NULL) {
               return();
            }
    
            snmp_out_toggle_options("n");
            snmp_in_toggle_options("R");
    
            if (!get_node(current_name, name, &name_length)) {
                zabbix_log( LOG_LEVEL_DEBUG,"Unknown object identifier: %s",
                   current_name);
               return();
            }
    
           snprint_objid(buf, max_len, name, name_length);
    
    
          zabbix_log( LOG_LEVEL_DEBUG, "End of snmp_normalize(result:%s)",
                    buf);
    
    
    }
    Cheers The frozen one
Working...