[Reconnoiter-devel] [reconnoiter commit] r879 - trunk/src/modules

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Thu Sep 24 15:22:30 EDT 2009


Author: jesus
Date: 2009-09-24 15:22:29 -0400 (Thu, 24 Sep 2009)
New Revision: 879

Modified:
   trunk/src/modules/snmp.c
Log:
fixes #184

Modified: trunk/src/modules/snmp.c
===================================================================
--- trunk/src/modules/snmp.c	2009-09-24 19:03:33 UTC (rev 878)
+++ trunk/src/modules/snmp.c	2009-09-24 19:22:29 UTC (rev 879)
@@ -679,6 +679,7 @@
   snmp_mod_config_t *conf;
   const char *community = NULL;
   stats_t current;
+  int success = 0;
 
   /* parsing destination */
   char uuid_str[UUID_STR_LEN + 1];
@@ -735,9 +736,20 @@
   /* We have a check. The trap is authorized. Now, extract everything. */
   memset(&current, 0, sizeof(current));
   gettimeofday(&current.whence, NULL);
+  current.available = NP_AVAILABLE;
 
   for(; var != NULL; var = var->next_variable)
-    noit_snmp_trapvars_to_stats(&current, var);
+    if(noit_snmp_trapvars_to_stats(&current, var) == 0) success++;
+  if(success) {
+    char buff[24];
+    snprintf(buff, sizeof(buff), "%d datum", success);
+    current.state = NP_GOOD;
+    current.status = strdup(buff);
+  }
+  else {
+    current.state = NP_BAD;
+    current.status = strdup("no data");
+  }
   noit_check_set_stats(ts->self, check, &current);
 
  cleanup:



More information about the Reconnoiter-devel mailing list