X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsnmp.c;h=1c2828c1fb2469494e84aafebb6a77d01fadcde9;hb=97addf1e406c75be500ae020635f3cb389f206e0;hp=96a0971ca4a571f6dc894b5d05f864278da8752f;hpb=0e1bb73758ac56f435e1313e6d78c4e41d53a78d;p=collectd.git diff --git a/src/snmp.c b/src/snmp.c index 96a0971c..1c2828c1 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -655,8 +655,9 @@ static int csnmp_config_add_host (oconfig_item_t *ci) if (hd->interval != 0) cb_interval.tv_sec = (time_t) hd->interval; - status = plugin_register_complex_read (cb_name, csnmp_read_host, - /* interval = */ &cb_interval, /* user_data = */ &cb_data); + status = plugin_register_complex_read (/* group = */ NULL, cb_name, + csnmp_read_host, /* interval = */ &cb_interval, + /* user_data = */ &cb_data); if (status != 0) { ERROR ("snmp plugin: Registering complex read function failed."); @@ -752,16 +753,23 @@ static value_t csnmp_value_list_to_value (struct variable_list *vl, int type, { /* We'll handle this later.. */ } -#ifdef ASN_NULL - else if (vl->type == ASN_NULL) - { - /* Don't print a warning. */ - defined = 0; - } -#endif else { - WARNING ("snmp plugin: I don't know the ASN type `%i'", (int) vl->type); + char oid_buffer[1024]; + + memset (oid_buffer, 0, sizeof (oid_buffer)); + snprint_objid (oid_buffer, sizeof (oid_buffer) - 1, + vl->name, vl->name_length); + +#ifdef ASN_NULL + if (vl->type == ASN_NULL) + INFO ("snmp plugin: OID \"%s\" is undefined (type ASN_NULL)", + oid_buffer); + else +#endif + WARNING ("snmp plugin: I don't know the ASN type \"%i\" (OID: %s)", + (int) vl->type, oid_buffer); + defined = 0; } @@ -958,7 +966,7 @@ static int csnmp_strvbcopy (char *dst, /* {{{ */ for (i = 0; i < num_chars; i++) { /* Check for control characters. */ - if ((src[i] >= 0) && (src[i] < 32)) + if ((unsigned char)src[i] < 32) return (csnmp_strvbcopy_hexstring (dst, vb, dst_size)); dst[i] = src[i]; }