diff options
-rw-r--r-- | src/bsnmp-regex.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/bsnmp-regex.c b/src/bsnmp-regex.c index 4792d77..12950b7 100644 --- a/src/bsnmp-regex.c +++ b/src/bsnmp-regex.c @@ -23,7 +23,7 @@ #include "regex_oid.h" #define DEFAULT_CONFIG CONF_PREFIX "/rrdbot" -#define DEFAULT_FIFO "/var/run/snmp-regex.fifo" /* TODO: Configure this properly */ +#define DEFAULT_FIFO "/var/run/snmp-regex.fifo" /* our module handle */ static struct lmodule *module; @@ -934,10 +934,14 @@ op_regexentry (struct snmp_context *ctx, struct snmp_value *value, return (string_get (value, data->descr, -1)); case LEAF_regexLast: - ticks = getcurrticks (); - if (ticks == 0) - return SNMP_ERR_GENERR; - value->v.uint32 = (ticks - data->last_update); + if (data->last_update) { + ticks = getcurrticks (); + if (ticks == 0) + return SNMP_ERR_GENERR; + value->v.uint32 = (ticks - data->last_update); + } else { + value->v.uint32 = 0; + } break; case LEAF_regexValue: @@ -985,6 +989,9 @@ static void module_start (void) { reg_index = or_register (&oid_regex, "The MIB for regex data.", module); + + /* Initial reads */ + receive_log (fifo_fd, NULL); } /* Called, when the module is to be unloaded after it was successfully loaded */ |