several fixes in netscan custom

This commit is contained in:
alejandro-campos 2020-12-18 11:40:22 +01:00
parent 30650abaf0
commit f03b4e59f8
5 changed files with 12 additions and 10 deletions

View File

@ -12,4 +12,6 @@ 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';
COMMIT;

View File

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

View File

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

View File

@ -1169,7 +1169,7 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group vi
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,&#x20RDS,&#x20AWS.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> <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` (`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 `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_');

View File

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