Merge branch 'ent-6855-Casca-netscan-custom-en-la-open' into 'develop'
several fixes in netscan custom See merge request artica/pandorafms!3736
This commit is contained in:
commit
d4050ad0ce
|
@ -131,6 +131,8 @@ ADD COLUMN `field16` TEXT NOT NULL AFTER `field15`
|
|||
,ADD COLUMN `field19_recovery` TEXT NOT NULL AFTER `field18_recovery`
|
||||
,ADD COLUMN `field20_recovery` TEXT NOT NULL AFTER `field19_recovery`;
|
||||
|
||||
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> <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' WHERE `name`='IPMI Recon';
|
||||
|
||||
ALTER TABLE `trecon_task` MODIFY COLUMN `review_mode` TINYINT(1) UNSIGNED DEFAULT 1;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -2683,6 +2683,7 @@ CREATE TABLE `tremote_command_target` (
|
|||
-- Table `trecon_script`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `trecon_script` ADD COLUMN `type` int(11) NOT NULL DEFAULT '0';
|
||||
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> <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' WHERE `name`='IPMI Recon';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario_perfil`
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* Hook in Host&Devices for CSV import.
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Host&Devices - CSV Import Agents
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ==========================================================
|
||||
* Copyright (c) 2004-2019 Artica Soluciones Tecnológicas S.L
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
$get_explanation = (bool) get_parameter('get_explanation', 0);
|
||||
$get_recon_script_macros = get_parameter('get_recon_script_macros', 0);
|
||||
|
||||
if ($get_explanation) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
$explanation = db_get_value(
|
||||
'description',
|
||||
'trecon_script',
|
||||
'id_recon_script',
|
||||
$id
|
||||
);
|
||||
|
||||
echo io_safe_output($explanation);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_recon_script_macros) {
|
||||
$id_recon_script = (int) get_parameter('id');
|
||||
$id_recon_task = (int) get_parameter('id_rt');
|
||||
|
||||
if (!empty($id_recon_task) && empty($id_recon_script)) {
|
||||
$recon_script_macros = db_get_value(
|
||||
'macros',
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$id_recon_task
|
||||
);
|
||||
} else if (!empty($id_recon_task)) {
|
||||
$recon_task_id_rs = (int) db_get_value(
|
||||
'id_recon_script',
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$id_recon_task
|
||||
);
|
||||
|
||||
if ($id_recon_script == $recon_task_id_rs) {
|
||||
$recon_script_macros = db_get_value(
|
||||
'macros',
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$id_recon_task
|
||||
);
|
||||
} else {
|
||||
$recon_script_macros = db_get_value(
|
||||
'macros',
|
||||
'trecon_script',
|
||||
'id_recon_script',
|
||||
$id_recon_script
|
||||
);
|
||||
}
|
||||
} else if (!empty($id_recon_script)) {
|
||||
$recon_script_macros = db_get_value(
|
||||
'macros',
|
||||
'trecon_script',
|
||||
'id_recon_script',
|
||||
$id_recon_script
|
||||
);
|
||||
} else {
|
||||
$recon_script_macros = [];
|
||||
}
|
||||
|
||||
$macros = [];
|
||||
$macros['base64'] = base64_encode($recon_script_macros);
|
||||
$macros['array'] = json_decode($recon_script_macros, true);
|
||||
|
||||
echo io_json_mb_encode($macros);
|
||||
return;
|
||||
}
|
|
@ -1225,7 +1225,7 @@ function get_explanation_recon_script(id, id_rt, url) {
|
|||
|
||||
var xhr = jQuery.ajax({
|
||||
data: {
|
||||
page: "enterprise/include/ajax/hostDevices.ajax",
|
||||
page: "include/ajax/hostDevices.ajax",
|
||||
get_explanation: 1,
|
||||
id: id,
|
||||
id_rt: id_rt
|
||||
|
@ -1253,7 +1253,7 @@ function get_explanation_recon_script(id, id_rt, url) {
|
|||
|
||||
var xhr = jQuery.ajax({
|
||||
data: {
|
||||
page: "enterprise/include/ajax/hostDevices.ajax",
|
||||
page: "include/ajax/hostDevices.ajax",
|
||||
get_recon_script_macros: 1,
|
||||
id: id,
|
||||
id_rt: id_rt
|
||||
|
|
|
@ -1168,8 +1168,11 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group vi
|
|||
-- trecon scripts
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (1, 'Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (2, 'Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
|
||||
-- IPAM is 3.
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (4, 'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <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` (`type`,`name`,`description`,`script`,`macros`) VALUES (3, 'IPAM Recon', 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.', '/usr/share/pandora_server/util/recon_scripts/IPAMrecon.pl', '{"1":{"macro":"_field1_","desc":"Network","help":"i.e.: 192.168.100.0/24","value":"","hide":""}}');
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (4, '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 `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\":\"true\"},\"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_');
|
||||
|
||||
|
|
|
@ -38,13 +38,12 @@ if ($OSNAME eq "freebsd") {
|
|||
|
||||
my $task_id = $ARGV[0]; # Passed automatically by the server
|
||||
my $target_group = $ARGV[1]; # Defined by user
|
||||
my $create_incident = $ARGV[2]; # Defined by user
|
||||
|
||||
# Used Custom Fields in this script
|
||||
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
|
||||
my $target_network = $ARGV[2]; # Filed1 defined by user
|
||||
my $username = $ARGV[3]; # Field2 defined by user
|
||||
my $password = $ARGV[4]; # Field3 defined by user
|
||||
my $extraopts = $ARGV[5]; # Field4 defined by user
|
||||
|
||||
# Map Sensor type to module type and thresholds
|
||||
# 0 = numeric, record has thresholds
|
||||
|
@ -115,7 +114,7 @@ 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> <custom_field4>\n\n";
|
||||
print " $0 <task_id> <group_id> <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_field3 = password \n";
|
||||
|
@ -264,7 +263,7 @@ if (! defined ($net_addr)) {
|
|||
# Scan the network for host
|
||||
my ($total_hosts, $hosts_found, $addr_found) = ($net_addr->num, 0, '');
|
||||
|
||||
for (my $i = 1; $net_addr < $net_addr->broadcast; $i++, $net_addr++) {
|
||||
for (my $i = 1; $i<= $total_hosts && $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;
|
||||
|
|
Loading…
Reference in New Issue