diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 5f755ae4af..0d640badaa 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -87,6 +87,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) # remote_config 1 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode # proxy_mode 1 diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index bfe673cf6c..53dd20cf4f 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -117,6 +117,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) #remote_config 1 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode # proxy_mode 1 diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index d829dfe933..3590ee6551 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -130,6 +130,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) remote_config 0 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode #proxy_mode 1 diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 29dc961d62..aa1dcb1592 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -89,6 +89,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) # remote_config 1 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode # proxy_mode 1 diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index c97d6b489f..fc55d1d872 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -136,6 +136,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) remote_config 0 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode # proxy_mode 1 diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf index e493e71850..7a47602abc 100644 --- a/pandora_agents/unix/NT4/pandora_agent.conf +++ b/pandora_agents/unix/NT4/pandora_agent.conf @@ -41,9 +41,9 @@ udp_server_auth_address 0.0.0.0 # Group assigned for this agent (descriptive, p.e: Servers) #group Servers - -# Group password (if defined). -#group_password + +# Group password (if defined). +#group_password # Autotime: Enforce to server to ignore timestamp coming from this # agent, used when agents has no timer or it's inestable. 1 to enable @@ -102,6 +102,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) remote_config 0 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # Number of threads to execute modules in parallel #agent_threads 1 diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index 6954f557e0..42d8c19a25 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -98,6 +98,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) #remote_config 1 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode #proxy_mode 1 diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index 8fe67c12d0..625bc89848 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -92,6 +92,9 @@ transfer_mode tentacle # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) #remote_config 1 +# Default 0, set to 1 to avoid module executions and report to server +# standby 1 + # If set to 1 start Drone Agent's Proxy Mode #proxy_mode 1 diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 1974d5fe75..30944cbec8 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -186,6 +186,7 @@ my %DefaultConf = ( 'xml_buffer' => 0, 'custom_id' => '', 'url_address' => '', + 'standby' => 0, ); my %Conf = %DefaultConf; @@ -1333,6 +1334,41 @@ sub check_collections () { } } +################################################################################ +# Sleep function +################################################################################ +sub sleep_agent { + my ($main_agent, $iter_base_time) = @_; + + # Sleep if main agent + if ($main_agent != 0) { + foreach my $broker_pid (@BrokerPid) { + waitpid ($broker_pid, 0); + } + + # Cron mode + exit (0) if ($Conf{'cron_mode'} == 1); + + $iter_base_time += $Conf{'intensive_interval'}; + my $now = time(); + + my $interval_remain = $iter_base_time - $now; + + if ($interval_remain >= 0) { + sleep ($interval_remain); + } else { + # don't sleep if iteraion took more than "intensive_interval" seconds + $iter_base_time = $now; # use current time as base time + } + } + # Finish if broker agent + else { + exit (0); + } + + return $iter_base_time; +} + ############################################################################### # Return the MD5 checksum of the given string as a hex string. # Pseudocode from: http://en.wikipedia.org/wiki/MD5#Pseudocode @@ -2959,6 +2995,12 @@ while (1) { } } + # Do not report to server if standby mode is enabled + if ($Conf{'standby'} eq '1' && $Conf{'debug'} ne '1') { + $iter_base_time = sleep_agent($main_agent, $iter_base_time); + next; + } + my $address; if(defined($Conf{'address'})) { @@ -3161,31 +3203,8 @@ while (1) { $SIG{'INT'} = \&udp_server_signal; } - # Sleep if main agent - if ($main_agent != 0) { - foreach my $broker_pid (@BrokerPid) { - waitpid ($broker_pid, 0); - } - - # Cron mode - last if ($Conf{'cron_mode'} == 1); - - $iter_base_time += $Conf{'intensive_interval'}; - my $now = time(); - - my $interval_remain = $iter_base_time - $now; - - if ($interval_remain >= 0) { - sleep ($interval_remain); - } else { - # don't sleep if iteraion took more than "intensive_interval" seconds - $iter_base_time = $now; # use current time as base time - } - } - # Finish if broker agent - else { - exit (0); - } + # Sleep agent function + $iter_base_time = sleep_agent($main_agent, $iter_base_time); } __END__