Can we get customizable socket support for the snmp agentx subagent? I've implemented it using a -S flag. It's useful if you need multiple subagents for monitoring multiple amavisd instances. Tested w/ Net SNMP 5.4.2.1 with multiple agents. Here's the patch:
--- /usr/sbin/amavisd-snmp-subagent 2009-10-15 17:23:36.000000000 -0700 +++ /usr/sbin/amavisd-snmp-subagent 2009-10-16 17:27:15.000000000 -0700 @@ -99,6 +99,8 @@ my($syslog_open) = 0; my($num_proc_gone) = 0; +my($agentx_socket); # e.g. "localhost:705"; + # geometic progression, rounded, # common ratio = exp((ln(60)-ln(1))/6) = 1.97860 my(@age_slots) = ( @@ -125,6 +127,7 @@ use NetSNMP::OID; use NetSNMP::ASN qw(:all); use NetSNMP::agent qw(:all); +use NetSNMP::agent::default_store qw(:all); use NetSNMP::default_store qw(:all); my(%oidstr_to_name); @@ -722,6 +725,8 @@ -f stay in foreground -d log_level debugging level, 0..5, default 0 -P pid_file a file name to receive a PID of a damonized process + -S socket agentx socket/port + default localhost:705 -D db_home_dir amavis database directory ($db_home), default AMAVISD_DB_HOME or /var/amavis/db EOD @@ -735,7 +740,7 @@ $SIG{TERM} = sub { die "terminated\n" }; # do the END code block $SIG{PIPE} = 'IGNORE'; # don't signal on a write to a widowed pipe - while (@ARGV >= 2 && $ARGV[0] =~ /^-[dDP]\z/ || + while (@ARGV >= 2 && $ARGV[0] =~ /^-[dDPS]\z/ || @ARGV >= 1 && $ARGV[0] =~ /^-[hVf-]\z/) { my($opt,$val); $opt = shift @ARGV; @@ -754,6 +759,8 @@ $db_home = untaint($val) if $val ne ''; } elsif ($opt eq '-P') { # -P pid_file $pid_filename = untaint($val) if $val ne ''; + } elsif ($opt eq '-S') { # -S agentx_socket + $agentx_socket = untaint($val) if $val ne ''; } else { die "Error in parsing command line options: $opt\n\n" . usage(); } @@ -1100,6 +1107,10 @@ #netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, # NETSNMP_DS_LIB_DONT_READ_CONFIGS, 1); + if (defined($agentx_socket)) { + netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, + NETSNMP_DS_AGENT_X_SOCKET, $agentx_socket); + } my($agent) = NetSNMP::agent->new('Name' => $agent_name, 'AgentX' => 1) or die "Can't create a SNMP agent $agent_name"; ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/