2007-07-20 Sancho Lerena <slerena@artica.es>
* pandora_network.pl: Fixed a typo in pandora_ping_latency function. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@572 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
81b1cebe61
commit
373a98a350
|
@ -1,3 +1,7 @@
|
||||||
|
2007-07-20 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
* pandora_network.pl: Fixed a typo in pandora_ping_latency function.
|
||||||
|
|
||||||
2007-07-19 Sancho Lerena <slerena@artica.es>
|
2007-07-19 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* bin/pandora_DBI_test.pl: This is in /util and shound not be there.
|
* bin/pandora_DBI_test.pl: This is in /util and shound not be there.
|
||||||
|
|
|
@ -62,7 +62,7 @@ pandora_audit (\%pa_config, "Pandora FMS Network Daemon starting", "SYSTEM", "Sy
|
||||||
print " [*] Starting up network threads\n";
|
print " [*] Starting up network threads\n";
|
||||||
|
|
||||||
if ( $pa_config{"daemon"} eq "1" ) {
|
if ( $pa_config{"daemon"} eq "1" ) {
|
||||||
print " [*] Backgrounding Pandora FMS Network Server process.\n";
|
print " [*] Backgrounding Pandora FMS Network Server process.\n\n";
|
||||||
&daemonize;
|
&daemonize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ for (my $ax=0; $ax < $pa_config{'network_threads'}; $ax++){
|
||||||
# Launch now the network producer thread
|
# Launch now the network producer thread
|
||||||
threads->new( \&pandora_network_producer, \%pa_config);
|
threads->new( \&pandora_network_producer, \%pa_config);
|
||||||
|
|
||||||
print " [*] All threads loaded and running \n";
|
print " [*] All threads loaded and running \n\n";
|
||||||
# Last thread is the main process (this process)
|
# Last thread is the main process (this process)
|
||||||
|
|
||||||
my $dbhost = $pa_config{'dbhost'};
|
my $dbhost = $pa_config{'dbhost'};
|
||||||
|
@ -269,9 +269,12 @@ sub pandora_ping_latency {
|
||||||
my $icmp_return;
|
my $icmp_return;
|
||||||
my $icmp_reply;
|
my $icmp_reply;
|
||||||
my $icmp_ip;
|
my $icmp_ip;
|
||||||
my $nm = Net::Ping->new("icmp", $l_timeout, 32);
|
my $nm;
|
||||||
|
|
||||||
|
# Locking for use ICMP call safety
|
||||||
{
|
{
|
||||||
lock $icmp_lock;
|
lock $icmp_lock;
|
||||||
|
$nm = Net::Ping->new("icmp", $l_timeout, 16);
|
||||||
$nm->hires();
|
$nm->hires();
|
||||||
($icmp_return, $icmp_reply, $icmp_ip) = $nm->ping ($dest,$l_timeout);
|
($icmp_return, $icmp_reply, $icmp_ip) = $nm->ping ($dest,$l_timeout);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +293,7 @@ sub pandora_ping_latency {
|
||||||
# tcp_rcv, id_tipo_module, dbh)
|
# tcp_rcv, id_tipo_module, dbh)
|
||||||
# Makes a call to TCP modules to get a value.
|
# Makes a call to TCP modules to get a value.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_query_tcp (%$$$$$$$$) {
|
sub pandora_query_tcp (%$$$$$$$) {
|
||||||
my $pa_config = $_[0];
|
my $pa_config = $_[0];
|
||||||
my $tcp_port = $_[1];
|
my $tcp_port = $_[1];
|
||||||
my $ip_target = $_[2];
|
my $ip_target = $_[2];
|
||||||
|
@ -299,7 +302,6 @@ sub pandora_query_tcp (%$$$$$$$$) {
|
||||||
my $tcp_send = $_[5];
|
my $tcp_send = $_[5];
|
||||||
my $tcp_rcv = $_[6];
|
my $tcp_rcv = $_[6];
|
||||||
my $id_tipo_modulo = $_[7];
|
my $id_tipo_modulo = $_[7];
|
||||||
my $dbh = $_[8];
|
|
||||||
|
|
||||||
my $temp; my $temp2;
|
my $temp; my $temp2;
|
||||||
my $tam;
|
my $tam;
|
||||||
|
@ -376,16 +378,16 @@ sub pandora_query_tcp (%$$$$$$$$) {
|
||||||
# SUB pandora_query_snmp (pa_config, oid, community, target, error, dbh)
|
# SUB pandora_query_snmp (pa_config, oid, community, target, error, dbh)
|
||||||
# Makes a call to SNMP modules to get a value,
|
# Makes a call to SNMP modules to get a value,
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_query_snmp {
|
sub pandora_query_snmp (%$$$$) {
|
||||||
my $pa_config = $_[0];
|
my $pa_config = $_[0];
|
||||||
my $snmp_oid = $_[1];
|
my $snmp_oid = $_[1];
|
||||||
my $snmp_community =$_[2];
|
my $snmp_community =$_[2];
|
||||||
my $snmp_target = $_[3];
|
my $snmp_target = $_[3];
|
||||||
# $_[4] contains error var.
|
# $_[4] contains error var.
|
||||||
my $dbh = $_[5];
|
|
||||||
my $output ="";
|
my $output ="";
|
||||||
my $SESSION = new SNMP::Session (DestHost => $snmp_target,
|
my $SESSION = new SNMP::Session (DestHost => $snmp_target,
|
||||||
Timeout => $pa_config->{"networktimeout"},
|
Timeout => $pa_config->{"networktimeout"},
|
||||||
Community => $snmp_community,
|
Community => $snmp_community,
|
||||||
Version => 1);
|
Version => 1);
|
||||||
if ((!defined($SESSION))&& ($snmp_community != "") && ($snmp_oid != "")) {
|
if ((!defined($SESSION))&& ($snmp_community != "") && ($snmp_oid != "")) {
|
||||||
|
@ -497,7 +499,7 @@ sub exec_network_module {
|
||||||
} elsif ($id_tipo_modulo == 7){ # ICMP (data for latency in ms)
|
} elsif ($id_tipo_modulo == 7){ # ICMP (data for latency in ms)
|
||||||
# This module only could be executed if executed as root
|
# This module only could be executed if executed as root
|
||||||
if ($> == 0){
|
if ($> == 0){
|
||||||
pandora_ping_latency ($ip_target, $pa_config->{"networktimeout"}, \$module_data, $module_result);
|
pandora_ping_latency ($ip_target, $pa_config->{"networktimeout"}, \$module_data, \$module_result);
|
||||||
} else {
|
} else {
|
||||||
$module_result = 0; # Done but, with zero value
|
$module_result = 0; # Done but, with zero value
|
||||||
$module_data = 0; # This should don't happen
|
$module_data = 0; # This should don't happen
|
||||||
|
@ -506,11 +508,10 @@ sub exec_network_module {
|
||||||
# ------------
|
# ------------
|
||||||
} elsif (($id_tipo_modulo == 15) || ($id_tipo_modulo == 18) || ($id_tipo_modulo == 16) || ($id_tipo_modulo == 17)) { # SNMP module
|
} elsif (($id_tipo_modulo == 15) || ($id_tipo_modulo == 18) || ($id_tipo_modulo == 16) || ($id_tipo_modulo == 17)) { # SNMP module
|
||||||
if ($snmp_oid ne ""){
|
if ($snmp_oid ne ""){
|
||||||
$temp2 = pandora_query_snmp ($pa_config, $snmp_oid, $snmp_community, $ip_target, $error, $dbh);
|
$temp2 = pandora_query_snmp ($pa_config, $snmp_oid, $snmp_community, $ip_target, $error);
|
||||||
} else {
|
} else {
|
||||||
$error = 1
|
$error = 1
|
||||||
}
|
}
|
||||||
# SUB pandora_query_snmp (pa_config, oid, community, target, error, dbh)
|
|
||||||
if ($error == 0) { # A correct SNMP Query
|
if ($error == 0) { # A correct SNMP Query
|
||||||
$module_result = 0;
|
$module_result = 0;
|
||||||
# SNMP_DATA_PROC
|
# SNMP_DATA_PROC
|
||||||
|
@ -519,19 +520,16 @@ sub exec_network_module {
|
||||||
$temp2 = 0;
|
$temp2 = 0;
|
||||||
}
|
}
|
||||||
$module_data = $temp2;
|
$module_data = $temp2;
|
||||||
$module_result = 0; # Successful
|
|
||||||
}
|
}
|
||||||
# SNMP_DATA and SNMP_DATA_INC
|
# SNMP_DATA and SNMP_DATA_INC
|
||||||
elsif (($id_tipo_modulo == 15) || ($id_tipo_modulo == 16) ){
|
elsif (($id_tipo_modulo == 15) || ($id_tipo_modulo == 16) ){
|
||||||
if ($temp2 =~ /[A-Za-z\.\,\-\/\\\(\)\[\]]/){
|
if ($temp2 =~ /[A-Za-z\.\,\-\/\\\(\)\[\]]/){
|
||||||
$module_result = 1; # Alphanumeric data, not numeric
|
$module_result = 1; # Alphanumeric data, not numeric
|
||||||
} else {
|
} else {
|
||||||
$module_data = int($temp2);
|
$module_data = $temp2; # Float values are also valid
|
||||||
$module_result = 0; # Successful
|
|
||||||
}
|
}
|
||||||
} else { # String SNMP
|
} else { # String SNMP
|
||||||
$module_data = $temp2;
|
$module_data = $temp2;
|
||||||
$module_result=0;
|
|
||||||
}
|
}
|
||||||
} else { # Failed SNMP-GET
|
} else { # Failed SNMP-GET
|
||||||
$module_data = 0;
|
$module_data = 0;
|
||||||
|
@ -541,8 +539,9 @@ sub exec_network_module {
|
||||||
# ----------
|
# ----------
|
||||||
} elsif (($id_tipo_modulo == 8) || ($id_tipo_modulo == 9) || ($id_tipo_modulo == 10) || ($id_tipo_modulo == 11)) { # TCP Module
|
} elsif (($id_tipo_modulo == 8) || ($id_tipo_modulo == 9) || ($id_tipo_modulo == 10) || ($id_tipo_modulo == 11)) { # TCP Module
|
||||||
if (($tcp_port < 65536) && ($tcp_port > 0)){ # Port check
|
if (($tcp_port < 65536) && ($tcp_port > 0)){ # Port check
|
||||||
pandora_query_tcp ($pa_config, $tcp_port, $ip_target, \$module_result, \$module_data, $tcp_send, $tcp_rcv, $id_tipo_modulo, $dbh);
|
pandora_query_tcp ($pa_config, $tcp_port, $ip_target, \$module_result, \$module_data, $tcp_send, $tcp_rcv, $id_tipo_modulo);
|
||||||
} else {
|
} else {
|
||||||
|
# Invalid port, get no check
|
||||||
$module_result = 1;
|
$module_result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# if not given, it takes localhost. It's preferable to setup one
|
# if not given, it takes localhost. It's preferable to setup one
|
||||||
# because machine name could change by some reason.
|
# because machine name could change by some reason.
|
||||||
|
|
||||||
servername ulises
|
servername endor
|
||||||
|
|
||||||
# incomingdir: Defines directory where incoming data packets are stored
|
# incomingdir: Defines directory where incoming data packets are stored
|
||||||
# You could set directory relative to base path or absolute, starting with /
|
# You could set directory relative to base path or absolute, starting with /
|
||||||
|
@ -16,20 +16,21 @@ incomingdir /var/spool/pandora/data_in
|
||||||
# log_file: Main logfile for pandora_server
|
# log_file: Main logfile for pandora_server
|
||||||
# You could set file relative to base path or absolute, starting with /
|
# You could set file relative to base path or absolute, starting with /
|
||||||
|
|
||||||
log_file /var/log/pandora/pandora_server.log
|
log_file /var/log/pandora_server.log
|
||||||
|
|
||||||
# Error logfile: aux logfile for pandora_server errors (in Daemon mode)
|
# Error logfile: aux logfile for pandora_server errors (in Daemon mode)
|
||||||
# You could set file relative to base path or absolute, starting with /
|
# You could set file relative to base path or absolute, starting with /
|
||||||
|
|
||||||
errorlog_file /var/log/pandora/pandora_server.error
|
errorlog_file /var/log/pandora_server.error
|
||||||
|
|
||||||
# dbname: Database name (pandora by default
|
# dbname: Database name (pandora by default
|
||||||
|
|
||||||
dbname pandora
|
dbname pandora13
|
||||||
|
|
||||||
# dbuser: Database user name (pandora by default)
|
# dbuser: Database user name (pandora by default)
|
||||||
|
|
||||||
dbuser pandora
|
dbuser pandora
|
||||||
|
|
||||||
# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground
|
# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground
|
||||||
# this could be setup on command line with -D option
|
# this could be setup on command line with -D option
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ dbuser pandora
|
||||||
|
|
||||||
# dbpass: Database password
|
# dbpass: Database password
|
||||||
|
|
||||||
dbpass zhriopul
|
dbpass pandora
|
||||||
|
|
||||||
# dbhost: Database hostname or IP address
|
# dbhost: Database hostname or IP address
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ dbhost localhost
|
||||||
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
|
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
|
||||||
# -v in command line (verbose) or -d (debug)
|
# -v in command line (verbose) or -d (debug)
|
||||||
|
|
||||||
verbosity 0
|
verbosity 1
|
||||||
|
|
||||||
# Alert threshold
|
# Alert threshold
|
||||||
|
|
||||||
|
@ -79,16 +80,15 @@ reconserver 1
|
||||||
|
|
||||||
# Network timeout (in seconds) for timeout in network connections for Network agents
|
# Network timeout (in seconds) for timeout in network connections for Network agents
|
||||||
|
|
||||||
network_timeout 2
|
network_timeout 3
|
||||||
|
|
||||||
# Server keepalive (in seconds)
|
# Server keepalive (in seconds)
|
||||||
|
|
||||||
server_keepalive 60
|
server_keepalive 50
|
||||||
|
|
||||||
# Server Threshold: defines number of seconds of main loop (in sec)
|
# Server Threshold: defines number of seconds of main loop (in sec)
|
||||||
|
|
||||||
server_threshold 30
|
server_threshold 15
|
||||||
|
|
||||||
# Network threads for processing pararel tasks ( 5 for low-end systems (<2000 bogomips), 10-15 for high-end systems)
|
|
||||||
|
|
||||||
network_threads 5
|
network_threads 5
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
# Configurable path and filenames
|
# Configurable path and filenames
|
||||||
PANDORA_HOME="/usr/share/pandora_server"
|
PANDORA_HOME="/usr/share/pandora_server"
|
||||||
PANDORA_NETWORK_PID="/var/run/pandora/pandora_network.pid"
|
PANDORA_NETWORK_PID="/var/run/pandora/pandora_network.pid"
|
||||||
|
#PANDORA_NETWORK_PID="$PANDORA_HOME/var/pandora_network.pid"
|
||||||
|
|
||||||
# Main script
|
# Main script
|
||||||
|
|
||||||
|
@ -27,14 +28,14 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $PANDORA_HOME/bin
|
cd $PANDORA_HOME/bin
|
||||||
./pandora_network.pl $PANDORA_HOME -D
|
nohup ./pandora_network.pl $PANDORA_HOME -D 2> /dev/null
|
||||||
MYPID=`ps aux | grep 'pandora_network.pl' | grep -v grep | tail -1 | awk '{print $2}'`
|
MYPID=`ps aux | grep 'pandora_network.pl' | grep -v grep | tail -1 | awk '{print $2}'`
|
||||||
if [ ! -z "$MYPID" ]
|
if [ ! -z "$MYPID" ]
|
||||||
then
|
then
|
||||||
echo $MYPID > $PANDORA_NETWORK_PID
|
echo $MYPID > $PANDORA_NETWORK_PID
|
||||||
echo "Pandora Network Server is now running with PID $MYPID"
|
echo "Pandora Network Server is now running with PID $MYPID"
|
||||||
else
|
else
|
||||||
echo "Cannot start Pandora FMS Network Server. Aborted."
|
echo "Cannot start Pandora FMS Network Server. Aborted"
|
||||||
fi
|
fi
|
||||||
cd "$OLD_PATH"
|
cd "$OLD_PATH"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
# Configurable path and filenames
|
# Configurable path and filenames
|
||||||
PANDORA_HOME="/usr/share/pandora_server"
|
PANDORA_HOME="/usr/share/pandora_server"
|
||||||
PANDORA_PID="/var/run/pandora/pandora_recon.pid"
|
PANDORA_PID="/var/run/pandora/pandora_recon.pid"
|
||||||
|
#PANDORA_PID="$PANDORA_HOME/var/pandora_recon.pid"
|
||||||
|
|
||||||
# Main script
|
# Main script
|
||||||
|
|
||||||
|
@ -30,7 +31,8 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $PANDORA_HOME/bin
|
cd $PANDORA_HOME/bin
|
||||||
./pandora_recon.pl $PANDORA_HOME -D
|
nohup ./pandora_recon.pl $PANDORA_HOME &
|
||||||
|
sleep 1
|
||||||
MYPID=`ps aux | grep 'pandora_recon.pl' | grep -v grep | tail -1 | awk '{print $2}'`
|
MYPID=`ps aux | grep 'pandora_recon.pl' | grep -v grep | tail -1 | awk '{print $2}'`
|
||||||
if [ ! -z "$MYPID" ]
|
if [ ! -z "$MYPID" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
# Configurable path and filenames
|
# Configurable path and filenames
|
||||||
PANDORA_HOME="/usr/share/pandora_server"
|
PANDORA_HOME="/usr/share/pandora_server"
|
||||||
PANDORA_SERVER_PID="/var/run/pandora/pandora_server.pid"
|
PANDORA_SERVER_PID="/var/run/pandora/pandora_server.pid"
|
||||||
|
#PANDORA_SERVER_PID="$PANDORA_HOME/var/pandora_server.pid"
|
||||||
|
|
||||||
# Main script
|
# Main script
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue