2010-10-22 Sancho Lerena <slerena@artica.es>
* Config.pm: Parsing for mta_from doesn't remove blanks, allowing to use a Normal name + Email address in the from. * Tools.pm: Email output is parsed with a html decode first. Added timeticks option for tools (intented to use in the future). * pandora_server.conf: Example of usage in the mta_from with a fully composed email address. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3452 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
55a163cd6f
commit
3061c82873
|
@ -1,3 +1,14 @@
|
|||
2010-10-22 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* Config.pm: Parsing for mta_from doesn't remove blanks, allowing to
|
||||
use a Normal name + Email address in the from.
|
||||
|
||||
* Tools.pm: Email output is parsed with a html decode first.
|
||||
Added timeticks option for tools (intented to use in the future).
|
||||
|
||||
* pandora_server.conf: Example of usage in the mta_from with a fully
|
||||
composed email address.
|
||||
|
||||
2010-10-22 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* lib/PandoraFMS/NetworkServer.pm: Deleted Solaris specific SNMPGET
|
||||
|
|
|
@ -190,7 +190,7 @@ mta_address localhost
|
|||
|
||||
# mta_from Email address that sends the mail, by default is pandora@localhost
|
||||
# probably you need to change it to avoid problems with your antispam
|
||||
#mta_from pandora@sampledomain.com
|
||||
#mta_from Pandora FMS <pandora@mydomain.com>
|
||||
|
||||
# xprobe2: Optional package to detect OS types using advanced TCP/IP
|
||||
# fingerprinting tecniques, much more accurates than stadard nmap.
|
||||
|
|
|
@ -376,7 +376,7 @@ sub pandora_load_config {
|
|||
$pa_config->{'mta_auth'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^mta_from\s(.*)/i) {
|
||||
$pa_config->{'mta_from'}= clean_blank($1);
|
||||
$pa_config->{'mta_from'}= $1;
|
||||
}
|
||||
elsif ($parametro =~ m/^snmp_logfile\s(.*)/i) {
|
||||
$pa_config->{'snmp_logfile'}= clean_blank($1);
|
||||
|
@ -570,7 +570,6 @@ sub pandora_load_config {
|
|||
}
|
||||
} # end of loop for parameter #
|
||||
|
||||
|
||||
if (($pa_config->{"verbosity"} > 4) && ($pa_config->{"quiet"} == 0)){
|
||||
if ($pa_config->{"PID"} ne ""){
|
||||
print " [*] PID File is written at ".$pa_config->{'PID'}."\n";
|
||||
|
|
|
@ -21,8 +21,11 @@ use warnings;
|
|||
use Time::Local;
|
||||
use POSIX qw(setsid strftime);
|
||||
use POSIX;
|
||||
use PandoraFMS::Sendmail; # New in 2.0. Used to sendmail internally, without external scripts
|
||||
#use Module::Loaded;
|
||||
use PandoraFMS::Sendmail;
|
||||
use HTML::Entities;
|
||||
|
||||
# New in 3.2. Used to sendmail internally, without external scripts
|
||||
# use Module::Loaded;
|
||||
|
||||
# Used to calculate the MD5 checksum of a string
|
||||
use constant MOD232 => 2**32;
|
||||
|
@ -55,6 +58,7 @@ our @EXPORT = qw(
|
|||
md5_init
|
||||
pandora_ping
|
||||
pandora_ping_latency
|
||||
ticks_totime
|
||||
);
|
||||
|
||||
##########################################################################
|
||||
|
@ -166,15 +170,15 @@ sub pandora_daemonize {
|
|||
##########################################################################
|
||||
|
||||
sub pandora_sendmail {
|
||||
|
||||
#WARNING: To use MTA Auth is needed v0.79_16 or higer of Mail:Sendmail
|
||||
#http://cpansearch.perl.org/src/MIVKOVIC/Mail-Sendmail-0.79_16/Sendmail.pm
|
||||
|
||||
my $pa_config = $_[0];
|
||||
my $to_address = $_[1];
|
||||
my $subject = $_[2];
|
||||
my $message = $_[3];
|
||||
|
||||
$subject = decode_entities ($subject);
|
||||
$message = decode_entities ($message);
|
||||
|
||||
my %mail = ( To => $to_address,
|
||||
Message => $message,
|
||||
Subject => $subject,
|
||||
|
@ -192,7 +196,9 @@ sub pandora_sendmail {
|
|||
return;
|
||||
} else {
|
||||
logger ($pa_config, "[ERROR] Sending email to $to_address with subject $subject", 1);
|
||||
logger ($pa_config, "ERROR Code: $Mail::Sendmail::error", 5);
|
||||
if (defined($Mail::Sendmail::error)){
|
||||
logger ($pa_config, "ERROR Code: $Mail::Sendmail::error", 5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -551,6 +557,32 @@ sub free_mem {
|
|||
return $free_mem;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## SUB ticks_totime
|
||||
# Transform a snmp timeticks count in a date
|
||||
##########################################################################
|
||||
|
||||
sub ticks_totime ($){
|
||||
|
||||
# Calculate ticks per second, minute, hour, and day
|
||||
my $TICKS_PER_SECOND = 100;
|
||||
my $TICKS_PER_MINUTE = $TICKS_PER_SECOND * 60;
|
||||
my $TICKS_PER_HOUR = $TICKS_PER_MINUTE * 60;
|
||||
my $TICKS_PER_DAY = $TICKS_PER_HOUR * 24;
|
||||
|
||||
my $ticks = shift;
|
||||
|
||||
if (!defined($ticks)){
|
||||
return "";
|
||||
}
|
||||
|
||||
my $seconds = int($ticks / $TICKS_PER_SECOND) % 60;
|
||||
my $minutes = int($ticks / $TICKS_PER_MINUTE) % 60;
|
||||
my $hours = int($ticks / $TICKS_PER_HOUR) % 24;
|
||||
my $days = int($ticks / $TICKS_PER_DAY);
|
||||
|
||||
return "$days days, $hours hours, $minutes minutes, $seconds seconds";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
=head2 C<< pandora_ping (I<$pa_config>, I<$host>) >>
|
||||
|
|
Loading…
Reference in New Issue