From e943bf0ada79f34f2138452ebaa66dec685e45af Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Tue, 26 May 2015 11:01:17 -0700 Subject: [PATCH] Fix IPMI recon script so that it works with new style custom fields Updates the IPMI recon script to pass parameters to the IPMI plugin using the new style custom fields. Add a field for specifying additonal options to ipmi-sensors. This is required for IPMI v2.0 devices and when using accounts with restricted privileges. Fix some types in the description for the recon script. Fix a bug where the recon script never completed and kept processing the subnet over and over due to an incorrect exit condition in the loop. Change the packet count and timeout passed to ipmiping. The previous values required 9 seconds per address polled. This meant it took almost 40 minutes to scan one 256 address subnet. --- .../pandoradb_migrate_5.1_to_6.0.mysql.sql | 15 +++++++ .../pandoradb_migrate_5.1_to_6.0.oracle.sql | 16 +++++++ ...andoradb_migrate_5.1_to_6.0.postgreSQL.sql | 16 +++++++ pandora_console/pandoradb.data.oracle.sql | 4 +- pandora_console/pandoradb.data.postgreSQL.sql | 4 +- pandora_console/pandoradb_data.sql | 4 +- pandora_server/util/plugin/ipmi-plugin.pl | 10 ++++- .../util/recon_scripts/ipmi-recon.pl | 45 +++++++++---------- 8 files changed, 81 insertions(+), 33 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql index bab26c2050..8b722be59c 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql @@ -120,3 +120,18 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri -- --------------------------------------------------------------------- INSERT INTO `tevent_response` VALUES (6,'Ping to module agent host','Ping to the module agent host','ping -c 5 _module_address_','command',0,620,500,0,''); +-- --------------------------------------------------------------------- +-- Table `tplugin` +-- --------------------------------------------------------------------- +UPDATE `tplugin` + SET `macros` = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}', + SET `parameters` = '-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_' +WHERE `id` = 1 AND `name` = 'IPMI Plugin'; + +-- --------------------------------------------------------------------- +-- Table `trecon_script` +-- --------------------------------------------------------------------- +UPDATE `trecon_script` + SET `description` = 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0', + SET `macros` = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}' +WHERE `id_recon_script` = 2 AND `name` = 'IPMI Recon'; diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql index 1edf86c129..d26764c3a5 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql @@ -93,3 +93,19 @@ CREATE TABLE tsessions_php ( last_active NUMBER(20, 0) NOT NULL, data CLOB default '' ); + +-- --------------------------------------------------------------------- +-- Table tplugin +-- --------------------------------------------------------------------- +UPDATE tplugin + SET macros = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}', + SET parameters = '-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_' +WHERE id = 1 AND name = 'IPMI Plugin'; + +-- --------------------------------------------------------------------- +-- Table trecon_script +-- --------------------------------------------------------------------- +UPDATE trecon_script + SET description = 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0', + SET macros = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}' +WHERE id_recon_script = 2 AND name = 'IPMI Recon'; diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql index 154d65b308..2b9995edfe 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql @@ -91,3 +91,19 @@ CREATE TABLE "tsessions_php" ( "last_active" INTEGER NOT NULL, "data" TEXT default '' ); + +-- --------------------------------------------------------------------- +-- Table tplugin +-- --------------------------------------------------------------------- +UPDATE "tplugin" + SET "macros" = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}', + SET "parameters" = '-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_' +WHERE "id" = 1 AND "name" = 'IPMI Plugin'; + +-- --------------------------------------------------------------------- +-- Table `trecon_script` +-- --------------------------------------------------------------------- +UPDATE "trecon_script" + SET "description" = 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0', + SET "macros" = '{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}' +WHERE "id_recon_script" = 2 AND "name" = 'IPMI Recon'; diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index cc136482f9..bd748df316 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -1169,11 +1169,11 @@ treport_custom_sql_insert(4, 'Group view','< (select count COMMIT; END;; -INSERT INTO trecon_script VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_fiedl3 = Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"}}'); +INSERT INTO trecon_script VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'); INSERT INTO trecon_script VALUES (4,'SNMP L2 Recon','Pandora FMS SNMP Recon Plugin for level 2 network topology discovery. (c) Artica ST 2014 <info@artica.es> Usage: ./snmp-recon.pl <task_id> <group_id> <create_incident> <custom_field1> <custom_field2> [custom_field3] [custom_field4] * custom_field1 = comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24) * custom_field2 = comma separated list of snmp communities to try. * custom_field3 = a router in the network. Optional but recommended. * custom_field4 = set to -a to add all network interfaces (by default only interfaces that are up are added). Additional information: When the script is called from a recon task the task_id, group_id and create_incident parameters are automatically filled by the Pandora FMS Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Comma separated list of snmp communities to try.\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Router\",\"help\":\"A router in the network. Optional but recommended.\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Optional parameter\",\"help\":\"Set to -a to add all network interfaces (by default only interfaces that are up are added).\",\"value\":\"\",\"hide\":\"\"}}'); INSERT INTO trecon_script VALUES (5,'WMI Recon Script','This script is used to automatically gather host information via WMI. Available parameters: * Network = network to scan (e.g. 192.168.100.0/24). * WMI auth = comma separated list of WMI authentication tokens in the format username%password (e.g. Administrador%pass). See the documentation for more information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"WMI auth\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}'); -INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":""}}','-h _field1_-u _field2_-p _field3_'),(2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters: -d domain to check (for example pandorafms.com) -s DNS Server to check (for example 8.8.8.8) Optional parameters: -t Do a DNS time response check instead DNS resolve test ',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain to check","help":"For example pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS Server to check","help":"For example 8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional parameters","help":"","value":""}}','-i _field1_ -d _field2_ -s _field3_ _field4_'),(3,'UDP port check','Check a remote UDP port (by using NMAP). Use IP address and Port options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""}}','-t _field1_-p _field2_'),(4,'SMTP Check','This plugin is used to send a mail to a SMTP server and check if works. Parameters in the plugin: IP Address - SMTP Server IP address User - AUTH login Pass - AUTH password Port - SMTP port (optional) Optional parameters: -d Destination email -f Email of the sender -a Authentication system. Could be LOGIN, PLAIN, CRAM-MD5 or DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""},"3":{"macro":"_field3_","desc":"Username","help":"","value":""},"4":{"macro":"_field4_","desc":"Password","help":"","value":""},"5":{"macro":"_field5_","desc":"Optional parameters","help":"","value":""}}','-h _field1_ -o _field2_ -u _field3_ -p _field4_ _field5_'), (6,'MySQL Plugin','Samples: ./mysql_plugin.sh -u root -p none -s localhost -q Com_select ./mysql_plugin.sh -u root -p none -s localhost -q Com_update ./mysql_plugin.sh -u root -p none -s localhost -q Connections ./mysql_plugin.sh -u root -p anypass -s 192.168.50.24 -q Innodb_rows_read ',15,'/usr/share/pandora_server/util/plugin/mysql_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"IP address","help":"IP address","value":""},"2":{"macro":"_field2_","desc":"Username","help":"Username to access to database","value":""},"3":{"macro":"_field3_","desc":"Password","help":"Password to access to database","value":""},"4":{"macro":"_field4_","desc":"Query string","help":"Query string of global status. For example 'Aborted_connects' or 'Innodb_rows_read'","value":""}}', '-s _field1_ -u _field2_ -p _field3_ -q _field4_'), (8,'SNMP remote','Plugin that gets remotely, using SNMP, values such as the percentage of disk or memory used, the status of a process or the CPU load',0,'perl /usr/share/pandora_server/util/plugin/snmp_remote.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":"_address_"},"2":{"macro":"_field2_","desc":"Community","help":"","value":"public"},"3":{"macro":"_field3_","desc":"Plug-in Parameters","help":"Memory use (%) -m memuse Disk use (%) -m diskuse -d [disk name] Status of a process (0/1) -m process -p [process_name] Average of CPUs Load (%) -m cpuload","value":""}}', '-H _field1_ -c _field2_ _field3_'); +INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'),(2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters: -d domain to check (for example pandorafms.com) -s DNS Server to check (for example 8.8.8.8) Optional parameters: -t Do a DNS time response check instead DNS resolve test ',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain to check","help":"For example pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS Server to check","help":"For example 8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional parameters","help":"","value":""}}','-i _field1_ -d _field2_ -s _field3_ _field4_'),(3,'UDP port check','Check a remote UDP port (by using NMAP). Use IP address and Port options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""}}','-t _field1_-p _field2_'),(4,'SMTP Check','This plugin is used to send a mail to a SMTP server and check if works. Parameters in the plugin: IP Address - SMTP Server IP address User - AUTH login Pass - AUTH password Port - SMTP port (optional) Optional parameters: -d Destination email -f Email of the sender -a Authentication system. Could be LOGIN, PLAIN, CRAM-MD5 or DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""},"3":{"macro":"_field3_","desc":"Username","help":"","value":""},"4":{"macro":"_field4_","desc":"Password","help":"","value":""},"5":{"macro":"_field5_","desc":"Optional parameters","help":"","value":""}}','-h _field1_ -o _field2_ -u _field3_ -p _field4_ _field5_'), (6,'MySQL Plugin','Samples: ./mysql_plugin.sh -u root -p none -s localhost -q Com_select ./mysql_plugin.sh -u root -p none -s localhost -q Com_update ./mysql_plugin.sh -u root -p none -s localhost -q Connections ./mysql_plugin.sh -u root -p anypass -s 192.168.50.24 -q Innodb_rows_read ',15,'/usr/share/pandora_server/util/plugin/mysql_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"IP address","help":"IP address","value":""},"2":{"macro":"_field2_","desc":"Username","help":"Username to access to database","value":""},"3":{"macro":"_field3_","desc":"Password","help":"Password to access to database","value":""},"4":{"macro":"_field4_","desc":"Query string","help":"Query string of global status. For example 'Aborted_connects' or 'Innodb_rows_read'","value":""}}', '-s _field1_ -u _field2_ -p _field3_ -q _field4_'), (8,'SNMP remote','Plugin that gets remotely, using SNMP, values such as the percentage of disk or memory used, the status of a process or the CPU load',0,'perl /usr/share/pandora_server/util/plugin/snmp_remote.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":"_address_"},"2":{"macro":"_field2_","desc":"Community","help":"","value":"public"},"3":{"macro":"_field3_","desc":"Plug-in Parameters","help":"Memory use (%) -m memuse Disk use (%) -m diskuse -d [disk name] Status of a process (0/1) -m process -p [process_name] Average of CPUs Load (%) -m cpuload","value":""}}', '-H _field1_ -c _field2_ _field3_'); INSERT INTO tagent_custom_fields VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0); diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 8abccd16c4..71f6d3a6ec 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -1018,11 +1018,11 @@ INSERT INTO "treport_custom_sql" ("id", "name", "sql") VALUES (3, 'Monitoring&#x INSERT INTO "treport_custom_sql" ("id", "name", "sql") VALUES (4, 'Group view', 'select t1.nombre, (select count(t3.id_agente) from tagente as t3 where t1.id_grupo = t3.id_grupo) as agents, (SELECT COUNT(t4.id_agente) FROM tagente as t4 WHERE t4.id_grupo = t1.id_grupo AND t4.disabled = 0 AND t4.ultimo_contacto < NOW() - (intervalo / (1/2))) as agent_unknown, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval / (1/2))) as monitor_unknow, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0) as monitor_no_init, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))) as monitor_ok, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0) as monitor_critical, (SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = t1.id_grupo AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0) as monitor_alert_fired from tgrupo as t1 where 0 < (select count(t2.id_agente) from tagente as t2 where t1.id_grupo = t2.id_grupo)'); SELECT setval('treport_custom_sql_id_seq', (SELECT (SELECT MAX(id) FROM treport_custom_sql))); -INSERT INTO "trecon_script" VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_fiedl3 = Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"}}'); +INSERT INTO "trecon_script" VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'); INSERT INTO "trecon_script" VALUES (4,'SNMP L2 Recon','Pandora FMS SNMP Recon Plugin for level 2 network topology discovery. (c) Artica ST 2014 <info@artica.es> Usage: ./snmp-recon.pl <task_id> <group_id> <create_incident> <custom_field1> <custom_field2> [custom_field3] [custom_field4] * custom_field1 = comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24) * custom_field2 = comma separated list of snmp communities to try. * custom_field3 = a router in the network. Optional but recommended. * custom_field4 = set to -a to add all network interfaces (by default only interfaces that are up are added). Additional information: When the script is called from a recon task the task_id, group_id and create_incident parameters are automatically filled by the Pandora FMS Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Comma separated list of snmp communities to try.\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Router\",\"help\":\"A router in the network. Optional but recommended.\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Optional parameter\",\"help\":\"Set to -a to add all network interfaces (by default only interfaces that are up are added).\",\"value\":\"\",\"hide\":\"\"}}'); INSERT INTO "trecon_script" VALUES (5,'WMI Recon Script','This script is used to automatically gather host information via WMI. Available parameters: * Network = network to scan (e.g. 192.168.100.0/24). * WMI auth = comma separated list of WMI authentication tokens in the format username%password (e.g. Administrador%pass). See the documentation for more information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"WMI auth\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}'); -INSERT INTO "tplugin" ("id", "name", "description", "max_timeout", "execute", "plugin_type", "macros", "parameters") VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":""}}','-h _field1_-u _field2_-p _field3_'),(2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters: -d domain to check (for example pandorafms.com) -s DNS Server to check (for example 8.8.8.8) Optional parameters: -t Do a DNS time response check instead DNS resolve test ',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain to check","help":"For example pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS Server to check","help":"For example 8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional parameters","help":"","value":""}}','-i _field1_ -d _field2_ -s _field3_ _field4_'),(3,'UDP port check','Check a remote UDP port (by using NMAP). Use IP address and Port options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""}}','-t _field1_-p _field2_'),(4,'SMTP Check','This plugin is used to send a mail to a SMTP server and check if works. Parameters in the plugin: IP Address - SMTP Server IP address User - AUTH login Pass - AUTH password Port - SMTP port (optional) Optional parameters: -d Destination email -f Email of the sender -a Authentication system. Could be LOGIN, PLAIN, CRAM-MD5 or DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""},"3":{"macro":"_field3_","desc":"Username","help":"","value":""},"4":{"macro":"_field4_","desc":"Password","help":"","value":""},"5":{"macro":"_field5_","desc":"Optional parameters","help":"","value":""}}','-h _field1_ -o _field2_ -u _field3_ -p _field4_ _field5_'), (6,'MySQL Plugin','Samples: ./mysql_plugin.sh -u root -p none -s localhost -q Com_select ./mysql_plugin.sh -u root -p none -s localhost -q Com_update ./mysql_plugin.sh -u root -p none -s localhost -q Connections ./mysql_plugin.sh -u root -p anypass -s 192.168.50.24 -q Innodb_rows_read ',15,'/usr/share/pandora_server/util/plugin/mysql_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"IP address","help":"IP address","value":""},"2":{"macro":"_field2_","desc":"Username","help":"Username to access to database","value":""},"3":{"macro":"_field3_","desc":"Password","help":"Password to access to database","value":""},"4":{"macro":"_field4_","desc":"Query string","help":"Query string of global status. For example 'Aborted_connects' or 'Innodb_rows_read'","value":""}}', '-s _field1_ -u _field2_ -p _field3_ -q _field4_'), (8,'SNMP remote','Plugin that gets remotely, using SNMP, values such as the percentage of disk or memory used, the status of a process or the CPU load',0,'perl /usr/share/pandora_server/util/plugin/snmp_remote.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":"_address_"},"2":{"macro":"_field2_","desc":"Community","help":"","value":"public"},"3":{"macro":"_field3_","desc":"Plug-in Parameters","help":"Memory use (%) -m memuse Disk use (%) -m diskuse -d [disk name] Status of a process (0/1) -m process -p [process_name] Average of CPUs Load (%) -m cpuload","value":""}}', '-H _field1_ -c _field2_ _field3_'); +INSERT INTO "tplugin" ("id", "name", "description", "max_timeout", "execute", "plugin_type", "macros", "parameters") VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'),(2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters: -d domain to check (for example pandorafms.com) -s DNS Server to check (for example 8.8.8.8) Optional parameters: -t Do a DNS time response check instead DNS resolve test ',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain to check","help":"For example pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS Server to check","help":"For example 8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional parameters","help":"","value":""}}','-i _field1_ -d _field2_ -s _field3_ _field4_'),(3,'UDP port check','Check a remote UDP port (by using NMAP). Use IP address and Port options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""}}','-t _field1_-p _field2_'),(4,'SMTP Check','This plugin is used to send a mail to a SMTP server and check if works. Parameters in the plugin: IP Address - SMTP Server IP address User - AUTH login Pass - AUTH password Port - SMTP port (optional) Optional parameters: -d Destination email -f Email of the sender -a Authentication system. Could be LOGIN, PLAIN, CRAM-MD5 or DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""},"3":{"macro":"_field3_","desc":"Username","help":"","value":""},"4":{"macro":"_field4_","desc":"Password","help":"","value":""},"5":{"macro":"_field5_","desc":"Optional parameters","help":"","value":""}}','-h _field1_ -o _field2_ -u _field3_ -p _field4_ _field5_'), (6,'MySQL Plugin','Samples: ./mysql_plugin.sh -u root -p none -s localhost -q Com_select ./mysql_plugin.sh -u root -p none -s localhost -q Com_update ./mysql_plugin.sh -u root -p none -s localhost -q Connections ./mysql_plugin.sh -u root -p anypass -s 192.168.50.24 -q Innodb_rows_read ',15,'/usr/share/pandora_server/util/plugin/mysql_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"IP address","help":"IP address","value":""},"2":{"macro":"_field2_","desc":"Username","help":"Username to access to database","value":""},"3":{"macro":"_field3_","desc":"Password","help":"Password to access to database","value":""},"4":{"macro":"_field4_","desc":"Query string","help":"Query string of global status. For example 'Aborted_connects' or 'Innodb_rows_read'","value":""}}', '-s _field1_ -u _field2_ -p _field3_ -q _field4_'), (8,'SNMP remote','Plugin that gets remotely, using SNMP, values such as the percentage of disk or memory used, the status of a process or the CPU load',0,'perl /usr/share/pandora_server/util/plugin/snmp_remote.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":"_address_"},"2":{"macro":"_field2_","desc":"Community","help":"","value":"public"},"3":{"macro":"_field3_","desc":"Plug-in Parameters","help":"Memory use (%) -m memuse Disk use (%) -m diskuse -d [disk name] Status of a process (0/1) -m process -p [process_name] Average of CPUs Load (%) -m cpuload","value":""}}', '-H _field1_ -c _field2_ _field3_'); INSERT INTO "tagent_custom_fields" VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0); diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 699828007a..ba9847be83 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1009,13 +1009,13 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (2, 'Monitoring&#x INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (3, 'Monitoring Report Alerts', 'select t1.nombre as agent_name, t2.nombre as module_name, (select talert_templates.name from talert_templates where talert_templates.id = t3.id_alert_template) as template, (select group_concat(t02.name) from talert_template_module_actions as t01 inner join talert_actions as t02 on t01.id_alert_action = t02.id where t01.id_alert_template_module = t3.id group by t01.id_alert_template_module) as actions from tagente as t1 inner join tagente_modulo as t2 on t1.id_agente = t2.id_agente inner join talert_template_modules as t3 on t2.id_agente_modulo = t3.id_agent_module order by agent_name, module_name;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group view', 'select t1.nombre, (select count(t3.id_agente) from tagente as t3 where t1.id_grupo = t3.id_grupo) as agents, (SELECT COUNT(t4.id_agente) FROM tagente as t4 WHERE t4.id_grupo = t1.id_grupo AND t4.disabled = 0 AND t4.ultimo_contacto < NOW() - (intervalo / (1/2))) as agent_unknown, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval / (1/2))) as monitor_unknow, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0) as monitor_no_init, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))) as monitor_ok, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0) as monitor_critical, (SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = t1.id_grupo AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0) as monitor_alert_fired from tgrupo as t1 where 0 < (select count(t2.id_agente) from tagente as t2 where t1.id_grupo = t2.id_grupo)'); -INSERT INTO `trecon_script` VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_fiedl3 = Password','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"}}'); +INSERT INTO `trecon_script` VALUES (2,'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'); INSERT INTO `trecon_script` VALUES (4,'SNMP L2 Recon','Pandora FMS SNMP Recon Plugin for level 2 network topology discovery. (c) Artica ST 2014 <info@artica.es> Usage: ./snmp-recon.pl <task_id> <group_id> <create_incident> <custom_field1> <custom_field2> [custom_field3] [custom_field4] * custom_field1 = comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24) * custom_field2 = comma separated list of snmp communities to try. * custom_field3 = a router in the network. Optional but recommended. * custom_field4 = set to -a to add all network interfaces (by default only interfaces that are up are added). Additional information: When the script is called from a recon task the task_id, group_id and create_incident parameters are automatically filled by the Pandora FMS Server.','/usr/share/pandora_server/util/recon_scripts/snmp-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Comma separated list of networks (i.e.: 192.168.1.0/24,192.168.2.0/24)\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Comma separated list of snmp communities to try.\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Router\",\"help\":\"A router in the network. Optional but recommended.\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Optional parameter\",\"help\":\"Set to -a to add all network interfaces (by default only interfaces that are up are added).\",\"value\":\"\",\"hide\":\"\"}}'); INSERT INTO `trecon_script` VALUES (5,'WMI Recon Script','This script is used to automatically gather host information via WMI. Available parameters: * Network = network to scan (e.g. 192.168.100.0/24). * WMI auth = comma separated list of WMI authentication tokens in the format username%password (e.g. Administrador%pass). See the documentation for more information.','/usr/share/pandora_server/util/recon_scripts/wmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"WMI auth\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}'); -INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":""}}','-h _field1_-u _field2_-p _field3_'); +INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'); INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (2,'DNS Plugin','This plugin is used to check if a specific domain return a specific IP address, and to check how time (milisecs) takes the DNS to answer. Use IP address parameter to specify the IP of your domain. Use these custom parameters for the other parameters: -d domain to check (for example pandorafms.com) -s DNS Server to check (for example 8.8.8.8) Optional parameters: -t Do a DNS time response check instead DNS resolve test ',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain to check","help":"For example pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS Server to check","help":"For example 8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional parameters","help":"","value":""}}','-i _field1_ -d _field2_ -s _field3_ _field4_'); diff --git a/pandora_server/util/plugin/ipmi-plugin.pl b/pandora_server/util/plugin/ipmi-plugin.pl index c0991f91c6..8f0d9392aa 100755 --- a/pandora_server/util/plugin/ipmi-plugin.pl +++ b/pandora_server/util/plugin/ipmi-plugin.pl @@ -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,8 +45,9 @@ 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 $res = `ipmi-sensors -h $host -u $user -p $pass -s $sensor $extraopts | tail -1`; my @aux = split(/\|/, $res); diff --git a/pandora_server/util/recon_scripts/ipmi-recon.pl b/pandora_server/util/recon_scripts/ipmi-recon.pl index 7cfea2d0c4..8908a1b98b 100644 --- a/pandora_server/util/recon_scripts/ipmi-recon.pl +++ b/pandora_server/util/recon_scripts/ipmi-recon.pl @@ -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,6 +44,7 @@ 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 ########################################################################## @@ -62,10 +63,11 @@ sub show_help { print "\nSpecific Pandora FMS Intel DCM Discovery\n"; print "(c) Artica ST 2011 \n\n"; print "Usage:\n\n"; - print " $0 \n\n"; + print " $0 \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; } @@ -88,10 +90,10 @@ sub ipmi_ping ($$$) { return 1; } -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"; my $res = `$cmd`; @@ -127,19 +129,22 @@ sub create_ipmi_modules($$$$$$) { 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":"'.$aux[0].'","hide":""},'. + '"5":{"macro":"_field5_","desc":"'.safe_input("Additional Options").'","help":"","value":"'.$extraopts.'","hide":""}'. + '}'; + my %parameters; $parameters{"nombre"} = safe_input($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{"macros"} = $macros; pandora_create_module_from_hash ($conf, \%parameters, $dbh); @@ -184,17 +189,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 +223,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