From 15b9d59716c577cf6dc0eba2bf09d9b89753c711 Mon Sep 17 00:00:00 2001 From: ramonn Date: Mon, 4 May 2009 12:16:52 +0000 Subject: [PATCH] 2009-05-04 Ramon Novoa * lib/PandoraFMS/DB.pm: Enabled mysql_auto_reconnect. * lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm, lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Log error messages when external programs are not found. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1673 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 8 ++++++++ pandora_server/lib/PandoraFMS/DB.pm | 10 +++++++++- pandora_server/lib/PandoraFMS/NetworkServer.pm | 1 + pandora_server/lib/PandoraFMS/PluginServer.pm | 3 ++- pandora_server/lib/PandoraFMS/SNMPServer.pm | 1 + pandora_server/lib/PandoraFMS/WMIServer.pm | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index ec94a285b3..55e9312bdc 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,11 @@ +2009-05-04 Ramon Novoa + + * lib/PandoraFMS/DB.pm: Enabled mysql_auto_reconnect. + + * lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm, + lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Log + error messages when external programs are not found. + 2009-04-28 Ramon Novoa * lib/PandoraFMS/SNMPServer.pm: Disabled output from snmptrapd. diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 418436f279..d6550dc396 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -51,7 +51,15 @@ sub db_connect ($$$$$$) { my ($rdbms, $db_name, $db_host, $db_port, $db_user, $db_pass) = @_; if ($rdbms eq 'mysql') { - return DBI->connect("DBI:mysql:$db_name:$db_host:3306", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 }); + + # Connect to MySQL + my $dbh = DBI->connect("DBI:mysql:$db_name:$db_host:3306", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 }); + return undef unless defined ($dbh); + + # Enable auto reconnect + $dbh->{'mysql_auto_reconnect'} = 1; + + return $dbh; } return undef; diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm index 3758c7b6fe..8a90c203de 100644 --- a/pandora_server/lib/PandoraFMS/NetworkServer.pm +++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm @@ -51,6 +51,7 @@ sub new ($$$) { return undef unless $config->{'networkserver'} == 1; if (! -e $config->{'snmpget'}) { + logger ($config, ' [E] ' . $config->{'snmpget'} . " needed by Pandora FMS Network Server not found.", 0); print ' [E] ' . $config->{'snmpget'} . " needed by Pandora FMS Network Server not found.\n\n"; return undef; } diff --git a/pandora_server/lib/PandoraFMS/PluginServer.pm b/pandora_server/lib/PandoraFMS/PluginServer.pm index b301925283..36a7d3a12c 100644 --- a/pandora_server/lib/PandoraFMS/PluginServer.pm +++ b/pandora_server/lib/PandoraFMS/PluginServer.pm @@ -51,7 +51,8 @@ sub new ($$;$) { # Check for pandora_exec if (system($config->{'plugin_exec'} . ' > /dev/null 2>&1') != 256) { - print " [E] pandora_exec not found.\n\n"; + logger ($config, " [E] pandora_exec not found. Plugin Server not started.", 0); + print " [E] pandora_exec not found. Plugin Server not started.\n\n"; return undef; } diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index fe6089b5aa..b8668b50b2 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -48,6 +48,7 @@ sub new ($$;$) { # Start snmptrapd if (system ($config->{'snmp_trapd'} . ' -t -On -n -a -Lf ' . $config->{'snmp_logfile'} . ' -p /var/run/pandora_snmptrapd.pid -F %4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\\\n >/dev/null 2>&1') != 0) { + logger ($config, " [E] Could not start snmptrapd.\n\n", 0); print " [E] Could not start snmptrapd.\n\n"; return undef; } diff --git a/pandora_server/lib/PandoraFMS/WMIServer.pm b/pandora_server/lib/PandoraFMS/WMIServer.pm index 51ea0e6a58..da9888c0a4 100644 --- a/pandora_server/lib/PandoraFMS/WMIServer.pm +++ b/pandora_server/lib/PandoraFMS/WMIServer.pm @@ -51,6 +51,7 @@ sub new ($$;$) { # Check for a WMI client if (system ($config->{'wmi_client'} . ' > /dev/null 2>&1') != 256) { + logger ($config, ' [E] ' . $config->{'wmi_client'} . " not found. Pandora FMS WMI Server needs a DCOM/WMI client.", 0); print ' [E] ' . $config->{'wmi_client'} . " not found. Pandora FMS WMI Server needs a DCOM/WMI client.\n\n"; return undef; }