From 59ddf0fb07000ad23499132a062ba60890be5118 Mon Sep 17 00:00:00 2001 From: hkosaka Date: Wed, 19 Jun 2013 09:53:28 +0000 Subject: [PATCH] 2013-05-22 Hirofumi Kosaka * pandoradb.sql: (workaround to avoid mysql's warning 'Specified key was too long; max key length is 767 bytes' (warning code=1071). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8350 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 9 +++++++++ pandora_server/FreeBSD/pandora_server.conf | 5 +++++ pandora_server/conf/pandora_server.conf.new | 5 +++++ pandora_server/lib/PandoraFMS/Config.pm | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 13 +++++++++---- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index b65e3263cd..36feb62fd4 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,12 @@ +2013-06-19 Hirofumi Kosaka + + * lib/PandoraFMS/Config.pm, + lib/PandoraFMS/Core.pm, + conf/pandora_server.conf.new, + FreeBSD/pandora_server.conf: added eMail option that make + alerts shared by all destinations (delivering in separate + mail is default as in the prior versions). + 2013-06-19 Miguel de Dios * util/pandora_xml_stress.pl: fixed the send across tentacle, now diff --git a/pandora_server/FreeBSD/pandora_server.conf b/pandora_server/FreeBSD/pandora_server.conf index 1892ae9f02..bb17649d7e 100644 --- a/pandora_server/FreeBSD/pandora_server.conf +++ b/pandora_server/FreeBSD/pandora_server.conf @@ -218,6 +218,11 @@ mta_address localhost #mta_from Pandora FMS +# Set 1 if want eMail deliver alert in separate mail (default). +# Set 0 if want eMail deliver shared mail by all destination. +mail_in_separate 1 + + # xprobe2: Optional package to detect OS types using advanced TCP/IP # fingerprinting tecniques, much more accurates than stadard nmap. # If not provided, nmap is used insted xprobe2 diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 69a24892a9..a312857a4b 100755 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -214,6 +214,11 @@ mta_address localhost #mta_from Pandora FMS +# Set 1 if want eMail deliver alert in separate mail (default). +# Set 0 if want eMail deliver shared mail by all destination. +mail_in_separate 1 + + # xprobe2: Optional package to detect OS types using advanced TCP/IP # fingerprinting tecniques, much more accurates than stadard nmap. # If not provided, nmap is used insted xprobe2 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index b861781159..2f3273106c 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -249,6 +249,8 @@ sub pandora_load_config { $pa_config->{"mta_pass"} = ''; # Introduced on 2.0 $pa_config->{"mta_auth"} = 'none'; # Introduced on 2.0 (Support LOGIN PLAIN CRAM-MD5 DIGEST-MD) $pa_config->{"mta_from"} = 'pandora@localhost'; # Introduced on 2.0 + $pa_config->{"mail_in_separate"} = 1; # 1: eMail deliver alert mail in separate mails. + # 0: eMail deliver 1 mail with all destination. # nmap for recon OS fingerprinting and tcpscan (optional) $pa_config->{"nmap"} = "/usr/bin/nmap"; @@ -405,6 +407,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^mta_from\s(.*)/i) { $pa_config->{'mta_from'}= clean_blank($1); } + elsif ($parametro =~ m/^mail_in_separate\s([0-9]*)/i) { + $pa_config->{'mail_in_separate'}= clean_blank($1); + } elsif ($parametro =~ m/^snmp_logfile\s(.*)/i) { $pa_config->{'snmp_logfile'}= clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 7e76dc5554..5237c1b428 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -843,10 +843,15 @@ sub pandora_execute_action ($$$$$$$$$;$) { $field1 = subst_alert_macros ($field1, \%macros); $field2 = subst_alert_macros ($field2, \%macros); $field3 = subst_alert_macros ($field3, \%macros); - foreach my $address (split (',', $field1)) { - # Remove blanks - $address =~ s/ +//g; - pandora_sendmail ($pa_config, $address, $field2, $field3); + if ($pa_config->{"mail_in_separate"} != 0){ + foreach my $address (split (',', $field1)) { + # Remove blanks + $address =~ s/ +//g; + pandora_sendmail ($pa_config, $address, $field2, $field3); + } + } + else { + pandora_sendmail ($pa_config, $field1, $field2, $field3); } # Pandora FMS Event