I'm new to net-snmp and apologize in advance if this topic is already
covered.
But, running some recent tests I ran into this issue
http://www.mail-archive.com/[email protected]/msg08476.html
and this aspect is present in 5.5 and 5.6.pre2
what we are after for our application is modify ARGS on the fly It
seems to me that having baked in
args in snmpd.conf is far to restrictive and it would be better to
exploit the power of
extend by allowing on-the-fly updates to arguments and input just like
it was suggested
> extend PS /bin/ps
> snmpset .... hostname nsExtendArgs."PS" s "-aux"
>snmpget .... hostname nsExtendOutputFull."PS"
and it seems this can be easily fixed by allowing on-the-fly changes to
ARGS and INPUT
so I made a patch to agent/mibgroup/agent/extend.c and would like to
submit it for consideration
to include in 5.6
Perhaps there are other ways this could be accomplished by changing the
attribute to
remove the NS_EXTEND_FLAGS_CONFIG but having tested out our patch it
seems to
be working OK.
comments invited
--- net-snmp-5.6.pre2/agent/mibgroup/agent/extend.c 2010-06-16
14:34:42.000000000 -0700
+++ net-snmp-5.6.pre2.modified/agent/mibgroup/agent/extend.c 2010-07-19
08:39:52.000000000 -0700
@@ -9,6 +9,9 @@
#include "utilities/execute.h"
#include "struct.h"
+// BUILD OPTIONS
+#define DEBUG_1 1
+
#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE
#include "util_funcs/header_simple_table.h"
#include "mibdefs.h"
@@ -655,6 +658,8 @@
return SNMP_ERR_WRONGTYPE;
}
+ // allow on-the-fly modify args and input
+ #if 0
if (extension && extension->flags & NS_EXTEND_FLAGS_CONFIG) {
/*
* config entries are "permanent" so can't be changed
@@ -663,6 +668,7 @@
SNMP_ERR_NOTWRITABLE);
return SNMP_ERR_NOTWRITABLE;
}
+ #endif
break;
case COLUMN_EXTCFG_CACHETIME:
@@ -829,16 +835,35 @@
request->requestvb->val_len);
break;
case COLUMN_EXTCFG_ARGS:
- extension->old_args = extension->args;
- extension->args = netsnmp_strdup_and_null(
- request->requestvb->val.string,
- request->requestvb->val_len);
+ if (NULL != extension)
+ {
+ #if DEBUG_1
+ printf("%s old_args=%p\n", __FUNCTION__,
extension->old_args);
+ #endif
+ // free old_args
+ if (NULL != extension->old_args)
free(extension->old_args);
+ extension->old_args = extension->args;
+ extension->args = netsnmp_strdup_and_null(
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ #if DEBUG_1
+ printf("%s set new args=%s\n", __FUNCTION__,
extension->args);
+ #endif
+ }
break;
case COLUMN_EXTCFG_INPUT:
- extension->old_input = extension->input;
- extension->input = netsnmp_strdup_and_null(
- request->requestvb->val.string,
- request->requestvb->val_len);
+ if (NULL != extension)
+ {
+ #if DEBUG_1
+ printf("%s old_input=%p\n", __FUNCTION__,
extension->old_input);
+ #endif
+ // free old_input
+ if (NULL != extension->old_input)
free(extension->old_input);
+ extension->old_input = extension->input;
+ extension->input = netsnmp_strdup_and_null(
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ }
break;
case COLUMN_EXTCFG_STATUS:
i = *request->requestvb->val.integer;
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders