Merge branch 'features/oracle' of https://github.com/pandorafms/pandorafms into features/oracle

This commit is contained in:
mdtrooper 2015-06-02 19:10:15 +02:00
commit 9bba19235e
44 changed files with 445 additions and 457 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.0dev-150526
Version: 6.0dev-150602
Architecture: all
Priority: optional
Section: admin

View File

@ -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

View File

@ -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");
}

View File

@ -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}

View File

@ -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}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150526}
{150602}
ViewReadme
{Yes}

View File

@ -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;

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150527
Version: 6.0dev-150602
Architecture: all
Priority: optional
Section: admin

View File

@ -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

View File

@ -120,3 +120,18 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri
-- ---------------------------------------------------------------------
INSERT INTO `tevent_response` VALUES (6,'Ping&#x20;to&#x20;module&#x20;agent&#x20;host','Ping&#x20;to&#x20;the&#x20;module&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_module_address_','command',0,620,500,0,'');
-- ---------------------------------------------------------------------
-- Table `tplugin`
-- ---------------------------------------------------------------------
UPDATE `tplugin`
SET `macros` = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target&#x20;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&#x20;Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}',
SET `parameters` = '-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_'
WHERE `id` = 1 AND `name` = 'IPMI&#x20;Plugin';
-- ---------------------------------------------------------------------
-- Table `trecon_script`
-- ---------------------------------------------------------------------
UPDATE `trecon_script` SET
`description` = 'Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0',
`macros` = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.:&#x20;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&#x20;parameters\",\"help\":\"Optional&#x20;additional&#x20;parameters&#x20;such&#x20;as&#x20;-D&#x20;LAN_2_0&#x20;to&#x20;use&#x20;IPMI&#x20;ver&#x20;2.0&#x20;instead&#x20;of&#x20;1.5.&#x20;&#x20;These&#x20;options&#x20;will&#x20;also&#x20;be&#x20;passed&#x20;to&#x20;the&#x20;IPMI&#x20;plugin&#x20;when&#x20;the&#x20;current&#x20;values&#x20;are&#x20;read.\",\"value\":\"\",\"hide\":\"\"}}'
WHERE `id_recon_script` = 2 AND `name` = 'IPMI&#x20;Recon';

View File

@ -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&#x20;address\",\"Subject\",\"Text\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]', fields_values = '[\"\",\"\",\"_html_editor_\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id = 1 AND name = 'eMail';
UPDATE talert_commands SET fields_descriptions = '["Destination&#x20;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&#x20;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&#x20;Options","help":"","value":"","hide":""}}',
SET parameters = '-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_'
WHERE id = 1 AND name = 'IPMI&#x20;Plugin';
-- ---------------------------------------------------------------------
-- Table trecon_script
-- ---------------------------------------------------------------------
UPDATE trecon_script SET
description = 'Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0',
macros = '{"1":{"macro":"_field1_","desc":"Network","help":"i.e.:&#x20;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&#x20;parameters","help":"Optional&#x20;additional&#x20;parameters&#x20;such&#x20;as&#x20;-D&#x20;LAN_2_0&#x20;to&#x20;use&#x20;IPMI&#x20;ver&#x20;2.0&#x20;instead&#x20;of&#x20;1.5.&#x20;&#x20;These&#x20;options&#x20;will&#x20;also&#x20;be&#x20;passed&#x20;to&#x20;the&#x20;IPMI&#x20;plugin&#x20;when&#x20;the&#x20;current&#x20;values&#x20;are&#x20;read.","value":"","hide":""}}'
WHERE id_recon_script = 2 AND name = 'IPMI&#x20;Recon';

View File

@ -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&#x20;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&#x20;Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}',
"parameters" = '-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_'
WHERE "id" = 1 AND "name" = 'IPMI&#x20;Plugin';
-- ---------------------------------------------------------------------
-- Table `trecon_script`
-- ---------------------------------------------------------------------
UPDATE "trecon_script"SET
"description" = 'Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0',
"macros" = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.:&#x20;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&#x20;parameters\",\"help\":\"Optional&#x20;additional&#x20;parameters&#x20;such&#x20;as&#x20;-D&#x20;LAN_2_0&#x20;to&#x20;use&#x20;IPMI&#x20;ver&#x20;2.0&#x20;instead&#x20;of&#x20;1.5.&#x20;&#x20;These&#x20;options&#x20;will&#x20;also&#x20;be&#x20;passed&#x20;to&#x20;the&#x20;IPMI&#x20;plugin&#x20;when&#x20;the&#x20;current&#x20;values&#x20;are&#x20;read.\",\"value\":\"\",\"hide\":\"\"}}'
WHERE "id_recon_script" = 2 AND "name" = 'IPMI&#x20;Recon';

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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",

View File

@ -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']);

View File

@ -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 ();

View File

@ -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;

View File

@ -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.

View File

@ -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;
}

View File

@ -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) {

View File

@ -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";

View File

@ -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;

View File

@ -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));
}
}

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '6.0dev';
$build = '150526';
$build = '150602';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -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&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=name&amp;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&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=description&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=description&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
$table->size[1] = "30%";
$table->head[2] = __('OS'). ' ' .

View File

@ -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[] = '';

View File

@ -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

View File

@ -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

View File

@ -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&#x20;Recon','Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_fiedl3&#x20;=&#x20;Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"i.e.:&#x20;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&#x20;Recon','Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"i.e.:&#x20;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&#x20;parameters","help":"Optional&#x20;additional&#x20;parameters&#x20;such&#x20;as&#x20;-D&#x20;LAN_2_0&#x20;to&#x20;use&#x20;IPMI&#x20;ver&#x20;2.0&#x20;instead&#x20;of&#x20;1.5.&#x20;&#x20;These&#x20;options&#x20;will&#x20;also&#x20;be&#x20;passed&#x20;to&#x20;the&#x20;IPMI&#x20;plugin&#x20;when&#x20;the&#x20;current&#x20;values&#x20;are&#x20;read.","value":"","hide":""}}');
INSERT INTO trecon_script VALUES (4,'SNMP&#x20;L2&#x20;Recon','Pandora&#x20;FMS&#x20;SNMP&#x20;Recon&#x20;Plugin&#x20;for&#x20;level&#x20;2&#x20;network&#x20;topology&#x20;discovery.&#x0d;&#x0a;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2014&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x0d;&#x0a;&#x0d;&#x0a;&#x20;&#x20;&#x20;./snmp-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;[custom_field3]&#x20;[custom_field4]&#x0d;&#x0a;&#x0d;&#x0a;&#x20;*&#x20;custom_field1&#x20;=&#x20;comma&#x20;separated&#x20;list&#x20;of&#x20;networks&#x20;&#40;i.e.:&#x20;192.168.1.0/24,192.168.2.0/24&#41;&#x0d;&#x0a;&#x20;*&#x20;custom_field2&#x20;=&#x20;comma&#x20;separated&#x20;list&#x20;of&#x20;snmp&#x20;communities&#x20;to&#x20;try.&#x0d;&#x0a;&#x20;*&#x20;custom_field3&#x20;=&#x20;a&#x20;router&#x20;in&#x20;the&#x20;network.&#x20;Optional&#x20;but&#x20;recommended.&#x0d;&#x0a;&#x20;*&#x20;custom_field4&#x20;=&#x20;set&#x20;to&#x20;-a&#x20;to&#x20;add&#x20;all&#x20;network&#x20;interfaces&#x20;&#40;by&#x20;default&#x20;only&#x20;interfaces&#x20;that&#x20;are&#x20;up&#x20;are&#x20;added&#41;.&#x0d;&#x0a;&#x0d;&#x0a;&#x20;Additional&#x20;information:&#x0d;&#x0a;When&#x20;the&#x20;script&#x20;is&#x20;called&#x20;from&#x20;a&#x20;recon&#x20;task&#x20;the&#x20;task_id,&#x20;group_id&#x20;and&#x20;create_incident&#x20;parameters&#x20;are&#x20;automatically&#x20;filled&#x20;by&#x20;the&#x20;Pandora&#x20;FMS&#x20;Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"Comma&#x20;separated&#x20;list&#x20;of&#x20;networks&#x20;&#40;i.e.:&#x20;192.168.1.0/24,192.168.2.0/24&#41;","value":"","hide":""},"2":{"macro":"_field2_","desc":"Community","help":"Comma&#x20;separated&#x20;list&#x20;of&#x20;snmp&#x20;communities&#x20;to&#x20;try.","value":"","hide":""},"3":{"macro":"_field3_","desc":"Router","help":"A&#x20;router&#x20;in&#x20;the&#x20;network.&#x20;Optional&#x20;but&#x20;recommended.","value":"","hide":""},"4":{"macro":"_field4_","desc":"Optional&#x20;parameter","help":"Set&#x20;to&#x20;-a&#x20;to&#x20;add&#x20;all&#x20;network&#x20;interfaces&#x20;&#40;by&#x20;default&#x20;only&#x20;interfaces&#x20;that&#x20;are&#x20;up&#x20;are&#x20;added&#41;.","value":"","hide":""}}');
INSERT INTO trecon_script VALUES (5,'WMI&#x20;Recon&#x20;Script','This&#x20;script&#x20;is&#x20;used&#x20;to&#x20;automatically&#x20;gather&#x20;host&#x20;information&#x20;via&#x20;WMI.&#x0d;&#x0a;Available&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;Network&#x20;=&#x20;network&#x20;to&#x20;scan&#x20;&#40;e.g.&#x20;192.168.100.0/24&#41;.&#x0d;&#x0a;*&#x20;WMI&#x20;auth&#x20;=&#x20;comma&#x20;separated&#x20;list&#x20;of&#x20;WMI&#x20;authentication&#x20;tokens&#x20;in&#x20;the&#x20;format&#x20;username%password&#x20;&#40;e.g.&#x20;Administrador%pass&#41;.&#x0d;&#x0a;&#x0d;&#x0a;See&#x20;the&#x20;documentation&#x20;for&#x20;more&#x20;information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{"1":{"macro":"_field1_","desc":"Network","help":"","value":"","hide":""},"2":{"macro":"_field2_","desc":"WMI&#x20;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&#x20;Plugin','Plugin&#x20;to&#x20;get&#x20;IPMI&#x20;monitors&#x20;from&#x20;a&#x20;IPMI&#x20;Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:""},2:{macro:"_field2_",desc:Username,help:"",value:""},3:{macro:"_field3_",desc:Password,help:"",value:""}}','-h&#x20;_field1_-u&#x20;_field2_-p&#x20;_field3_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI&#x20;Plugin','Plugin&#x20;to&#x20;get&#x20;IPMI&#x20;monitors&#x20;from&#x20;a&#x20;IPMI&#x20;Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{1:{macro:"_field1_",desc:Target&#x20;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&#x20;Options","help":"","value":"","hide":""}}','-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (2,'DNS&#x20;Plugin','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;check&#x20;if&#x20;a&#x20;specific&#x20;domain&#x20;return&#x20;a&#x20;specific&#x20;IP&#x20;address,&#x20;and&#x20;to&#x20;check&#x20;how&#x20;time&#x20;&#40;milisecs&#41;&#x20;takes&#x20;the&#x20;DNS&#x20;to&#x20;answer.&#x20;Use&#x20;IP&#x20;address&#x20;parameter&#x20;to&#x20;specify&#x20;the&#x20;IP&#x20;of&#x20;your&#x20;domain.&#x20;Use&#x20;these&#x20;custom&#x20;parameters&#x20;for&#x20;the&#x20;other&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;domain&#x20;to&#x20;check&#x20;&#40;for&#x20;example&#x20;pandorafms.com&#41;&#x0d;&#x0a;-s&#x20;DNS&#x20;Server&#x20;to&#x20;check&#x20;&#x20;&#40;for&#x20;example&#x20;8.8.8.8&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-t&#x20;Do&#x20;a&#x20;DNS&#x20;time&#x20;response&#x20;check&#x20;instead&#x20;DNS&#x20;resolve&#x20;test&#x0d;&#x0a;&#x0d;&#x0a;',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:""},2:{macro:"_field2_",desc:Domain&#x20;to&#x20;check,help:For&#x20;example&#x20;pandorafms.com,value:""},3:{macro:"_field3_",desc:DNS&#x20;Server&#x20;to&#x20;check,help:For&#x20;example&#x20;8.8.8.8,value:""},4:{macro:"_field4_",desc:Optional&#x20;parameters,help:"",value:""}}','-i&#x20;_field1_&#x20;-d&#x20;_field2_&#x20;-s&#x20;_field3_&#x20;_field4_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (3,'UDP&#x20;port&#x20;check','Check&#x20;a&#x20;remote&#x20;UDP&#x20;port&#x20;&#40;by&#x20;using&#x20;NMAP&#41;.&#x20;Use&#x20;IP&#x20;address&#x20;and&#x20;Port&#x20;options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:""},2:{macro:"_field2_",desc:Port,help:"",value:""}}','-t&#x20;_field1_-p&#x20;_field2_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (4,'SMTP&#x20;Check','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;send&#x20;a&#x20;mail&#x20;to&#x20;a&#x20;SMTP&#x20;server&#x20;and&#x20;check&#x20;if&#x20;works.&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Parameters&#x20;in&#x20;the&#x20;plugin:&#x0d;&#x0a;&#x0d;&#x0a;IP&#x20;Address&#x20;-&#x20;SMTP&#x20;Server&#x20;IP&#x20;address&#x0d;&#x0a;User&#x20;-&#x20;AUTH&#x20;login&#x20;&#x20;&#x0d;&#x0a;Pass&#x20;-&#x20;AUTH&#x20;password&#x0d;&#x0a;Port&#x20;-&#x20;SMTP&#x20;port&#x20;&#40;optional&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;Destination&#x20;email&#x0d;&#x0a;-f&#x20;Email&#x20;of&#x20;the&#x20;sender&#x0d;&#x0a;-a&#x20;Authentication&#x20;system.&#x20;Could&#x20;be&#x20;LOGIN,&#x20;PLAIN,&#x20;CRAM-MD5&#x20;or&#x20;DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{1:{macro:"_field1_",desc:Target&#x20;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&#x20;parameters,help:"",value:""}}','-h&#x20;_field1_&#x20;-o&#x20;_field2_&#x20;-u&#x20;_field3_&#x20;-p&#x20;_field4_&#x20;_field5_');

File diff suppressed because one or more lines are too long

View File

@ -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&#x20;Report&#x20;Alerts', 'select&#x20;t1.nombre&#x20;as&#x20;agent_name,&#x20;t2.nombre&#x20;as&#x20;module_name,&#x20;&#40;select&#x20;talert_templates.name&#x20;from&#x20;talert_templates&#x20;where&#x20;talert_templates.id&#x20;=&#x20;t3.id_alert_template&#41;&#x20;as&#x20;template,&#x20;&#40;select&#x20;group_concat&#40;t02.name&#41;&#x20;from&#x20;talert_template_module_actions&#x20;as&#x20;t01&#x20;inner&#x20;join&#x20;talert_actions&#x20;as&#x20;t02&#x20;on&#x20;t01.id_alert_action&#x20;=&#x20;t02.id&#x20;where&#x20;t01.id_alert_template_module&#x20;=&#x20;t3.id&#x20;group&#x20;by&#x20;t01.id_alert_template_module&#41;&#x20;as&#x20;actions&#x20;from&#x20;tagente&#x20;as&#x20;t1&#x20;inner&#x20;join&#x20;tagente_modulo&#x20;as&#x20;t2&#x20;on&#x20;t1.id_agente&#x20;=&#x20;t2.id_agente&#x20;inner&#x20;join&#x20;talert_template_modules&#x20;as&#x20;t3&#x20;on&#x20;t2.id_agente_modulo&#x20;=&#x20;t3.id_agent_module&#x20;order&#x20;by&#x20;agent_name,&#x20;module_name;');
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group&#x20;view', 'select&#x20;t1.nombre,&#x20;&#40;select&#x20;count&#40;t3.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t3&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t3.id_grupo&#41;&#x20;as&#x20;agents,&#x20;&#40;SELECT&#x20;COUNT&#40;t4.id_agente&#41;&#x20;FROM&#x20;tagente&#x20;as&#x20;t4&#x20;WHERE&#x20;t4.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;t4.disabled&#x20;=&#x20;0&#x20;AND&#x20;t4.ultimo_contacto&#x20;&lt;&#x20;NOW&#40;&#41;&#x20;-&#x20;&#40;intervalo&#x20;/&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;agent_unknown,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;utimestamp&#x20;&gt;&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#40;21,22,23,24,100&#41;&#x20;AND&#x20;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&gt;=&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;monitor_unknow,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#x20;&#40;21,22,23,24&#41;&#x20;AND&#x20;utimestamp&#x20;=&#x20;0&#41;&#x20;as&#x20;monitor_no_init,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;0&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;&#40;utimestamp&#x20;&gt;&#x20;0&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24&#41;&#41;&#41;&#41;&#x20;as&#x20;monitor_ok,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;1&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;utimestamp&#x20;&gt;&#x20;0&#41;&#x20;as&#x20;monitor_critical,&#x20;&#40;SELECT&#x20;COUNT&#40;talert_template_modules.id&#41;&#x20;FROM&#x20;talert_template_modules,&#x20;tagente_modulo,&#x20;tagente_estado,&#x20;tagente&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente_modulo.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;talert_template_modules.id_agent_module&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;times_fired&#x20;&gt;&#x20;0&#41;&#x20;as&#x20;monitor_alert_fired&#x20;from&#x20;tgrupo&#x20;as&#x20;t1&#x20;where&#x20;0&#x20;&lt;&#x20;&#40;select&#x20;count&#40;t2.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t2&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t2.id_grupo&#41;');
INSERT INTO `trecon_script` VALUES (2,'IPMI&#x20;Recon','Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_fiedl3&#x20;=&#x20;Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.:&#x20;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&#x20;Recon','Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident_flag&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.:&#x20;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&#x20;parameters\",\"help\":\"Optional&#x20;additional&#x20;parameters&#x20;such&#x20;as&#x20;-D&#x20;LAN_2_0&#x20;to&#x20;use&#x20;IPMI&#x20;ver&#x20;2.0&#x20;instead&#x20;of&#x20;1.5.&#x20;&#x20;These&#x20;options&#x20;will&#x20;also&#x20;be&#x20;passed&#x20;to&#x20;the&#x20;IPMI&#x20;plugin&#x20;when&#x20;the&#x20;current&#x20;values&#x20;are&#x20;read.\",\"value\":\"\",\"hide\":\"\"}}');
INSERT INTO `trecon_script` VALUES (4,'SNMP&#x20;L2&#x20;Recon','Pandora&#x20;FMS&#x20;SNMP&#x20;Recon&#x20;Plugin&#x20;for&#x20;level&#x20;2&#x20;network&#x20;topology&#x20;discovery.&#x0d;&#x0a;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2014&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x0d;&#x0a;&#x0d;&#x0a;&#x20;&#x20;&#x20;./snmp-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;create_incident&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;[custom_field3]&#x20;[custom_field4]&#x0d;&#x0a;&#x0d;&#x0a;&#x20;*&#x20;custom_field1&#x20;=&#x20;comma&#x20;separated&#x20;list&#x20;of&#x20;networks&#x20;&#40;i.e.:&#x20;192.168.1.0/24,192.168.2.0/24&#41;&#x0d;&#x0a;&#x20;*&#x20;custom_field2&#x20;=&#x20;comma&#x20;separated&#x20;list&#x20;of&#x20;snmp&#x20;communities&#x20;to&#x20;try.&#x0d;&#x0a;&#x20;*&#x20;custom_field3&#x20;=&#x20;a&#x20;router&#x20;in&#x20;the&#x20;network.&#x20;Optional&#x20;but&#x20;recommended.&#x0d;&#x0a;&#x20;*&#x20;custom_field4&#x20;=&#x20;set&#x20;to&#x20;-a&#x20;to&#x20;add&#x20;all&#x20;network&#x20;interfaces&#x20;&#40;by&#x20;default&#x20;only&#x20;interfaces&#x20;that&#x20;are&#x20;up&#x20;are&#x20;added&#41;.&#x0d;&#x0a;&#x0d;&#x0a;&#x20;Additional&#x20;information:&#x0d;&#x0a;When&#x20;the&#x20;script&#x20;is&#x20;called&#x20;from&#x20;a&#x20;recon&#x20;task&#x20;the&#x20;task_id,&#x20;group_id&#x20;and&#x20;create_incident&#x20;parameters&#x20;are&#x20;automatically&#x20;filled&#x20;by&#x20;the&#x20;Pandora&#x20;FMS&#x20;Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Comma&#x20;separated&#x20;list&#x20;of&#x20;networks&#x20;&#40;i.e.:&#x20;192.168.1.0/24,192.168.2.0/24&#41;\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Comma&#x20;separated&#x20;list&#x20;of&#x20;snmp&#x20;communities&#x20;to&#x20;try.\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Router\",\"help\":\"A&#x20;router&#x20;in&#x20;the&#x20;network.&#x20;Optional&#x20;but&#x20;recommended.\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Optional&#x20;parameter\",\"help\":\"Set&#x20;to&#x20;-a&#x20;to&#x20;add&#x20;all&#x20;network&#x20;interfaces&#x20;&#40;by&#x20;default&#x20;only&#x20;interfaces&#x20;that&#x20;are&#x20;up&#x20;are&#x20;added&#41;.\",\"value\":\"\",\"hide\":\"\"}}');
INSERT INTO `trecon_script` VALUES (5,'WMI&#x20;Recon&#x20;Script','This&#x20;script&#x20;is&#x20;used&#x20;to&#x20;automatically&#x20;gather&#x20;host&#x20;information&#x20;via&#x20;WMI.&#x0d;&#x0a;Available&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;Network&#x20;=&#x20;network&#x20;to&#x20;scan&#x20;&#40;e.g.&#x20;192.168.100.0/24&#41;.&#x0d;&#x0a;*&#x20;WMI&#x20;auth&#x20;=&#x20;comma&#x20;separated&#x20;list&#x20;of&#x20;WMI&#x20;authentication&#x20;tokens&#x20;in&#x20;the&#x20;format&#x20;username%password&#x20;&#40;e.g.&#x20;Administrador%pass&#41;.&#x0d;&#x0a;&#x0d;&#x0a;See&#x20;the&#x20;documentation&#x20;for&#x20;more&#x20;information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"WMI&#x20;auth\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}');
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI&#x20;Plugin','Plugin&#x20;to&#x20;get&#x20;IPMI&#x20;monitors&#x20;from&#x20;a&#x20;IPMI&#x20;Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":""}}','-h&#x20;_field1_-u&#x20;_field2_-p&#x20;_field3_');
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI&#x20;Plugin','Plugin&#x20;to&#x20;get&#x20;IPMI&#x20;monitors&#x20;from&#x20;a&#x20;IPMI&#x20;Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target&#x20;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&#x20;Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_');
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (2,'DNS&#x20;Plugin','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;check&#x20;if&#x20;a&#x20;specific&#x20;domain&#x20;return&#x20;a&#x20;specific&#x20;IP&#x20;address,&#x20;and&#x20;to&#x20;check&#x20;how&#x20;time&#x20;&#40;milisecs&#41;&#x20;takes&#x20;the&#x20;DNS&#x20;to&#x20;answer.&#x20;Use&#x20;IP&#x20;address&#x20;parameter&#x20;to&#x20;specify&#x20;the&#x20;IP&#x20;of&#x20;your&#x20;domain.&#x20;Use&#x20;these&#x20;custom&#x20;parameters&#x20;for&#x20;the&#x20;other&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;domain&#x20;to&#x20;check&#x20;&#40;for&#x20;example&#x20;pandorafms.com&#41;&#x0d;&#x0a;-s&#x20;DNS&#x20;Server&#x20;to&#x20;check&#x20;&#x20;&#40;for&#x20;example&#x20;8.8.8.8&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-t&#x20;Do&#x20;a&#x20;DNS&#x20;time&#x20;response&#x20;check&#x20;instead&#x20;DNS&#x20;resolve&#x20;test&#x0d;&#x0a;&#x0d;&#x0a;',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain&#x20;to&#x20;check","help":"For&#x20;example&#x20;pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS&#x20;Server&#x20;to&#x20;check","help":"For&#x20;example&#x20;8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional&#x20;parameters","help":"","value":""}}','-i&#x20;_field1_&#x20;-d&#x20;_field2_&#x20;-s&#x20;_field3_&#x20;_field4_');

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150526
Version: 6.0dev-150602
Architecture: all
Priority: optional
Section: admin

View File

@ -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

View File

@ -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 => '',

View File

@ -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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150526
%define release 150602
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150526
%define release 150602
Summary: Pandora FMS Server
Name: %{name}

View File

@ -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;

View File

@ -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);

View File

@ -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";
}

View File

@ -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