snmp plugin: csnmp_value_list_to_value: Include the OID in the log message.
authorFlorian Forster <octo@noris.net>
Wed, 19 May 2010 10:14:46 +0000 (12:14 +0200)
committerFlorian Forster <octo@noris.net>
Wed, 19 May 2010 10:14:46 +0000 (12:14 +0200)
src/snmp.c

index 96a0971..693cd89 100644 (file)
@@ -752,16 +752,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;
   }