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
76cebed967
commit
d467ba8ac5
|
@ -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>
|
||||
|
||||
* 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";
|
||||
|
||||
if ( $pa_config{"daemon"} eq "1" ) {
|
||||
print " [*] Backgrounding Pandora FMS Network Server process.\n";
|
||||
print " [*] Backgrounding Pandora FMS Network Server process.\n\n";
|
||||
&daemonize;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ for (my $ax=0; $ax < $pa_config{'network_threads'}; $ax++){
|
|||
# Launch now the network producer thread
|
||||
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)
|
||||
|
||||
my $dbhost = $pa_config{'dbhost'};
|
||||
|
@ -269,9 +269,12 @@ sub pandora_ping_latency {
|
|||
my $icmp_return;
|
||||
my $icmp_reply;
|
||||
my $icmp_ip;
|
||||
my $nm = Net::Ping->new("icmp", $l_timeout, 32);
|
||||
my $nm;
|
||||
|
||||
# Locking for use ICMP call safety
|
||||
{
|
||||
lock $icmp_lock;
|
||||
$nm = Net::Ping->new("icmp", $l_timeout, 16);
|
||||
$nm->hires();
|
||||
($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)
|
||||
# Makes a call to TCP modules to get a value.
|
||||
##########################################################################
|
||||
sub pandora_query_tcp (%$$$$$$$$) {
|
||||
sub pandora_query_tcp (%$$$$$$$) {
|
||||
my $pa_config = $_[0];
|
||||
my $tcp_port = $_[1];
|
||||
my $ip_target = $_[2];
|
||||
|
@ -299,7 +302,6 @@ sub pandora_query_tcp (%$$$$$$$$) {
|
|||
my $tcp_send = $_[5];
|
||||
my $tcp_rcv = $_[6];
|
||||
my $id_tipo_modulo = $_[7];
|
||||
my $dbh = $_[8];
|
||||
|
||||
my $temp; my $temp2;
|
||||
my $tam;
|
||||
|
@ -376,13 +378,13 @@ sub pandora_query_tcp (%$$$$$$$$) {
|
|||
# SUB pandora_query_snmp (pa_config, oid, community, target, error, dbh)
|
||||
# Makes a call to SNMP modules to get a value,
|
||||
##########################################################################
|
||||
sub pandora_query_snmp {
|
||||
sub pandora_query_snmp (%$$$$) {
|
||||
my $pa_config = $_[0];
|
||||
my $snmp_oid = $_[1];
|
||||
my $snmp_community =$_[2];
|
||||
my $snmp_target = $_[3];
|
||||
# $_[4] contains error var.
|
||||
my $dbh = $_[5];
|
||||
|
||||
my $output ="";
|
||||
my $SESSION = new SNMP::Session (DestHost => $snmp_target,
|
||||
Timeout => $pa_config->{"networktimeout"},
|
||||
|
@ -497,7 +499,7 @@ sub exec_network_module {
|
|||
} elsif ($id_tipo_modulo == 7){ # ICMP (data for latency in ms)
|
||||
# This module only could be executed if executed as root
|
||||
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 {
|
||||
$module_result = 0; # Done but, with zero value
|
||||
$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
|
||||
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 {
|
||||
$error = 1
|
||||
}
|
||||
# SUB pandora_query_snmp (pa_config, oid, community, target, error, dbh)
|
||||
if ($error == 0) { # A correct SNMP Query
|
||||
$module_result = 0;
|
||||
# SNMP_DATA_PROC
|
||||
|
@ -519,19 +520,16 @@ sub exec_network_module {
|
|||
$temp2 = 0;
|
||||
}
|
||||
$module_data = $temp2;
|
||||
$module_result = 0; # Successful
|
||||
}
|
||||
# SNMP_DATA and SNMP_DATA_INC
|
||||
elsif (($id_tipo_modulo == 15) || ($id_tipo_modulo == 16) ){
|
||||
if ($temp2 =~ /[A-Za-z\.\,\-\/\\\(\)\[\]]/){
|
||||
$module_result = 1; # Alphanumeric data, not numeric
|
||||
} else {
|
||||
$module_data = int($temp2);
|
||||
$module_result = 0; # Successful
|
||||
$module_data = $temp2; # Float values are also valid
|
||||
}
|
||||
} else { # String SNMP
|
||||
$module_data = $temp2;
|
||||
$module_result=0;
|
||||
}
|
||||
} else { # Failed SNMP-GET
|
||||
$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
|
||||
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 {
|
||||
# Invalid port, get no check
|
||||
$module_result = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# if not given, it takes localhost. It's preferable to setup one
|
||||
# because machine name could change by some reason.
|
||||
|
||||
servername ulises
|
||||
servername endor
|
||||
|
||||
# incomingdir: Defines directory where incoming data packets are stored
|
||||
# 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
|
||||
# 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)
|
||||
# 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 pandora
|
||||
dbname pandora13
|
||||
|
||||
# dbuser: Database user name (pandora by default)
|
||||
|
||||
dbuser pandora
|
||||
|
||||
# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground
|
||||
# this could be setup on command line with -D option
|
||||
|
||||
|
@ -37,7 +38,7 @@ dbuser pandora
|
|||
|
||||
# dbpass: Database password
|
||||
|
||||
dbpass zhriopul
|
||||
dbpass pandora
|
||||
|
||||
# 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)
|
||||
# -v in command line (verbose) or -d (debug)
|
||||
|
||||
verbosity 0
|
||||
verbosity 1
|
||||
|
||||
# Alert threshold
|
||||
|
||||
|
@ -79,16 +80,15 @@ reconserver 1
|
|||
|
||||
# Network timeout (in seconds) for timeout in network connections for Network agents
|
||||
|
||||
network_timeout 2
|
||||
network_timeout 3
|
||||
|
||||
# Server keepalive (in seconds)
|
||||
|
||||
server_keepalive 60
|
||||
server_keepalive 50
|
||||
|
||||
# Server Threshold: defines number of seconds of main loop (in sec)
|
||||
|
||||
server_threshold 30
|
||||
|
||||
# Network threads for processing pararel tasks ( 5 for low-end systems (<2000 bogomips), 10-15 for high-end systems)
|
||||
server_threshold 15
|
||||
|
||||
network_threads 5
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
# Configurable path and filenames
|
||||
PANDORA_HOME="/usr/share/pandora_server"
|
||||
PANDORA_NETWORK_PID="/var/run/pandora/pandora_network.pid"
|
||||
#PANDORA_NETWORK_PID="$PANDORA_HOME/var/pandora_network.pid"
|
||||
|
||||
# Main script
|
||||
|
||||
|
@ -27,14 +28,14 @@ case "$1" in
|
|||
fi
|
||||
|
||||
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}'`
|
||||
if [ ! -z "$MYPID" ]
|
||||
then
|
||||
echo $MYPID > $PANDORA_NETWORK_PID
|
||||
echo "Pandora Network Server is now running with PID $MYPID"
|
||||
else
|
||||
echo "Cannot start Pandora FMS Network Server. Aborted."
|
||||
echo "Cannot start Pandora FMS Network Server. Aborted"
|
||||
fi
|
||||
cd "$OLD_PATH"
|
||||
;;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# Configurable path and filenames
|
||||
PANDORA_HOME="/usr/share/pandora_server"
|
||||
PANDORA_PID="/var/run/pandora/pandora_recon.pid"
|
||||
#PANDORA_PID="$PANDORA_HOME/var/pandora_recon.pid"
|
||||
|
||||
# Main script
|
||||
|
||||
|
@ -30,7 +31,8 @@ case "$1" in
|
|||
fi
|
||||
|
||||
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}'`
|
||||
if [ ! -z "$MYPID" ]
|
||||
then
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# Configurable path and filenames
|
||||
PANDORA_HOME="/usr/share/pandora_server"
|
||||
PANDORA_SERVER_PID="/var/run/pandora/pandora_server.pid"
|
||||
#PANDORA_SERVER_PID="$PANDORA_HOME/var/pandora_server.pid"
|
||||
|
||||
# Main script
|
||||
|
||||
|
|
Loading…
Reference in New Issue