Merge branch 'features/oracle' of https://github.com/pandorafms/pandorafms into features/oracle
This commit is contained in:
commit
9bba19235e
pandora_agents
unix
win32
pandora_console
DEBIAN
extras
pandoradb_migrate_5.1_to_6.0.mysql.sqlpandoradb_migrate_5.1_to_6.0.oracle.sqlpandoradb_migrate_5.1_to_6.0.postgreSQL.sql
godmode
include
ajax
config_process.phpdb
functions.phpfunctions_agents.phpfunctions_reporting.phpfunctions_update_manager.phpoperation
pandora_console.redhat.specpandora_console.specpandoradb.data.oracle.sqlpandoradb.data.postgreSQL.sqlpandoradb_data.sqlpandora_server
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 6.0dev-150526
|
||||
Version: 6.0dev-150602
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.0dev-150526"
|
||||
pandora_version="6.0dev-150602"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
# **********************************************************************
|
||||
# Pandora FMS Generic Unix/Perl Agent
|
||||
# (c) 2009-2011 Artica Soluciones Tecnológicas
|
||||
# (c) 2009-2015 Artica Soluciones Tecnológicas
|
||||
# with the help of many people. Please see http://pandorafms.org
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
@ -12,7 +12,7 @@ pandora_agent - Pandora FMS Agent
|
|||
|
||||
=head1 VERSION
|
||||
|
||||
Version 5.0
|
||||
Version 6.0
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '6.0dev';
|
||||
use constant AGENT_BUILD => '150526';
|
||||
use constant AGENT_BUILD => '150602';
|
||||
|
||||
# Commands to retrieve total memory information in kB
|
||||
use constant TOTALMEMORY_CMDS => {
|
||||
|
@ -132,6 +132,7 @@ my %DefaultConf = (
|
|||
'encoding' => 'UTF-8',
|
||||
'server_port' => 41121,
|
||||
'transfer_mode' => 'tentacle',
|
||||
'transfer_timeout' => 30,
|
||||
'server_user' => 'pandora',
|
||||
'server_pwd' => '',
|
||||
'server_ssl' => 'no',
|
||||
|
@ -145,6 +146,7 @@ my %DefaultConf = (
|
|||
'secondary_server_path' => '/var/spool/pandora/data_in',
|
||||
'secondary_server_port' => 41121,
|
||||
'secondary_transfer_mode' => 'tentacle',
|
||||
'secondary_transfer_timeout' => 30,
|
||||
'secondary_server_user' => 'pandora',
|
||||
'secondary_server_pwd' => '',
|
||||
'secondary_server_ssl' => 'no',
|
||||
|
@ -814,29 +816,38 @@ sub send_file {
|
|||
my ($file, $secondary) = @_;
|
||||
my $output;
|
||||
|
||||
if ($Conf{'transfer_mode'} eq 'tentacle') {
|
||||
$output = `tentacle_client -v -a $Conf{'server_ip'} -p $Conf{'server_port'} $Conf{'server_opts'} "$file" 2>&1 >$DevNull`;
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ssh') {
|
||||
$output = `scp -P $Conf{'server_port'} "$file" pandora@"$Conf{'server_ip'}:$Conf{'server_path'}" 2>&1 >$DevNull`;
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ftp') {
|
||||
my $base = basename ($file);
|
||||
my $dir = dirname ($file);
|
||||
eval {
|
||||
local $SIG{'ALRM'} = sub {die};
|
||||
alarm ($Conf{'transfer_timeout'});
|
||||
if ($Conf{'transfer_mode'} eq 'tentacle') {
|
||||
$output = `tentacle_client -v -a $Conf{'server_ip'} -p $Conf{'server_port'} $Conf{'server_opts'} "$file" 2>&1 >$DevNull`;
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ssh') {
|
||||
$output = `scp -P $Conf{'server_port'} "$file" pandora@"$Conf{'server_ip'}:$Conf{'server_path'}" 2>&1 >$DevNull`;
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ftp') {
|
||||
my $base = basename ($file);
|
||||
my $dir = dirname ($file);
|
||||
|
||||
$output = `ftp -n $Conf{'server_opts'} $Conf{'server_ip'} $Conf{'server_port'} 2>&1 >$DevNull <<FEOF1
|
||||
quote USER $Conf{'server_user'}
|
||||
quote PASS $Conf{'server_pwd'}
|
||||
lcd "$dir"
|
||||
cd "$Conf{'server_path'}"
|
||||
put "$base"
|
||||
quit
|
||||
FEOF1`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'local') {
|
||||
$output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`;
|
||||
$output = `ftp -n $Conf{'server_opts'} $Conf{'server_ip'} $Conf{'server_port'} 2>&1 >$DevNull <<FEOF1
|
||||
quote USER $Conf{'server_user'}
|
||||
quote PASS $Conf{'server_pwd'}
|
||||
lcd "$dir"
|
||||
cd "$Conf{'server_path'}"
|
||||
put "$base"
|
||||
quit
|
||||
FEOF1`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'local') {
|
||||
$output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`;
|
||||
}
|
||||
alarm (0);
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
$output = "File transfer command is not responding.";
|
||||
}
|
||||
|
||||
# Get the errorlevel
|
||||
my $rc = $? >> 8;
|
||||
if ($rc != 0) {
|
||||
if ($rc != 0 || $@) {
|
||||
log_message ('error', "Error sending file '$file': $output");
|
||||
}
|
||||
|
||||
|
@ -876,6 +887,7 @@ sub swap_servers () {
|
|||
($Conf{'server_path'}, $Conf{'secondary_server_path'}) = ($Conf{'secondary_server_path'}, $Conf{'server_path'});
|
||||
($Conf{'server_port'}, $Conf{'secondary_server_port'}) = ($Conf{'secondary_server_port'}, $Conf{'server_port'});
|
||||
($Conf{'transfer_mode'}, $Conf{'secondary_transfer_mode'}) = ($Conf{'secondary_transfer_mode'}, $Conf{'transfer_mode'});
|
||||
($Conf{'transfer_timeout'}, $Conf{'secondary_transfer_timeout'}) = ($Conf{'secondary_transfer_timeout'}, $Conf{'transfer_timeout'});
|
||||
($Conf{'server_user'}, $Conf{'secondary_server_user'}) = ($Conf{'secondary_server_user'}, $Conf{'server_user'});
|
||||
($Conf{'server_pwd'}, $Conf{'secondary_server_pwd'}) = ($Conf{'secondary_server_pwd'}, $Conf{'server_pwd'});
|
||||
($Conf{'server_ssl'}, $Conf{'secondary_server_ssl'}) = ($Conf{'secondary_server_ssl'}, $Conf{'server_ssl'});
|
||||
|
@ -889,29 +901,38 @@ sub recv_file ($) {
|
|||
my $file = shift;
|
||||
my $output;
|
||||
|
||||
if ($Conf{'transfer_mode'} eq 'tentacle') {
|
||||
$output = `cd "$Conf{'temporal'}"$CmdSep tentacle_client -v -g -a $Conf{'server_ip'} -p $Conf{'server_port'} $Conf{'server_opts'} $file 2>&1 >$DevNull`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ssh') {
|
||||
$output = `scp -P $Conf{'server_port'} pandora@"$Conf{'server_ip'}:$Conf{'server_path'}/$file" $Conf{'temporal'} 2>&1 >$DevNull`;
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ftp') {
|
||||
my $base = basename ($file);
|
||||
my $dir = dirname ($file);
|
||||
eval {
|
||||
local $SIG{'ALRM'} = sub {die};
|
||||
alarm ($Conf{'transfer_timeout'});
|
||||
if ($Conf{'transfer_mode'} eq 'tentacle') {
|
||||
$output = `cd "$Conf{'temporal'}"$CmdSep tentacle_client -v -g -a $Conf{'server_ip'} -p $Conf{'server_port'} $Conf{'server_opts'} $file 2>&1 >$DevNull`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ssh') {
|
||||
$output = `scp -P $Conf{'server_port'} pandora@"$Conf{'server_ip'}:$Conf{'server_path'}/$file" $Conf{'temporal'} 2>&1 >$DevNull`;
|
||||
} elsif ($Conf{'transfer_mode'} eq 'ftp') {
|
||||
my $base = basename ($file);
|
||||
my $dir = dirname ($file);
|
||||
|
||||
$output = `ftp -n $Conf{'server_opts'} $Conf{'server_ip'} $Conf{'server_port'} 2>&1 >$DevNull <<FEOF1
|
||||
quote USER $Conf{'server_user'}
|
||||
quote PASS $Conf{'server_pwd'}
|
||||
lcd "$Conf{'temporal'}"
|
||||
cd "$Conf{'server_path'}"
|
||||
get "$file"
|
||||
quit
|
||||
FEOF1`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'local') {
|
||||
$output = `cp $Conf{'server_path'}/$file $Conf{'temporal'} 2>&1 >$DevNull`;
|
||||
$output = `ftp -n $Conf{'server_opts'} $Conf{'server_ip'} $Conf{'server_port'} 2>&1 >$DevNull <<FEOF1
|
||||
quote USER $Conf{'server_user'}
|
||||
quote PASS $Conf{'server_pwd'}
|
||||
lcd "$Conf{'temporal'}"
|
||||
cd "$Conf{'server_path'}"
|
||||
get "$file"
|
||||
quit
|
||||
FEOF1`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'local') {
|
||||
$output = `cp $Conf{'server_path'}/$file $Conf{'temporal'} 2>&1 >$DevNull`;
|
||||
}
|
||||
alarm (0);
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
$output = "File transfer command is not responding.";
|
||||
}
|
||||
|
||||
# Get the errorlevel
|
||||
my $rc = $? >> 8;
|
||||
if ($rc != 0) {
|
||||
if ($rc != 0 || $@) {
|
||||
log_message ('error', "Error retrieving file: $output");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.0dev
|
||||
%define release 150526
|
||||
%define release 150602
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.0dev
|
||||
%define release 150526
|
||||
%define release 150602
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{150526}
|
||||
{150602}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("6.0dev(Build 150526)")
|
||||
#define PANDORA_VERSION ("6.0dev(Build 150602)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(6.0dev(Build 150526))"
|
||||
VALUE "ProductVersion", "(6.0dev(Build 150602))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 6.0dev-150527
|
||||
Version: 6.0dev-150602
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.0dev-150527"
|
||||
pandora_version="6.0dev-150602"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -120,3 +120,18 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri
|
|||
-- ---------------------------------------------------------------------
|
||||
INSERT INTO `tevent_response` VALUES (6,'Ping to module agent host','Ping to the module agent host','ping -c 5 _module_address_','command',0,620,500,0,'');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplugin`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE `tplugin`
|
||||
SET `macros` = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}',
|
||||
SET `parameters` = '-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'
|
||||
WHERE `id` = 1 AND `name` = 'IPMI Plugin';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `trecon_script`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE `trecon_script` SET
|
||||
`description` = 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0',
|
||||
`macros` = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'
|
||||
WHERE `id_recon_script` = 2 AND `name` = 'IPMI Recon';
|
||||
|
|
|
@ -57,7 +57,7 @@ ALTER TABLE tusuario ADD COLUMN strict_acl NUMBER(5, 0) DEFAULT 0;
|
|||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_commands`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE talert_commands SET fields_descriptions = '[\"Destination address\",\"Subject\",\"Text\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]', fields_values = '[\"\",\"\",\"_html_editor_\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id = 1 AND name = 'eMail';
|
||||
UPDATE talert_commands SET fields_descriptions = '["Destination address","Subject","Text","","","","","","",""]', fields_values = '["\",\"\",\"_html_editor_\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id = 1 AND name = 'eMail';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig`
|
||||
|
@ -93,3 +93,19 @@ CREATE TABLE tsessions_php (
|
|||
last_active NUMBER(20, 0) NOT NULL,
|
||||
data CLOB default ''
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table tplugin
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE tplugin
|
||||
SET macros = '{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":"","hide":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":"","hide":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":"","hide":""},"4":{"macro":"_field4_","desc":"Sensor","help":"","value":"","hide":""},"5":{"macro":"_field5_","desc":"Additional Options","help":"","value":"","hide":""}}',
|
||||
SET parameters = '-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'
|
||||
WHERE id = 1 AND name = 'IPMI Plugin';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table trecon_script
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE trecon_script SET
|
||||
description = 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0',
|
||||
macros = '{"1":{"macro":"_field1_","desc":"Network","help":"i.e.: 192.168.100.0/24","value":"","hide":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":"","hide":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":"","hide":"1"},"4":{"macro":"_field4_","desc":"Additional parameters","help":"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.","value":"","hide":""}}'
|
||||
WHERE id_recon_script = 2 AND name = 'IPMI Recon';
|
||||
|
|
|
@ -91,3 +91,19 @@ CREATE TABLE "tsessions_php" (
|
|||
"last_active" INTEGER NOT NULL,
|
||||
"data" TEXT default ''
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table tplugin
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE "tplugin" SET
|
||||
"macros" = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}',
|
||||
"parameters" = '-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'
|
||||
WHERE "id" = 1 AND "name" = 'IPMI Plugin';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `trecon_script`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE "trecon_script"SET
|
||||
"description" = 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0',
|
||||
"macros" = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'
|
||||
WHERE "id_recon_script" = 2 AND "name" = 'IPMI Recon';
|
||||
|
|
|
@ -309,12 +309,12 @@ if ($create_modules) {
|
|||
$interfaces_list = array();
|
||||
foreach ($interfaces as $interface) {
|
||||
// Get the interface name, removing " " characters and avoid "blank" interfaces
|
||||
if (isset($interface['ifName']) && $interface['ifName']['value'] != "") {
|
||||
$ifname = $interface['ifName']['value'];
|
||||
}
|
||||
else if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != "") {
|
||||
if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != "") {
|
||||
$ifname = $interface['ifDescr']['value'];
|
||||
}
|
||||
else if (isset($interface['ifName']) && $interface['ifName']['value'] != "") {
|
||||
$ifname = $interface['ifName']['value'];
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ $form_filter .= "</tr>";
|
|||
|
||||
$all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
|
||||
|
||||
$groups_user = users_get_groups($config['id_user'], 'AR', $all_groups);
|
||||
$groups_user = users_get_groups($config['id_user'], 'LW', $all_groups);
|
||||
if ($groups_user === false) {
|
||||
$groups_user = array();
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ if (is_ajax ()) {
|
|||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
||||
// retruns all agents that current user has $privilege privilege for.
|
||||
$agents = agents_get_group_agents(
|
||||
array_keys (users_get_groups ($config["id_user"], $privilege, false)));
|
||||
array_keys (users_get_groups ($config["id_user"], $privilege, false)),$filter,"none",false,$recursion);
|
||||
}
|
||||
else {
|
||||
$agents = agents_get_group_agents($id_group, $filter, "none",
|
||||
|
|
|
@ -33,30 +33,30 @@ $tab = (string) get_parameter ('tab', 'massive_agents');
|
|||
$option = (string) get_parameter ('option', '');
|
||||
|
||||
$options_alerts = array(
|
||||
'add_alerts' => __('Massive alerts addition'),
|
||||
'delete_alerts' => __('Massive alerts deletion'),
|
||||
'add_action_alerts' => __('Massive alert actions addition'),
|
||||
'delete_action_alerts' => __('Massive alert actions deletion'),
|
||||
'enable_disable_alerts' => __('Massive alert enable/disable'),
|
||||
'standby_alerts' => __('Massive alert setting standby'));
|
||||
'add_alerts' => __('Bulk alert add'),
|
||||
'delete_alerts' => __('Bulk alert delete'),
|
||||
'add_action_alerts' => __('Bulk alert actions add'),
|
||||
'delete_action_alerts' => __('Bulk alert actions delete'),
|
||||
'enable_disable_alerts' => __('Bulk alert enable/disable'),
|
||||
'standby_alerts' => __('Bulk alert setting standby'));
|
||||
|
||||
$options_agents = array(
|
||||
'edit_agents' => __('Massive agents edition'),
|
||||
'delete_agents' => __('Massive agents deletion'));
|
||||
'edit_agents' => __('Bulk agent edit'),
|
||||
'delete_agents' => __('Bulk agent delete'));
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "PM")) {
|
||||
$options_users = array(
|
||||
'add_profiles' => __('Massive profiles addition'),
|
||||
'delete_profiles' => __('Massive profiles deletion'));
|
||||
'add_profiles' => __('Bulk profile add'),
|
||||
'delete_profiles' => __('Bulk profile delete'));
|
||||
}
|
||||
else {
|
||||
$options_users = array();
|
||||
}
|
||||
|
||||
$options_modules = array(
|
||||
'delete_modules' => __('Massive modules deletion'),
|
||||
'edit_modules' => __('Massive modules edition'),
|
||||
'copy_modules' => __('Massive modules copy'));
|
||||
'delete_modules' => __('Bulk module delete'),
|
||||
'edit_modules' => __('Bulk module edit'),
|
||||
'copy_modules' => __('Bulk module copy'));
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
unset($options_modules['edit_modules']);
|
||||
|
|
|
@ -99,7 +99,7 @@ if (check_acl ($config['id_user'], 0, "PM")) {
|
|||
}
|
||||
enterprise_hook('agents_submenu');
|
||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||
$sub["gmassive"]["text"] = __('Massive operations');
|
||||
$sub["gmassive"]["text"] = __('Bulk operations');
|
||||
$sub["gmassive"]["type"] = "direct";
|
||||
$sub["gmassive"]["subtype"] = "nolink";
|
||||
$sub2 = array ();
|
||||
|
|
|
@ -524,6 +524,9 @@ switch ($action) {
|
|||
break;
|
||||
default:
|
||||
if (enterprise_installed()) {
|
||||
if ($image !== null) {
|
||||
$values['image'] = $image;
|
||||
}
|
||||
enterprise_ajax_update_values($action, $type, $values);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC150527';
|
||||
$build_version = 'PC150602';
|
||||
$pandora_version = 'v6.0dev';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null) {
|
||||
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null, $new_connection = true) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -30,7 +30,11 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null,
|
|||
|
||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||
// If you want persistent connections change it to oci_pconnect().
|
||||
$connect_id = oci_new_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
|
||||
if ($new_connection)
|
||||
$connect_id = oci_new_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
|
||||
else
|
||||
$connect_id = oci_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
|
||||
|
||||
if (! $connect_id) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -464,29 +464,19 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
|||
$returnTime .= "$hours $hoursString ";
|
||||
}
|
||||
|
||||
$mins = floor($seconds / SECONDS_1MINUTE);
|
||||
$mins = floor($seconds / 60);
|
||||
|
||||
if ($mins != 0) {
|
||||
$seconds = $seconds - ($mins * SECONDS_1MINUTE);
|
||||
$seconds = $seconds - ($mins * 60);
|
||||
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours) . ':' .
|
||||
sprintf("%02d",$mins);
|
||||
}
|
||||
}
|
||||
|
||||
$seconds = (int) $seconds;
|
||||
|
||||
if ($seconds != 0) {
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$seconds $secondsString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours) . ':' .
|
||||
sprintf("%02d",$mins) . ':' .
|
||||
sprintf("%02d",$seconds);
|
||||
}
|
||||
$returnTime .= "$seconds $secondsString ";
|
||||
}
|
||||
|
||||
$return = ' ';
|
||||
|
@ -1507,7 +1497,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
|
|||
switch ($snmp3_security_level) {
|
||||
case "authNoPriv":
|
||||
$command_str = $snmpwalk_bin .
|
||||
' -m ALL -v 3' .
|
||||
' -m ALL -Oa -v 3' .
|
||||
' -u ' . escapeshellarg($snmp3_auth_user) .
|
||||
' -A ' . escapeshellarg($snmp3_auth_pass) .
|
||||
' -l ' . escapeshellarg($snmp3_security_level) .
|
||||
|
@ -1518,7 +1508,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
|
|||
break;
|
||||
case "noAuthNoPriv":
|
||||
$command_str = $snmpwalk_bin .
|
||||
' -m ALL -v 3' .
|
||||
' -m ALL -Oa -v 3' .
|
||||
' -u ' . escapeshellarg($snmp3_auth_user) .
|
||||
' -l ' . escapeshellarg($snmp3_security_level) .
|
||||
' ' . escapeshellarg($ip_target) .
|
||||
|
@ -1527,7 +1517,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
|
|||
break;
|
||||
default:
|
||||
$command_str = $snmpwalk_bin .
|
||||
' -m ALL -v 3' .
|
||||
' -m ALL -Oa -v 3' .
|
||||
' -u ' . escapeshellarg($snmp3_auth_user) .
|
||||
' -A ' . escapeshellarg($snmp3_auth_pass) .
|
||||
' -l ' . escapeshellarg($snmp3_security_level) .
|
||||
|
@ -1544,7 +1534,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
|
|||
case '2c':
|
||||
case '1':
|
||||
default:
|
||||
$command_str = $snmpwalk_bin . ' -m ALL -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir;
|
||||
$command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2386,6 +2376,17 @@ function set_unless_defined (&$var, $default) {
|
|||
}
|
||||
}
|
||||
|
||||
function set_when_empty (&$var, $default) {
|
||||
if (empty($var)) {
|
||||
$var = $default;
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function sort_by_column (&$array_ref, $column) {
|
||||
if (!empty($column)) {
|
||||
usort($array_ref, function ($a, $b) {
|
||||
|
|
|
@ -845,7 +845,8 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
|
|||
$filter[] = "(critical_count = 0 AND warning_count = 0 AND unknown_count > 0)";
|
||||
break;
|
||||
case AGENT_STATUS_NOT_NORMAL:
|
||||
$filter[] = "normal_count <> total_count";
|
||||
$filter[] = "normal_count <> total_count
|
||||
AND critical_count = 0 AND warning_count = 0";
|
||||
break;
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
$filter[] = "notinit_count = total_count";
|
||||
|
|
|
@ -747,6 +747,11 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
}
|
||||
|
||||
if (modules_is_disable_agent($sla['id_agent_module'])) {
|
||||
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3712,6 +3717,11 @@ function reporting_availability($report, $content) {
|
|||
}
|
||||
|
||||
if (modules_is_disable_agent($item['id_agent_module'])) {
|
||||
//Restore dbconnection
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3755,12 +3765,11 @@ function reporting_availability($report, $content) {
|
|||
$percent_ok = 0;
|
||||
}
|
||||
else {
|
||||
$count_fails = count(
|
||||
modules_get_data_with_value(
|
||||
$item['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
0, true));
|
||||
$count_fails = modules_get_count_data_with_value(
|
||||
$item['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
0);
|
||||
$percent_ok = (($count_checks - $count_fails) * 100) / $count_checks;
|
||||
$percent_fail = 100 - $percent_ok;
|
||||
|
||||
|
|
|
@ -497,18 +497,20 @@ function update_manager_set_current_package($current_package) {
|
|||
$token = 'current_package';
|
||||
}
|
||||
|
||||
$value = db_get_value('`value`',
|
||||
'tupdate_settings', '`key`', $token);
|
||||
$col_value = db_encapsule_fields_with_same_name_to_instructions('value');
|
||||
$col_key = db_encapsule_fields_with_same_name_to_instructions('key');
|
||||
|
||||
$value = db_get_value($col_value,
|
||||
'tupdate_settings', $col_key, $token);
|
||||
|
||||
if ($value === false) {
|
||||
db_process_sql_insert('tupdate_settings',
|
||||
array('`value`' => $current_package,
|
||||
'`key`' => $token));
|
||||
array($col_value => $current_package, $col_key => $token));
|
||||
}
|
||||
else {
|
||||
db_process_sql_update('tupdate_settings',
|
||||
array('`value`' => $current_package),
|
||||
array('`key`' => $token));
|
||||
array($col_value => $current_package),
|
||||
array($col_key => $token));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '6.0dev';
|
||||
$build = '150526';
|
||||
$build = '150602';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -304,6 +304,20 @@ switch ($sortField) {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case 'description':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastContactUp = $selected;
|
||||
$order = array('field' => 'comentarios',
|
||||
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastContactDown = $selected;
|
||||
$order = array('field' => 'comentarios',
|
||||
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$selectNameUp = $selected;
|
||||
$selectNameDown = '';
|
||||
|
@ -432,7 +446,10 @@ $table->head[0] = __('Agent'). ' ' .
|
|||
'<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
$table->size[0] = "10%";
|
||||
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[1] = __('Description'). ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=description&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=description&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
$table->size[1] = "30%";
|
||||
|
||||
$table->head[2] = __('OS'). ' ' .
|
||||
|
|
|
@ -302,17 +302,17 @@ $tag_with_temp = array();
|
|||
$tag_without_temp = array();
|
||||
foreach ($tags as $id_tag => $tag) {
|
||||
if (array_search($id_tag, $tag_with) === false) {
|
||||
$tags_select_with[$id_tag] = $tag;
|
||||
$tags_select_with[$id_tag] = ui_print_truncate_text ($tag, 16, false);
|
||||
}
|
||||
else {
|
||||
$tag_with_temp[$id_tag] = $tag;
|
||||
$tag_with_temp[$id_tag] = ui_print_truncate_text ($tag, 16, false);
|
||||
}
|
||||
|
||||
if (array_search($id_tag, $tag_without) === false) {
|
||||
$tags_select_without[$id_tag] = $tag;
|
||||
$tags_select_without[$id_tag] = ui_print_truncate_text ($tag, 16, false);
|
||||
}
|
||||
else {
|
||||
$tag_without_temp[$id_tag] = $tag;
|
||||
$tag_without_temp[$id_tag] = ui_print_truncate_text ($tag, 16, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,23 +372,13 @@ if (defined('METACONSOLE')) {
|
|||
$tabletags_without->styleTable = 'border: 0px;';
|
||||
|
||||
$data = array();
|
||||
if (!defined("METACONSOLE"))
|
||||
$data[0] = html_print_select ($tags_select_without, 'select_without', '', '', '', 0,
|
||||
true, true, true, '', false, 'width: 120px; height: 70px;') . '<br>';
|
||||
else
|
||||
$data[0] = html_print_select ($tags_select_without, 'select_without', '', '', '', 0,
|
||||
true, true, true, '', false, 'width: auto; height: 70px;') . '<br>';
|
||||
|
||||
$data[0] = html_print_select ($tags_select_without, 'select_without', '', '', '', 0,
|
||||
true, true, true, '', false, 'width: 200px; height: 70px;') . '<br>';
|
||||
$data[1] = html_print_image('images/darrowright.png', true, array('id' => 'button-add_without', 'style' => 'cursor: pointer;', 'title' => __('Add')));
|
||||
$data[1] .= html_print_input_hidden('tag_without', $tag_without_base64, true);
|
||||
$data[1] .= '<br><br>' . html_print_image('images/darrowleft.png', true, array('id' => 'button-remove_without', 'style' => 'cursor: pointer;', 'title' => __('Remove')));
|
||||
|
||||
if (!defined("METACONSOLE"))
|
||||
$data[2] = html_print_select ($tag_without_temp, 'tag_without_temp', array(), '', '',
|
||||
0, true, true, true, '', false, "width: 120px; height: 70px;");
|
||||
else
|
||||
$data[2] = html_print_select ($tag_without_temp, 'tag_without_temp', array(), '', '',
|
||||
0, true, true, true, '', false, "width: auto; height: 70px;");
|
||||
$data[2] = html_print_select ($tag_without_temp, 'tag_without_temp', array(), '', '',
|
||||
0, true, true, true, '', false, "width: 200px; height: 70px;");
|
||||
$tabletags_without->data[] = $data;
|
||||
$tabletags_without->rowclass[] = '';
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.0dev
|
||||
%define release 150526
|
||||
%define release 150602
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.0dev
|
||||
%define release 150526
|
||||
%define release 150602
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1317,7 +1317,7 @@ LOCK TABLE trecon_script IN EXCLUSIVE MODE;
|
|||
|
||||
EXECUTE IMMEDIATE 'ALTER TRIGGER trecon_script_inc DISABLE';
|
||||
|
||||
INSERT INTO trecon_script VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_fiedl3 = Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"i.e.: 192.168.100.0/24","value":"","hide":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":"","hide":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":"","hide":"1"}}');
|
||||
INSERT INTO trecon_script VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"i.e.: 192.168.100.0/24","value":"","hide":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":"","hide":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":"","hide":"1"},"4":{"macro":"_field4_","desc":"Additional parameters","help":"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.","value":"","hide":""}}');
|
||||
INSERT INTO trecon_script VALUES (4,'SNMP L2 Recon','Pandora FMS SNMP Recon Plugin for level 2 network topology discovery.
(c) Artica ST 2014 <info@artica.es>

Usage:

   ./snmp-recon.pl <task_id> <group_id> <create_incident> <custom_field1> <custom_field2> [custom_field3] [custom_field4]

 * custom_field1 = comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)
 * custom_field2 = comma separated list of snmp communities to try.
 * custom_field3 = a router in the network. Optional but recommended.
 * custom_field4 = set to -a to add all network interfaces (by default only interfaces that are up are added).

 Additional information:
When the script is called from a recon task the task_id, group_id and create_incident parameters are automatically filled by the Pandora FMS Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"Comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)","value":"","hide":""},"2":{"macro":"_field2_","desc":"Community","help":"Comma separated list of snmp communities to try.","value":"","hide":""},"3":{"macro":"_field3_","desc":"Router","help":"A router in the network. Optional but recommended.","value":"","hide":""},"4":{"macro":"_field4_","desc":"Optional parameter","help":"Set to -a to add all network interfaces (by default only interfaces that are up are added).","value":"","hide":""}}');
|
||||
INSERT INTO trecon_script VALUES (5,'WMI Recon Script','This script is used to automatically gather host information via WMI.
Available parameters:

* Network = network to scan (e.g. 192.168.100.0/24).
* WMI auth = comma separated list of WMI authentication tokens in the format username%password (e.g. Administrador%pass).

See the documentation for more information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"","value":"","hide":""},"2":{"macro":"_field2_","desc":"WMI auth","help":"","value":"","hide":""}}');
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ LOCK TABLE tplugin IN EXCLUSIVE MODE;
|
|||
|
||||
EXECUTE IMMEDIATE 'ALTER TRIGGER tplugin_inc DISABLE';
|
||||
|
||||
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{1:{macro:"_field1_",desc:Target IP,help:"",value:""},2:{macro:"_field2_",desc:Username,help:"",value:""},3:{macro:"_field3_",desc:Password,help:"",value:""}}','-h _field1_-u _field2_-p _field3_');
|
||||
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{1:{macro:"_field1_",desc:Target IP,help:"",value:"","hide":""},2:{macro:"_field2_",desc:Username,help:"",value:"","hide":""},3:{macro:"_field3_",desc:Password,help:"",value:"","hide":""},"4":{"macro":"_field4_","desc":"Sensor","help":"","value":"","hide":""},"5":{"macro":"_field5_","desc":"Additional Options","help":"","value":"","hide":""}}','-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_');
|
||||
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters:

-d domain to check (for example pandorafms.com)
-s DNS Server to check  (for example 8.8.8.8)

Optional parameters:

-t Do a DNS time response check instead DNS resolve test

',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{1:{macro:"_field1_",desc:Target IP,help:"",value:""},2:{macro:"_field2_",desc:Domain to check,help:For example pandorafms.com,value:""},3:{macro:"_field3_",desc:DNS Server to check,help:For example 8.8.8.8,value:""},4:{macro:"_field4_",desc:Optional parameters,help:"",value:""}}','-i _field1_ -d _field2_ -s _field3_ _field4_');
|
||||
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (3,'UDP port check','Check a remote UDP port (by using NMAP). Use IP address and Port options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{1:{macro:"_field1_",desc:Target IP,help:"",value:""},2:{macro:"_field2_",desc:Port,help:"",value:""}}','-t _field1_-p _field2_');
|
||||
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (4,'SMTP Check','This plugin is used to send a mail to a SMTP server and check if works. 

Parameters in the plugin:

IP Address - SMTP Server IP address
User - AUTH login  
Pass - AUTH password
Port - SMTP port (optional)

Optional parameters:

-d Destination email
-f Email of the sender
-a Authentication system. Could be LOGIN, PLAIN, CRAM-MD5 or DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{1:{macro:"_field1_",desc:Target IP,help:"",value:""},2:{macro:"_field2_",desc:Port,help:"",value:""},3:{macro:"_field3_",desc:Username,help:"",value:""},4:{macro:"_field4_",desc:Password,help:"",value:""},5:{macro:"_field5_",desc:Optional parameters,help:"",value:""}}','-h _field1_ -o _field2_ -u _field3_ -p _field4_ _field5_');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('graph_res','5'),
|
||||
('step_compact','1'),
|
||||
('db_scheme_version','6.0dev'),
|
||||
('db_scheme_build','PD150526'),
|
||||
('db_scheme_build','PD150602'),
|
||||
('show_unknown','0'),
|
||||
('show_lastalerts','1'),
|
||||
('style','pandora'),
|
||||
|
@ -1009,13 +1009,13 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (2, 'Monitoring&#x
|
|||
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (3, 'Monitoring Report Alerts', 'select t1.nombre as agent_name, t2.nombre as module_name, (select talert_templates.name from talert_templates where talert_templates.id = t3.id_alert_template) as template, (select group_concat(t02.name) from talert_template_module_actions as t01 inner join talert_actions as t02 on t01.id_alert_action = t02.id where t01.id_alert_template_module = t3.id group by t01.id_alert_template_module) as actions from tagente as t1 inner join tagente_modulo as t2 on t1.id_agente = t2.id_agente inner join talert_template_modules as t3 on t2.id_agente_modulo = t3.id_agent_module order by agent_name, module_name;');
|
||||
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group view', 'select t1.nombre, (select count(t3.id_agente) from tagente as t3 where t1.id_grupo = t3.id_grupo) as agents, (SELECT COUNT(t4.id_agente) FROM tagente as t4 WHERE t4.id_grupo = t1.id_grupo AND t4.disabled = 0 AND t4.ultimo_contacto < NOW() - (intervalo / (1/2))) as agent_unknown, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval / (1/2))) as monitor_unknow, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0) as monitor_no_init, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))) as monitor_ok, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0) as monitor_critical, (SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = t1.id_grupo AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0) as monitor_alert_fired from tgrupo as t1 where 0 < (select count(t2.id_agente) from tagente as t2 where t1.id_grupo = t2.id_grupo)');
|
||||
|
||||
INSERT INTO `trecon_script` VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_fiedl3 = Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"}}');
|
||||
INSERT INTO `trecon_script` VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}');
|
||||
|
||||
INSERT INTO `trecon_script` VALUES (4,'SNMP L2 Recon','Pandora FMS SNMP Recon Plugin for level 2 network topology discovery.
(c) Artica ST 2014 <info@artica.es>

Usage:

   ./snmp-recon.pl <task_id> <group_id> <create_incident> <custom_field1> <custom_field2> [custom_field3] [custom_field4]

 * custom_field1 = comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)
 * custom_field2 = comma separated list of snmp communities to try.
 * custom_field3 = a router in the network. Optional but recommended.
 * custom_field4 = set to -a to add all network interfaces (by default only interfaces that are up are added).

 Additional information:
When the script is called from a recon task the task_id, group_id and create_incident parameters are automatically filled by the Pandora FMS Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Comma separated list of snmp communities to try.\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Router\",\"help\":\"A router in the network. Optional but recommended.\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Optional parameter\",\"help\":\"Set to -a to add all network interfaces (by default only interfaces that are up are added).\",\"value\":\"\",\"hide\":\"\"}}');
|
||||
|
||||
INSERT INTO `trecon_script` VALUES (5,'WMI Recon Script','This script is used to automatically gather host information via WMI.
Available parameters:

* Network = network to scan (e.g. 192.168.100.0/24).
* WMI auth = comma separated list of WMI authentication tokens in the format username%password (e.g. Administrador%pass).

See the documentation for more information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"WMI auth\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}');
|
||||
|
||||
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":""}}','-h _field1_-u _field2_-p _field3_');
|
||||
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_');
|
||||
|
||||
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters:

-d domain to check (for example pandorafms.com)
-s DNS Server to check  (for example 8.8.8.8)

Optional parameters:

-t Do a DNS time response check instead DNS resolve test

',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain to check","help":"For example pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS Server to check","help":"For example 8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional parameters","help":"","value":""}}','-i _field1_ -d _field2_ -s _field3_ _field4_');
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 6.0dev-150526
|
||||
Version: 6.0dev-150602
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.0dev-150526"
|
||||
pandora_version="6.0dev-150602"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -30,7 +30,7 @@ tentacle_server - Tentacle Server
|
|||
|
||||
=head1 VERSION
|
||||
|
||||
Version 0.4.0
|
||||
Version 0.5.0
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
|
@ -86,8 +86,11 @@ my $SOCKET_MODULE =
|
|||
# Service name for Win32.
|
||||
my $SERVICE_NAME="Tentacle Server";
|
||||
|
||||
# Service parameters.
|
||||
my $SERVICE_PARAMS=join(' ', @ARGV);
|
||||
|
||||
# Program version
|
||||
our $VERSION = '0.4.0';
|
||||
our $VERSION = '0.5.0';
|
||||
|
||||
# IPv4 address to listen on
|
||||
my @t_addresses = ('0', '0.0.0.0');
|
||||
|
@ -139,7 +142,9 @@ my $t_sem :shared;
|
|||
|
||||
# Server socket
|
||||
my @t_server_sockets;
|
||||
my $select;
|
||||
|
||||
# Server select handler
|
||||
my $t_server_select;
|
||||
|
||||
# Use SSL, 1 true, 0 false
|
||||
my $t_ssl = 0;
|
||||
|
@ -159,10 +164,10 @@ my $t_ssl_pwd = '';
|
|||
# Timeout for socket read/write operations in seconds
|
||||
my $t_timeout = 1;
|
||||
|
||||
#Bridge IP to actuate as a proxy
|
||||
# Address to proxy client requests to
|
||||
my $t_proxy_ip = undef;
|
||||
|
||||
# Proxy port by default 41121
|
||||
# Port to proxy client requests to
|
||||
my $t_proxy_port = 41121;
|
||||
|
||||
# Proxy socket
|
||||
|
@ -189,7 +194,7 @@ sub print_help {
|
|||
print ("Tentacle server v$VERSION. See http://www.openideas.info/wiki for protocol description.\n\n");
|
||||
print ("Options:\n");
|
||||
print ("\t-a ip_addresses\tIP addresses to listen on (default @t_addresses).\n");
|
||||
print ("\t\t(Multiple addresses separated by comma can be defined.)\n");
|
||||
print ("\t \t(Multiple addresses separated by comma can be defined.)\n");
|
||||
print ("\t-c number\tMaximum number of simultaneous connections (default $t_max_conn).\n");
|
||||
print ("\t-d\t\tRun as daemon.\n");
|
||||
print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n");
|
||||
|
@ -206,11 +211,11 @@ sub print_help {
|
|||
print ("\t-t time\t\tTime-out for network operations in seconds (default ${t_timeout}s).\n");
|
||||
print ("\t-v\t\tBe verbose.\n");
|
||||
print ("\t-w\t\tPrompt for OpenSSL private key password.\n");
|
||||
print ("\t-x pwd\t\tServer password.\n\n");
|
||||
print ("\t-b proxy_ip_address\t\tProxied server address.\n\n");
|
||||
print ("\t-g proxy_port\t\tPort of proxied server.\n\n");
|
||||
print ("\t-x pwd\t\tServer password.\n");
|
||||
print ("\t-b ip_address\tProxy requests to the given address.\n");
|
||||
print ("\t-g port\t\tProxy requests to the given port.\n");
|
||||
print ("\t-T\t\tEnable tcpwrappers support.\n");
|
||||
print ("\t\t(To use this option, 'Authen::Libwrap' should be installed.)\n\n");
|
||||
print ("\t \t\t(To use this option, 'Authen::Libwrap' should be installed.)\n\n");
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
@ -261,6 +266,23 @@ sub parse_options {
|
|||
exit 1;
|
||||
}
|
||||
|
||||
# The Win32 service must be installed/uninstalled without checking other parameters.
|
||||
if (defined ($opts{'S'})) {
|
||||
my $service_action = $opts{'S'};
|
||||
if ($^O ne 'MSWin32') {
|
||||
error ("Windows services are only available on Win32.");
|
||||
} else {
|
||||
eval "use Win32::Daemon";
|
||||
die($@) if ($@);
|
||||
|
||||
if ($service_action eq 'install') {
|
||||
install_service();
|
||||
} elsif ($service_action eq 'uninstall') {
|
||||
uninstall_service();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Address
|
||||
if (defined ($opts{'a'})) {
|
||||
@t_addresses = ();
|
||||
|
@ -462,11 +484,7 @@ sub parse_options {
|
|||
eval "use Win32::Daemon";
|
||||
die($@) if ($@);
|
||||
|
||||
if ($service_action eq 'install') {
|
||||
install_service();
|
||||
} elsif ($service_action eq 'uninstall') {
|
||||
uninstall_service();
|
||||
} elsif ($service_action eq 'run') {
|
||||
if ($service_action eq 'run') {
|
||||
Win32::Daemon::RegisterCallbacks({
|
||||
start => \&callback_start,
|
||||
running => \&callback_running,
|
||||
|
@ -483,9 +501,9 @@ sub parse_options {
|
|||
|
||||
################################################################################
|
||||
## SUB start_proxy
|
||||
## Open the server socket.
|
||||
## Open the proxy server socket.
|
||||
################################################################################
|
||||
sub open_proxy {
|
||||
sub start_proxy {
|
||||
|
||||
# Connect to server
|
||||
$t_proxy_socket = $SOCKET_MODULE->new (
|
||||
|
@ -498,8 +516,8 @@ sub open_proxy {
|
|||
}
|
||||
|
||||
# Create proxy selector
|
||||
$t_proxy_select = IO::Select->new ();
|
||||
$t_proxy_select->add ($t_proxy_socket);
|
||||
$t_proxy_select = IO::Select->new ();
|
||||
$t_proxy_select->add ($t_proxy_socket);
|
||||
|
||||
}
|
||||
|
||||
|
@ -538,11 +556,11 @@ sub start_server {
|
|||
|
||||
if (!@t_server_sockets) {
|
||||
error ("Cannot open socket for all addresses on port $t_port: $!.");
|
||||
}
|
||||
}
|
||||
|
||||
$select = IO::Select->new();
|
||||
$t_server_select = IO::Select->new();
|
||||
foreach my $t_server_socket (@t_server_sockets){
|
||||
$select->add($t_server_socket);
|
||||
$t_server_select->add($t_server_socket);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,8 +620,6 @@ sub send_data_proxy {
|
|||
sub close_proxy {
|
||||
$t_proxy_socket->shutdown (2);
|
||||
$t_proxy_socket->close ();
|
||||
print_log ("Proxy socket closed");
|
||||
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
@ -668,6 +684,9 @@ sub accept_connections {
|
|||
my $pid;
|
||||
my $t_server_socket;
|
||||
|
||||
# Ignore SIGPIPE errors (happens on FreeBSD when SSL is enabled ¿?)
|
||||
$SIG{PIPE} = 'IGNORE';
|
||||
|
||||
# Start server
|
||||
start_server ();
|
||||
|
||||
|
@ -675,7 +694,7 @@ sub accept_connections {
|
|||
$t_sem = Thread::Semaphore->new ($t_max_conn);
|
||||
|
||||
while (1) {
|
||||
my @ready = $select->can_read;
|
||||
my @ready = $t_server_select->can_read;
|
||||
foreach $t_server_socket (@ready) {
|
||||
|
||||
# Accept connection
|
||||
|
@ -749,40 +768,25 @@ sub serve_client() {
|
|||
## Actuate as a proxy between its client and other tentacle server.
|
||||
################################################################################
|
||||
sub serve_proxy_connection {
|
||||
my $read;
|
||||
my $data=1;
|
||||
|
||||
# Start a connection with the other Tentacle Server
|
||||
open_proxy();
|
||||
|
||||
my $command;
|
||||
# We are a proxy! Start a connection to the Tentacle Server.
|
||||
start_proxy();
|
||||
|
||||
# Read commands
|
||||
while ($command = recv_command ($t_block_size)) {
|
||||
# Client wants to send a file
|
||||
if ($command =~ /^SEND <(.*)> SIZE (\d+)$/) {
|
||||
recv_file_proxy($command, $2);
|
||||
# Forward data between the client and the server.
|
||||
eval {
|
||||
while (1) {
|
||||
if ($t_select->can_read(0)) {
|
||||
my ($read, $data) = recv_data($t_block_size);
|
||||
send_data_proxy($data);
|
||||
}
|
||||
if ($t_proxy_select->can_read(0)) {
|
||||
my ($read, $data) = recv_data_proxy($t_block_size);
|
||||
send_data($data);
|
||||
}
|
||||
}
|
||||
# Client wants to receive a file
|
||||
elsif ($command =~ /^RECV <(.*)>$/) {
|
||||
send_file_proxy ($command);
|
||||
}
|
||||
# Quit
|
||||
elsif ($command =~ /^QUIT$/) {
|
||||
print_log ("Connection closed from " . $t_client_socket->sockhost ());
|
||||
|
||||
# End proxy connection
|
||||
send_data_proxy("QUIT\n");
|
||||
last;
|
||||
}
|
||||
# Unknown command
|
||||
else {
|
||||
print_log ("Unknown command '$command' from " . $t_client_socket->sockhost ());
|
||||
last;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# End a connection with the other Tentacle Server
|
||||
# Close the connection to the Tentacle Server.
|
||||
close_proxy();
|
||||
}
|
||||
|
||||
|
@ -848,43 +852,6 @@ sub auth_pwd {
|
|||
send_data ("PASS OK\n");
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_file_proxy
|
||||
## Redirect file from agent to proxy
|
||||
################################################################################
|
||||
sub recv_file_proxy ($$) {
|
||||
my ($command, $size) = @_;
|
||||
|
||||
# Send command to proxy
|
||||
print_log ("[PROXY] Host: ".$t_client_socket->sockhost()." send ".$command." to ".$t_proxy_socket->sockhost ());
|
||||
send_data_proxy($command."\n");
|
||||
|
||||
# Proxied server response
|
||||
my $rc = dump_data($t_proxy_socket, $t_client_socket);
|
||||
|
||||
# Check if there was an error
|
||||
if ($rc == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Client send data to server
|
||||
$rc = dump_data($t_client_socket, $t_proxy_socket, $size);
|
||||
|
||||
# Check if there was an error
|
||||
if ($rc == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Server says if data was recieved or not
|
||||
$rc = dump_data($t_proxy_socket, $t_client_socket);
|
||||
|
||||
# Check if there was an error
|
||||
if ($rc == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_file
|
||||
## Receive a file of size $_[1] and save it in $t_directory as $_[0].
|
||||
|
@ -934,45 +901,6 @@ sub recv_file {
|
|||
print_log ("Received file '$base_name' size ${size}b from " . $t_client_socket->sockhost ());
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB send_file_proxy
|
||||
## Redirect file from agent to proxy
|
||||
################################################################################
|
||||
sub send_file_proxy ($) {
|
||||
my ($command) = @_;
|
||||
my $size;
|
||||
# Send command to proxy
|
||||
print_log ("[PROXY] ".$t_client_socket->sockhost()." send ".$command." to ".$t_proxy_socket->sockhost ());
|
||||
send_data_proxy($command."\n");
|
||||
|
||||
$command = recv_command_proxy($t_block_size);
|
||||
|
||||
if ($command =~ /^RECV SIZE (\d+)$/) {
|
||||
$size = $1;
|
||||
}
|
||||
|
||||
print_log ("[PROXY] ".$t_proxy_socket->sockhost()." send ".$command." to ".$t_client_socket->sockhost ());
|
||||
|
||||
send_data($command."\n");
|
||||
|
||||
# Client send OK to server
|
||||
my $rc = dump_data($t_client_socket, $t_proxy_socket);
|
||||
|
||||
# Check if there was an error
|
||||
if ($rc == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Proxied server send the file to client
|
||||
$rc = dump_data($t_proxy_socket, $t_client_socket, $size);
|
||||
|
||||
# Check if there was an error
|
||||
if ($rc == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB send_file
|
||||
## Send a file to the client
|
||||
|
@ -1181,127 +1109,6 @@ sub send_data {
|
|||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB dump_data
|
||||
## Dump data from a socket to another one. Following Tentacle Protocol.
|
||||
################################################################################
|
||||
sub dump_data($$;$) {
|
||||
my ($from, $to, $size) = @_;
|
||||
my $read;
|
||||
my $data;
|
||||
my $buffer = "";
|
||||
my $written;
|
||||
my $total = $size;
|
||||
my $t_select_read = undef;
|
||||
my $t_select_write = undef;
|
||||
|
||||
# Assign the correct selector for each socket
|
||||
if ($from == $t_proxy_socket) {
|
||||
# We must read from t_proxy_socket
|
||||
$t_select_read = $t_proxy_select;
|
||||
$t_select_write = $t_select;
|
||||
} else {
|
||||
# We must read from t_client_socket
|
||||
$t_select_read = $t_select;
|
||||
$t_select_write = $t_proxy_select;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
# Ensure we can read from socket
|
||||
if ($t_select_read->can_read()) {
|
||||
# Ensure we can write from socket
|
||||
if ($t_select_write->can_write()) {
|
||||
|
||||
$read = "";
|
||||
$read = sysread ($from, $data, $t_block_size);
|
||||
|
||||
# Read error
|
||||
if (! defined ($read)) {
|
||||
error ("Read error from " . $from->sockhost () . ": $!.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
# EOF
|
||||
if ($read == 0) {
|
||||
error ("Connection from " . $from->sockhost () . " unexpectedly closed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
$written = syswrite ($to, $data, $read);
|
||||
|
||||
if ($written != $read) {
|
||||
error ("Connection from " . $to->sockhost () . " unexpectedly closed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
$buffer .= $data;
|
||||
|
||||
if (! defined ($size)) {
|
||||
# If no size defined check for \n
|
||||
# because a command was sent.
|
||||
|
||||
if ($buffer =~ /\n$/) {
|
||||
|
||||
# Delete CHAR \n
|
||||
chop($buffer);
|
||||
|
||||
print_log ("[PROXY] ".$from->sockhost()." send ".$buffer." to ".$to->sockhost ());
|
||||
|
||||
# Returns error if proxy returns error to end connection
|
||||
if ($buffer =~ /SEND ERR/) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# If size is defined check if all bytes were sent
|
||||
$size = $size - $read;
|
||||
|
||||
if ($size == 0) {
|
||||
print_log ("[PROXY] ".$from->sockhost()." send ".$total."b to ".$to->sockhost());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_command_proxy
|
||||
## Read a command from the proxied server, ended by a new line character.
|
||||
################################################################################
|
||||
sub recv_command_proxy {
|
||||
my $buffer;
|
||||
my $char;
|
||||
my $command = '';
|
||||
my $read;
|
||||
my $total = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
($read, $buffer) = recv_data_proxy ($t_block_size);
|
||||
$command .= $buffer;
|
||||
$total += $read;
|
||||
|
||||
# Check if the command is complete
|
||||
$char = chop ($command);
|
||||
if ($char eq "\n") {
|
||||
return $command;
|
||||
}
|
||||
|
||||
$command .= $char;
|
||||
|
||||
# Avoid overflow
|
||||
if ($total > $t_block_size) {
|
||||
error ("Received too much data from " . $t_proxy_socket->sockhost () . ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_command
|
||||
## Read a command from the client, ended by a new line character.
|
||||
|
@ -1419,7 +1226,10 @@ sub apply_filters ($) {
|
|||
sub install_service() {
|
||||
|
||||
my $service_path = $0;
|
||||
my $service_params = "-s \"$t_directory\" -S run";
|
||||
my $service_params = $SERVICE_PARAMS;
|
||||
|
||||
# Change the service parameter from 'install' to 'run'.
|
||||
$service_params =~ s/\-S\s+\S+/\-S run/;
|
||||
|
||||
my %service_hash = (
|
||||
machine => '',
|
||||
|
|
Binary file not shown.
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "6.0dev";
|
||||
my $pandora_build = "150526";
|
||||
my $pandora_build = "150602";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.0dev
|
||||
%define release 150526
|
||||
%define release 150602
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.0dev
|
||||
%define release 150526
|
||||
%define release 150602
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.0dev PS150526";
|
||||
my $version = "6.0dev PS150602";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -35,7 +35,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.0dev PS150526";
|
||||
my $version = "6.0dev PS150602";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
|
@ -11,7 +11,12 @@ sub get_param($) {
|
|||
|
||||
for(my $i=0; $i<$#ARGV; $i++) {
|
||||
|
||||
if ($ARGV[$i] eq $param) {
|
||||
if ($ARGV[$i] eq "--") {
|
||||
if ($param eq "--") {
|
||||
$value = join(' ', @ARGV[$i+1..$#ARGV]);
|
||||
}
|
||||
last;
|
||||
} elsif ($ARGV[$i] eq $param) {
|
||||
$value = $ARGV[$i+1];
|
||||
last;
|
||||
}
|
||||
|
@ -40,16 +45,24 @@ my $host = get_param("h");
|
|||
my $user = get_param("u");
|
||||
my $pass = get_param("p");
|
||||
my $sensor = get_param("s");
|
||||
my $extraopts = get_param("-");
|
||||
|
||||
my $res = `ipmi-sensors -h $host -u $user -p $pass -s $sensor | tail -1`;
|
||||
my $cmd = "ipmi-sensors -h $host -u $user -p $pass -s $sensor $extraopts --ignore-not-available-sensors --no-header-output --comma-separated-output --output-event-bitmask";
|
||||
my $res = `$cmd`;
|
||||
|
||||
my @aux = split(/\|/, $res);
|
||||
if (defined $res and "$res" ne "") {
|
||||
my ($sensor_id, $name, $type, $value, $units, $eventmask) = split(/,/, $res);
|
||||
|
||||
my $value = $aux[3];
|
||||
|
||||
$value =~ s/\n//;
|
||||
$value =~ s/^\s+//;
|
||||
$value =~ s/\s+$//;
|
||||
|
||||
#Output the value
|
||||
print $value;
|
||||
#Output the value
|
||||
if ($value eq 'N/A') {
|
||||
if ($eventmask =~ /([0-9A-Fa-f]+)h/) {
|
||||
print hex $1;
|
||||
} else {
|
||||
print $eventmask;
|
||||
}
|
||||
} else {
|
||||
print $value;
|
||||
}
|
||||
} else {
|
||||
print STDERR "Error processing command: $cmd\n";
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ use PandoraFMS::Config;
|
|||
##########################################################################
|
||||
# Global variables so set behaviour here:
|
||||
|
||||
my $pkg_count = 3; #Number of ping pkgs
|
||||
my $pkg_timeout = 3; #Pkg ping timeout wait
|
||||
my $pkg_count = 2; #Number of ping pkgs
|
||||
my $pkg_timeout = 1; #Pkg ping timeout wait
|
||||
|
||||
##########################################################################
|
||||
# Code begins here, do not touch
|
||||
|
@ -44,7 +44,60 @@ my $create_incident = $ARGV[2]; # Defined by user
|
|||
my $target_network = $ARGV[3]; # Filed1 defined by user
|
||||
my $username = $ARGV[4]; # Field2 defined by user
|
||||
my $password = $ARGV[5]; # Field3 defined by user
|
||||
my $extraopts = $ARGV[6]; # Field4 defined by user
|
||||
|
||||
# Map Sensor type to module type and thresholds
|
||||
# 0 = numeric, record has thresholds
|
||||
# 1 = simple flag, 0 normal, > 0 critical
|
||||
# 2 = complex flags, for now ignore alert settings
|
||||
# 3 = string or unknown
|
||||
my %sensor_types = (
|
||||
'Temperature' => 0,
|
||||
'Voltage' => 0,
|
||||
'Current' => 0,
|
||||
'Fan' => 0,
|
||||
'Physical Security' => 1,
|
||||
'Platform Security Violation Attempt' => 1,
|
||||
'Processor' => 2,
|
||||
'Power Supply' => 2,
|
||||
'Power Unit' => 2,
|
||||
'Cooling Device' => 0,
|
||||
'Other Units Based Sensor' => 0,
|
||||
'Memory' => 2,
|
||||
'Drive Slot' => 3,
|
||||
'POST Memory Resize' => 3,
|
||||
'System Firmware Progress' => 1,
|
||||
'Event Logging Disabled' => 2,
|
||||
'Watchdog 1' => 2,
|
||||
'System Event' => 2,
|
||||
'Critical Interrupt' => 1,
|
||||
'Button Switch' => 2,
|
||||
'Module Board' => 3,
|
||||
'Microcontroller Coprocessor' => 3,
|
||||
'Add In Card' => 3,
|
||||
'Chassis' => 3,
|
||||
'Chip Set' => 3,
|
||||
'Other Fru' => 3,
|
||||
'Cable Interconnect' => 3,
|
||||
'Terminator' => 3,
|
||||
'System Boot Initiated' => 2,
|
||||
'Boot Error' => 1,
|
||||
'OS Boot' => 2,
|
||||
'OS Critical Stop' => 1,
|
||||
'Slot Connector' => 2,
|
||||
'System ACPI Power State' => 2,
|
||||
'Watchdog 2' => 2,
|
||||
'Platform Alert' => 2,
|
||||
'Entity Presence' => 2,
|
||||
'Monitor ASIC IC' => 3,
|
||||
'LAN' => 2,
|
||||
'Management Subsystem Health' => 1,
|
||||
'Battery' => 2,
|
||||
'Session Audit' => 3,
|
||||
'Version Change' => 3,
|
||||
'FRU State' => 3,
|
||||
'OEM Reserved' => 3
|
||||
);
|
||||
|
||||
##########################################################################
|
||||
# Update recon task status.
|
||||
|
@ -62,10 +115,11 @@ sub show_help {
|
|||
print "\nSpecific Pandora FMS Intel DCM Discovery\n";
|
||||
print "(c) Artica ST 2011 <info\@artica.es>\n\n";
|
||||
print "Usage:\n\n";
|
||||
print " $0 <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3>\n\n";
|
||||
print " $0 <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4>\n\n";
|
||||
print " * custom_field1 = network. i.e.: 192.168.100.0/24\n";
|
||||
print " * custom_field2 = username \n";
|
||||
print " * custom_fiedl3 = password \n";
|
||||
print " * custom_field3 = password \n";
|
||||
print " * custom_field4 = additional ipmi-sensors options \n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -81,65 +135,91 @@ sub ipmi_ping ($$$) {
|
|||
|
||||
my $res = `$cmd`;
|
||||
|
||||
if ($res =~ /100\.0% packet loss/) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
if ($res =~ / (\d+\.\d+)% packet loss/) {
|
||||
if ($1 ne '100.0') {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub create_ipmi_modules($$$$$$) {
|
||||
my ($conf, $dbh, $addr, $user, $pass, $id_agent) = @_;
|
||||
sub create_ipmi_modules($$$$$$$) {
|
||||
my ($conf, $dbh, $addr, $user, $pass, $extraopts, $id_agent) = @_;
|
||||
|
||||
my $cmd = "ipmi-sensors -h $addr -u $user -p $pass";
|
||||
my $cmd = "ipmi-sensors -h $addr -u $user -p $pass $extraopts --ignore-not-available-sensors --no-header-output --comma-separated-output --non-abbreviated-units --output-sensor-thresholds --output-event-bitmask";
|
||||
|
||||
my $res = `$cmd`;
|
||||
my $res = `$cmd`;
|
||||
|
||||
my @lines = split(/\n/, $res);
|
||||
|
||||
my $ipmi_plugin_id = get_db_value($dbh, "SELECT id FROM tplugin WHERE name = '".safe_input("IPMI Plugin")."'");
|
||||
|
||||
|
||||
for(my $i=1; $i < $#lines; $i++) {
|
||||
for (my $i=0; $i <= $#lines; $i++) {
|
||||
|
||||
my $line = $lines[$i];
|
||||
|
||||
my @aux = split(/\|/, $line);
|
||||
my ($sensor, $name, $type, $value, $units, $lowerNR, $lowerC, $lowerNC, $upperNC, $upperC, $upperNR, $eventmask) = split(/,/, $line);
|
||||
|
||||
my $name = $aux[1];
|
||||
my $module_name = $type.': '.$name;
|
||||
|
||||
#Trim name
|
||||
$name =~ s/^\s+//;
|
||||
$name =~ s/\s+$//;
|
||||
|
||||
my $module_type = "generic_data_string";
|
||||
|
||||
my $value_read = $aux[3];
|
||||
|
||||
#Trim name
|
||||
$value_read =~ s/^\s+//;
|
||||
$value_read =~ s/\s+$//;
|
||||
|
||||
#Check if value read is integer or boolean
|
||||
if ($value_read =~ m/^\d+.\d+$/ || $value_read =~ m/^\d+$/) {
|
||||
my $module_type;
|
||||
my $module_warn_min;
|
||||
my $module_warn_max;
|
||||
my $module_warn_invert;
|
||||
my $module_critical_min;
|
||||
my $module_critical_max;
|
||||
my $module_critical_invert;
|
||||
|
||||
if ($sensor_types{$type} == 0) {
|
||||
$module_type = "generic_data";
|
||||
}
|
||||
if ($lowerC ne 'N/A' and $upperC ne 'N/A') {
|
||||
$module_critical_min = $lowerC;
|
||||
$module_critical_max = $upperC;
|
||||
$module_critical_invert = 1;
|
||||
}
|
||||
if ($lowerNC ne 'N/A' and $upperNC ne 'N/A') {
|
||||
$module_warn_min = $lowerNC;
|
||||
$module_warn_max = $upperNC;
|
||||
$module_warn_invert = 1;
|
||||
}
|
||||
} elsif ($sensor_types{$type} == 1) {
|
||||
$module_type = "generic_data";
|
||||
$module_critical_min = "1";
|
||||
$module_critical_max = "0";
|
||||
} elsif ($sensor_types{$type} == 2) {
|
||||
$module_type = "generic_data";
|
||||
} elsif ($sensor_types{$type} == 3) {
|
||||
$module_type = "generic_data_string";
|
||||
} else {
|
||||
$module_type = "generic_data_string";
|
||||
}
|
||||
|
||||
my $id_module_type = get_module_id($dbh, $module_type);
|
||||
|
||||
my $params = "-s $aux[0]";
|
||||
|
||||
my $macros = '{'.
|
||||
'"1":{"macro":"_field1_","desc":"'.safe_input("Target IP").'","help":"","value":"'.$addr.'","hide":""},'.
|
||||
'"2":{"macro":"_field2_","desc":"Username","help":"","value":"'.$user.'","hide":""},'.
|
||||
'"3":{"macro":"_field3_","desc":"Password","help":"","value":"'.$pass.'","hide":"1"},'.
|
||||
'"4":{"macro":"_field4_","desc":"Sensor","help":"","value":"'.$sensor.'","hide":""},'.
|
||||
'"5":{"macro":"_field5_","desc":"'.safe_input("Additional Options").'","help":"","value":"'.$extraopts.'","hide":""}'.
|
||||
'}';
|
||||
|
||||
my %parameters;
|
||||
|
||||
$parameters{"nombre"} = safe_input($name);
|
||||
$parameters{"nombre"} = safe_input($module_name);
|
||||
$parameters{"id_tipo_modulo"} = $id_module_type;
|
||||
$parameters{"id_agente"} = $id_agent;
|
||||
$parameters{"id_plugin"} = $ipmi_plugin_id;
|
||||
$parameters{"ip_target"} = $addr;
|
||||
$parameters{"plugin_user"} = $user;
|
||||
$parameters{"plugin_pass"} = $pass;
|
||||
$parameters{"id_modulo"} = 4;
|
||||
$parameters{"plugin_parameter"} = $params;
|
||||
$parameters{"unit"} = $units if $units ne 'N/A';
|
||||
$parameters{"min_warning"} = $module_warn_min if defined $module_warn_min;
|
||||
$parameters{"max_warning"} = $module_warn_max if defined $module_warn_max;
|
||||
$parameters{"warning_inverse"} = $module_warn_invert if defined $module_warn_invert;
|
||||
$parameters{"min_critical"} = $module_critical_min if defined $module_critical_min;
|
||||
$parameters{"max_critical"} = $module_critical_max if defined $module_critical_max;
|
||||
$parameters{"critical_inverse"} = $module_critical_invert if defined $module_critical_invert;
|
||||
$parameters{"macros"} = $macros;
|
||||
|
||||
pandora_create_module_from_hash ($conf, \%parameters, $dbh);
|
||||
|
||||
|
@ -184,17 +264,7 @@ if (! defined ($net_addr)) {
|
|||
# Scan the network for host
|
||||
my ($total_hosts, $hosts_found, $addr_found) = ($net_addr->num, 0, '');
|
||||
|
||||
my $last = 0;
|
||||
for (my $i = 1; $net_addr <= $net_addr->broadcast; $i++, $net_addr++) {
|
||||
if($last == 1) {
|
||||
last;
|
||||
}
|
||||
|
||||
my $net_addr_temp = $net_addr + 1;
|
||||
if($net_addr eq $net_addr_temp) {
|
||||
$last = 1;
|
||||
}
|
||||
|
||||
for (my $i = 1; $net_addr < $net_addr->broadcast; $i++, $net_addr++) {
|
||||
if ($net_addr =~ /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.(\d{1,3})\b/) {
|
||||
if($1 eq '0' || $1 eq '255') {
|
||||
next;
|
||||
|
@ -228,7 +298,7 @@ for (my $i = 1; $net_addr <= $net_addr->broadcast; $i++, $net_addr++) {
|
|||
# Create a new agent
|
||||
$agent_id = pandora_create_agent (\%conf, $conf{'servername'}, $host_name, $addr, $target_group, 0, 11, '', 300, $dbh);
|
||||
|
||||
create_ipmi_modules(\%conf, $dbh, $addr, $username, $password, $agent_id);
|
||||
create_ipmi_modules(\%conf, $dbh, $addr, $username, $password, $extraopts, $agent_id);
|
||||
}
|
||||
|
||||
# Generate an event
|
||||
|
|
Loading…
Reference in New Issue