From 9c42aaad7d7a8cf649e4816bd65ffdd320eca068 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 20 Aug 2012 10:42:24 +0000 Subject: [PATCH] 2012-08-20 Sergio Martin * pandoradb_data.sql pandoradb.data.postgreSQL.sql pandoradb.data.oracle.sql: * include/javascript/pandora_modules.js: Fixed the bad order of the fields when put it on the form via ajax git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6887 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 ++++++++++ .../include/javascript/pandora_modules.js | 13 +++++++++++-- pandora_console/pandoradb.data.oracle.sql | 7 +++++++ pandora_console/pandoradb.data.postgreSQL.sql | 6 ++++++ pandora_console/pandoradb_data.sql | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 620d62f982..7647b52fed 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2012-08-20 Sergio Martin + + * pandoradb_data.sql + pandoradb.data.postgreSQL.sql + pandoradb.data.oracle.sql: + + * include/javascript/pandora_modules.js: Fixed + the bad order of the fields when put it on the + form via ajax + 2012-08-17 Sancho Lerena * pandoradb.sql diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 211c9ac8d0..7e5c08afed 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -528,8 +528,17 @@ function add_macro_field(macro, row_model_id) { $macro_field.attr('id',row_id); $macro_field.attr('class','macro_field'); - // Assign values - $macro_field.insertAfter('#'+ row_model_id +'_field'); + // Get the number of fields already printed + var fields = $('.macro_field').size(); + + // If is the first, we insert it after model row + if(fields == 0) { + $macro_field.insertAfter('#'+ row_model_id +'_field'); + } + // If there are more fields, we insert it after the last one + else { + $macro_field.insertAfter('#'+ $('.macro_field').eq(fields-1).attr('id')); + } // Change the label if(macro_help == '') { diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index f86f852daa..553c1081a8 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -600,3 +600,10 @@ INSERT INTO trecon_script VALUES (1,'SNMP Recon Script','This scr INSERT INTO trecon_script VALUES (2,'IMPI Recon', 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 Usage: ./ipmi-recon.pl * 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'); +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_'); + + +INSERT INTO tagent_custom_fields VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0); + +INSERT INTO ttag VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); + diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index a907791dbc..6fcba428fb 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -441,3 +441,9 @@ INSERT INTO "trecon_script" ("id_recon_script", "name", "description", "script") INSERT INTO "trecon_script" ("id_recon_script", "name", "description", "script") VALUES (2,'IMPI Recon', 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 Usage: ./ipmi-recon.pl * 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'); +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_'); + + +INSERT INTO "tagent_custom_fields" VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0); + +INSERT INTO "ttag" VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 92d6e73384..7eb3786182 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -430,7 +430,7 @@ INSERT INTO `trecon_script` VALUES (1,'SNMP Recon Script','This s INSERT INTO `trecon_script` VALUES (2,'IMPI Recon', 'Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 Usage: ./ipmi-recon.pl * 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'); -INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl','-h','','-u','-p',0),(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','-i','','','',0),(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','-t','-p','','',0),(4,'SMTP Check','This plugin is used to send a mail to a SMTP server and check if works. Parameters in the plugin IP Addres - 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 Autentication system, could be LOGIN, PLAIN, CRAM-MD5 or DIGEST-MD ',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl','-h','-o','-u','-p',0); +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_'); INSERT INTO `tagent_custom_fields` VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0);