1 |
--- /usr/sbin/amavisd-snmp-subagent 2009-10-15 17:23:36.000000000 -0700 |
2 |
+++ /usr/sbin/amavisd-snmp-subagent 2009-10-16 17:27:15.000000000 -0700 |
3 |
@@ -99,6 +99,8 @@ |
4 |
my($syslog_open) = 0; |
5 |
my($num_proc_gone) = 0; |
6 |
|
7 |
+my($agentx_socket); # e.g. "localhost:705"; |
8 |
+ |
9 |
# geometic progression, rounded, |
10 |
# common ratio = exp((ln(60)-ln(1))/6) = 1.97860 |
11 |
my(@age_slots) = ( |
12 |
@@ -125,6 +127,7 @@ |
13 |
use NetSNMP::OID; |
14 |
use NetSNMP::ASN qw(:all); |
15 |
use NetSNMP::agent qw(:all); |
16 |
+use NetSNMP::agent::default_store qw(:all); |
17 |
use NetSNMP::default_store qw(:all); |
18 |
|
19 |
my(%oidstr_to_name); |
20 |
@@ -722,6 +725,8 @@ |
21 |
-f stay in foreground |
22 |
-d log_level debugging level, 0..5, default 0 |
23 |
-P pid_file a file name to receive a PID of a damonized process |
24 |
+ -S socket agentx socket/port |
25 |
+ default localhost:705 |
26 |
-D db_home_dir amavis database directory ($db_home), |
27 |
default AMAVISD_DB_HOME or /var/amavis/db |
28 |
EOD |
29 |
@@ -735,7 +740,7 @@ |
30 |
$SIG{TERM} = sub { die "terminated\n" }; # do the END code block |
31 |
$SIG{PIPE} = 'IGNORE'; # don't signal on a write to a widowed pipe |
32 |
|
33 |
- while (@ARGV >= 2 && $ARGV[0] =~ /^-[dDP]\z/ || |
34 |
+ while (@ARGV >= 2 && $ARGV[0] =~ /^-[dDPS]\z/ || |
35 |
@ARGV >= 1 && $ARGV[0] =~ /^-[hVf-]\z/) { |
36 |
my($opt,$val); |
37 |
$opt = shift @ARGV; |
38 |
@@ -754,6 +759,8 @@ |
39 |
$db_home = untaint($val) if $val ne ''; |
40 |
} elsif ($opt eq '-P') { # -P pid_file |
41 |
$pid_filename = untaint($val) if $val ne ''; |
42 |
+ } elsif ($opt eq '-S') { # -S agentx_socket |
43 |
+ $agentx_socket = untaint($val) if $val ne ''; |
44 |
} else { |
45 |
die "Error in parsing command line options: $opt\n\n" . usage(); |
46 |
} |
47 |
@@ -1100,6 +1107,10 @@ |
48 |
|
49 |
#netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, |
50 |
# NETSNMP_DS_LIB_DONT_READ_CONFIGS, 1); |
51 |
+ if (defined($agentx_socket)) { |
52 |
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, |
53 |
+ NETSNMP_DS_AGENT_X_SOCKET, $agentx_socket); |
54 |
+ } |
55 |
|
56 |
my($agent) = NetSNMP::agent->new('Name' => $agent_name, 'AgentX' => 1) |
57 |
or die "Can't create a SNMP agent $agent_name"; |