diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b36a64ea7c..e696c10bc5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,23 @@ +2014-04-22 Sergio Martin + + * pandoradb.postgreSQL.sql + pandoradb.oracle.sql + pandoradb.data.postgreSQL.sql + pandoradb.data.oracle.sql + extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql + extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql + extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql + godmode/agentes/module_manager_editor_plugin.php + godmode/servers/plugin.php + godmode/servers/manage_recontask.php + godmode/servers/manage_recontask_form.php + godmode/servers/recon_script.php + pandoradb_data.sql + include/javascript/pandora_modules.js + pandoradb.sql: Changed the recon scripts parameters to + dynamic fields like plugin macros. + Fixed some plugin macros bugs in the new hide parameter + 2014-04-21 Hirofumi Kosaka * godmode/massive/massive_enable_disable_alerts.php, diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql index bec034ce1a..5614065943 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql @@ -147,3 +147,10 @@ INSERT INTO `trecon_script` VALUES (4,'SNMP L2 Recon','Pandora FM /* 2014/04/10 */ ALTER TABLE `treport_content` ADD COLUMN `name` varchar(150) NULL; + +/* 2014/04/11 */ +-- --------------------------------------------------------------------- +-- Table `trecon_script` and `trecon_task` +-- --------------------------------------------------------------------- +ALTER TABLE `trecon_script` ADD COLUMN `macros` TEXT; +ALTER TABLE `trecon_task` ADD COLUMN `macros` TEXT; diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql index aa45b49ee7..c5b6ca2b8b 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql @@ -131,3 +131,10 @@ ALTER TABLE treport ADD (non_interactive NUMBER(5, 0) default 0 NOT NULL); /* 2014/04/10 */ ALTER TABLE treport_content ADD (name VARCHAR2(150) default NULL); + +/* 2014/04/11 */ +-- --------------------------------------------------------------------- +-- Table `trecon_script` and `trecon_task` +-- --------------------------------------------------------------------- +ALTER TABLE trecon_script ADD (macros CLOB default '' NOT NULL); +ALTER TABLE trecon_task ADD (macros CLOB default '' NOT NULL); diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql index e0847ccd6f..a8c17b8294 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql @@ -104,3 +104,10 @@ ALTER TABLE "treport" ADD COLUMN "non_interactive" SMALLINT DEFAULT 0; /* 2014/04/10 */ ALTER TABLE "treport_content" ADD COLUMN "name" varchar(150) NULL; + +/* 2014/04/11 */ +-- --------------------------------------------------------------------- +-- Table `trecon_script` and `trecon_task` +-- --------------------------------------------------------------------- +ALTER TABLE "trecon_script" ADD COLUMN "macros" TEXT default ''; +ALTER TABLE "trecon_task" ADD COLUMN "macros" TEXT default ''; diff --git a/pandora_console/godmode/agentes/module_manager_editor_plugin.php b/pandora_console/godmode/agentes/module_manager_editor_plugin.php index 0596644624..42f4cd39a7 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_plugin.php +++ b/pandora_console/godmode/agentes/module_manager_editor_plugin.php @@ -84,7 +84,12 @@ if (!empty($macros)) { if (!empty($m['help'])) { $data[0] .= ui_print_help_tip ($m['help'], true); } - $data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true); + if($m['hide']) { + $data[1] = html_print_input_password($m['macro'], $m['value'], '', 100, 255, true); + } + else { + $data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true); + } $table_simple->colspan['macro'.$m['macro']][1] = 3; $table_simple->rowclass['macro'.$m['macro']] = 'macro_field'; @@ -107,4 +112,4 @@ if (!empty($macros)) { //In the file pandora_modules.js load_module_component = true; } - \ No newline at end of file + diff --git a/pandora_console/godmode/servers/manage_recontask.php b/pandora_console/godmode/servers/manage_recontask.php index 3c4a45dffe..f8fcdb9c16 100644 --- a/pandora_console/godmode/servers/manage_recontask.php +++ b/pandora_console/godmode/servers/manage_recontask.php @@ -94,6 +94,19 @@ if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) { $resolve_names = (int) get_parameter ("resolve_names", 0); $parent_detection = (int) get_parameter ("parent_detection", 0); $parent_recursion = (int) get_parameter ("parent_recursion", 1); + + // Get macros + $macros = (string) get_parameter ('macros'); + + if (!empty($macros)) { + $macros = json_decode(base64_decode($macros), true); + + foreach($macros as $k => $m) { + $macros[$k]['value'] = get_parameter($m['macro'], ''); + } + } + + $macros = json_encode($macros); } // -------------------------------- @@ -122,7 +135,8 @@ if (isset($_GET["update"])) { 'os_detect' => $os_detect, 'resolve_names' => $resolve_names, 'parent_detection' => $parent_detection, - 'parent_recursion' => $parent_recursion + 'parent_recursion' => $parent_recursion, + 'macros' => $macros ); $where = array('id_rt' => $id); @@ -175,7 +189,8 @@ if (isset($_GET["create"])) { 'os_detect' => $os_detect, 'resolve_names' => $resolve_names, 'parent_detection' => $parent_detection, - 'parent_recursion' => $parent_recursion + 'parent_recursion' => $parent_recursion, + 'macros' => $macros ); $reason = ""; diff --git a/pandora_console/godmode/servers/manage_recontask_form.php b/pandora_console/godmode/servers/manage_recontask_form.php index e436967631..6cc7481b22 100644 --- a/pandora_console/godmode/servers/manage_recontask_form.php +++ b/pandora_console/godmode/servers/manage_recontask_form.php @@ -39,6 +39,22 @@ if (is_ajax ()) { return; } + + $get_recon_script_macros = get_parameter('get_recon_script_macros'); + if ($get_recon_script_macros) { + $id_recon_script = get_parameter('id', 0); + + $recon_script_macros = db_get_value('macros', 'trecon_script', 'id_recon_script', + $id_recon_script); + + $macros = array(); + $macros['base64'] = base64_encode($recon_script_macros); + $macros['array'] = json_decode($recon_script_macros,true); + + echo json_encode($macros); + return; + } + return; } @@ -86,6 +102,7 @@ if (isset ($_GET["update"]) or (isset($_GET["crt"]))) { $resolve_names = $row["resolve_names"]; $parent_detection = $row["parent_detection"]; $parent_recursion = $row["parent_recursion"]; + $macros = $row["macros"]; } } elseif (isset ($_GET["create"]) or isset($_GET["crt"])) { @@ -119,6 +136,7 @@ elseif (isset ($_GET["create"]) or isset($_GET["crt"])) { $resolve_names = 0; $parent_detection = 1; $parent_recursion = 5; + $macros = ''; } } @@ -126,6 +144,7 @@ elseif (isset ($_GET["create"]) or isset($_GET["crt"])) { ui_print_page_header (__('Manage recontask'), "", false, "recontask", true); +$table->id='table_recon'; $table->width='98%'; $table->cellspacing=4; $table->cellpadding=4; @@ -190,6 +209,7 @@ $table->data[5][1] = html_print_select_from_sql ('SELECT id_np, name FROM tnetwo $table->data[6][0] = "".__('Recon script'); $table->data[6][1] = html_print_select_from_sql ('SELECT id_recon_script, name FROM trecon_script', "id_recon_script", $id_recon_script, 'get_explanation_recon_script($(\'#id_recon_script\').val())', '', '', true); +$table->data[6][1] .= $data[1] .= html_print_input_hidden('macros',base64_encode($macros),true); // OS @@ -223,27 +243,43 @@ $table->data[11][0] = "".__('SNMP Default community'); $table->data[11][1] = html_print_input_text ('snmp_community', $snmp_community, '', 35, 0, true); +$explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id_recon_script); + $table->data[12][0] = "" . __('Explanation') . ""; $table->data[12][1] = "" . html_print_textarea('explanation', 4, 60, '', 'style="width: 388px;"', true); +"" . html_print_textarea('explanation', 4, 60, $explanation, 'style="width: 388px;"', true); +// A hidden "model row" to clone it from javascript to add fields dynamicly +$data = array (); +$data[0] = 'macro_desc'; +$data[0] .= ui_print_help_tip ('macro_help', true); +$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 255, true); +$table->colspan['macro_field'][1] = 3; +$table->rowstyle['macro_field'] = 'display:none'; +$table->data['macro_field'] = $data; -// Field1 -$table->data[13][0] = "".__('Script field #1').ui_print_help_tip(__("several networks separated by comma. For example: 192.168.100.0/24,192.168.50.0/24"), true); -$table->data[13][1] = html_print_input_text ('field1', $field1, '', 40, 0, true); - -// Field2 -$table->data[14][0] = "".__('Script field #2').ui_print_help_tip(__("several communities separated by comma. For example: snmp_community,public,private "), true); -$table->data[14][1] = html_print_input_text ('field2', $field2, '', 40, 0, true); - -// Field3 -$table->data[15][0] = "".__('Script field #3'); -$table->data[15][1] = html_print_input_text ('field3', $field3, '', 40, 0, true); - -// Field4 -$table->data[16][0] = "".__('Script field #4'); -$table->data[16][1] = html_print_input_text ('field4', $field4, '', 40, 0, true); - +// If there are $macros, we create the form fields +if (!empty($macros)) { + $macros = json_decode($macros, true); + + foreach ($macros as $k => $m) { + $data = array (); + $data[0] = "" . $m['desc'] . ""; + if (!empty($m['help'])) { + $data[0] .= ui_print_help_tip ($m['help'], true); + } + if($m['hide']) { + $data[1] = html_print_input_password($m['macro'], $m['value'], '', 100, 255, true); + } + else { + $data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true); + } + $table->colspan['macro'.$m['macro']][1] = 3; + $table->rowclass['macro'.$m['macro']] = 'macro_field'; + + $table->data['macro'.$m['macro']] = $data; + } +} // Comments $table->data[17][0] = "".__('Comments'); @@ -277,6 +313,8 @@ echo ""; echo ""; +ui_require_javascript_file ('pandora_modules'); + ?> diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 578d5b7311..aea2d96b92 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -283,7 +283,7 @@ if (($create != "") OR ($view != "")) { $macro_name_name = 'field'.$i.'_macro'; $macro_name = '_field'.$i.'_'; $macro_hide_value_name = 'field'.$i.'_hide'; - $macro_hide_value_value = 1; + $macro_hide_value_value = 0; if(isset($macros[$i]['desc'])) { $macro_desc_value = $macros[$i]['desc']; @@ -297,6 +297,10 @@ if (($create != "") OR ($view != "")) { $macro_value_value = $macros[$i]['value']; } + if(isset($macros[$i]['hide'])) { + $macro_hide_value_value = $macros[$i]['hide']; + } + $datam = array (); $datam[0] = __('Description')." ($macro_name)"; $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); @@ -318,11 +322,13 @@ if (($create != "") OR ($view != "")) { $table->colspan['plugin_'.$next_name_number][1] = 3; $datam = array (); - $datam[0] = __('Hide value'); - $datam[1] = html_print_checkbox_extended ($macro_hide_value_name, $macro_hide_value_value, 0, 0, '', array('class' => 'command_advanced_conf'), true, 'checkbox-'.$macro_hide_value_name); + $datam[0] = __('Hide value') . ui_print_help_tip(__('This field will show up as dots like a password'), true); + $datam[1] = html_print_checkbox_extended ($macro_hide_value_name, 1, $macro_hide_value_value, 0, '', array('class' => 'command_advanced_conf'), true, 'checkbox-'.$macro_hide_value_name); $table->data['plugin_'.$next_name_number] = $datam; $next_name_number++; + + $table->colspan['plugin_'.$next_name_number][1] = 3; $datam = array (); $datam[0] = __('Help')." ($macro_name)


"; @@ -411,11 +417,14 @@ else { $desc = (string)get_parameter ('field'.$i.'_desc'); $help = (string)get_parameter ('field'.$i.'_help'); $value = (string)get_parameter ('field'.$i.'_value'); + $hide = get_parameter ('field'.$i.'_hide'); $macros[$i]['macro'] = $macro; $macros[$i]['desc'] = $desc; $macros[$i]['help'] = $help; $macros[$i]['value'] = $value; + $macros[$i]['hide'] = $hide; + $i++; } diff --git a/pandora_console/godmode/servers/recon_script.php b/pandora_console/godmode/servers/recon_script.php index f2376ea4e1..eaed1e6a43 100644 --- a/pandora_console/godmode/servers/recon_script.php +++ b/pandora_console/godmode/servers/recon_script.php @@ -55,11 +55,13 @@ if ($view != "") { $form_name = $reconscript["name"]; $form_description = $reconscript["description"]; $form_script = $reconscript ["script"]; + $macros = $reconscript ["macros"]; } if ($create != "") { $form_name = ""; $form_description = ""; $form_script = ""; + $macros = ""; } // SHOW THE FORM @@ -80,22 +82,136 @@ if (($create != "") OR ($view != "")){ else echo "
"; - echo ''; + $table->width = '98%'; + $table->id = 'table-form'; + $table->class = 'databox_color'; + $table->style = array (); + $table->style[0] = 'font-weight: bold'; + $table->style[2] = 'font-weight: bold'; + $table->data = array (); - echo ''; - echo ''; + $data = array(); + $data[0] = __('Name'); + $data[1] = ''; + $table->data['recon_name'] = $data; + $table->colspan['recon_name'][1] = 3; - echo ''; - echo ''; + $data = array(); + $data[0] = __('Script fullpath'); + $data[1] = ''; + $table->data['recon_fullpath'] = $data; + $table->colspan['recon_fullpath'][1] = 3; + + $data = array(); + $data[0] = __('Description'); + $data[1] = ''; + $table->data['recon_description'] = $data; + $table->colspan['recon_description'][1] = 3; + + $macros = json_decode($macros,true); - echo ''; - echo ''; + // This code is ready to add locked feature as plugins + $locked = false; + + // The next row number is recon_3 + $next_name_number = 3; + $i = 1; + while (1) { + // Always print at least one macro + if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) { + break; + } + $macro_desc_name = 'field'.$i.'_desc'; + $macro_desc_value = ''; + $macro_help_name = 'field'.$i.'_help'; + $macro_help_value = ''; + $macro_value_name = 'field'.$i.'_value'; + $macro_value_value = ''; + $macro_name_name = 'field'.$i.'_macro'; + $macro_name = '_field'.$i.'_'; + $macro_hide_value_name = 'field'.$i.'_hide'; + $macro_hide_value_value = 0; + + if(isset($macros[$i]['desc'])) { + $macro_desc_value = $macros[$i]['desc']; + } + + if(isset($macros[$i]['help'])) { + $macro_help_value = $macros[$i]['help']; + } + + if(isset($macros[$i]['value'])) { + $macro_value_value = $macros[$i]['value']; + } + if(isset($macros[$i]['hide'])) { + $macro_hide_value_value = $macros[$i]['hide']; + } + + $datam = array (); + $datam[0] = __('Description')." ($macro_name)"; + $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); + $datam[1] = html_print_input_text_extended ($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_advanced_conf'", true); + if($locked) { + $datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + } + + $datam[2] = __('Default value')." ($macro_name)"; + $datam[3] = html_print_input_text_extended ($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_advanced_conf'", true); + if($locked) { + $datam[3] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + } + + $table->data['recon_'.$next_name_number] = $datam; + + $next_name_number++; + + $table->colspan['recon_'.$next_name_number][1] = 3; + + $datam = array (); + $datam[0] = __('Hide value') . ui_print_help_tip(__('This field will show up as dots like a password'), true); + $datam[1] = html_print_checkbox_extended ($macro_hide_value_name, 1, $macro_hide_value_value, 0, '', array('class' => 'command_advanced_conf'), true, 'checkbox-'.$macro_hide_value_name); + + $table->data['recon_'.$next_name_number] = $datam; + $next_name_number++; + + $table->colspan['recon_'.$next_name_number][1] = 3; + + $datam = array (); + $datam[0] = __('Help')." ($macro_name)


"; + $tadisabled = $locked === true ? ' disabled' : ''; + $datam[1] = html_print_textarea ($macro_help_name, 6, 100, $macro_help_value, 'class="command_advanced_conf" style="width: 97%;"' . $tadisabled, true); + + if($locked) { + $datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + } + $datam[1] .= "


"; + + $table->data['recon_'.$next_name_number] = $datam; + $next_name_number++; + $i++; + } + + if (!$locked) { + $datam = array (); + $datam[0] = ''.__('Add macro').''.html_print_image('images/add.png',true).''; + $datam[0] .= ''; + $datam[0] .= ''; + $delete_macro_style = ''; + if($i <= 2) { + $delete_macro_style = 'display:none;'; + } + $datam[2] = ''; + + $table->colspan['recon_action'][0] = 2; + $table->rowstyle['recon_action'] = 'text-align:center'; + $table->colspan['recon_action'][2] = 2; + $table->data['recon_action'] = $datam; + } + + html_print_table($table); - echo '
' . __('Name') . ''; - echo '
' . __('Script fullpath') . ''; - echo '
' . __('Description') . '
'; echo ''; echo '
'; @@ -117,10 +233,35 @@ else { $reconscript_description = get_parameter ("form_description", ""); $reconscript_script = get_parameter ("form_script", ""); + // Get macros + $i = 1; + $macros = array(); + while (1) { + $macro = (string)get_parameter ('field'.$i.'_macro'); + if($macro == '') { + break; + } + + $desc = (string)get_parameter ('field'.$i.'_desc'); + $help = (string)get_parameter ('field'.$i.'_help'); + $value = (string)get_parameter ('field'.$i.'_value'); + $hide = get_parameter ('field'.$i.'_hide'); + + $macros[$i]['macro'] = $macro; + $macros[$i]['desc'] = $desc; + $macros[$i]['help'] = $help; + $macros[$i]['value'] = $value; + $macros[$i]['hide'] = $hide; + $i++; + } + + $macros = io_json_mb_encode($macros); + $sql_update ="UPDATE trecon_script SET name = '$reconscript_name', description = '$reconscript_description', - script = '$reconscript_script' + script = '$reconscript_script', + macros = '$macros' WHERE id_recon_script = $id_recon_script"; $result = false; if ($reconscript_name != '' && $reconscript_script != '') @@ -139,10 +280,35 @@ else { $reconscript_description = get_parameter ("form_description", ""); $reconscript_script = get_parameter ("form_script", ""); + // Get macros + $i = 1; + $macros = array(); + while (1) { + $macro = (string)get_parameter ('field'.$i.'_macro'); + if($macro == '') { + break; + } + + $desc = (string)get_parameter ('field'.$i.'_desc'); + $help = (string)get_parameter ('field'.$i.'_help'); + $value = (string)get_parameter ('field'.$i.'_value'); + $hide = get_parameter ('field'.$i.'_hide'); + + $macros[$i]['macro'] = $macro; + $macros[$i]['desc'] = $desc; + $macros[$i]['help'] = $help; + $macros[$i]['value'] = $value; + $macros[$i]['hide'] = $hide; + $i++; + } + + $macros = io_json_mb_encode($macros); + $values = array( 'name' => $reconscript_name, 'description' => $reconscript_description, - 'script' => $reconscript_script); + 'script' => $reconscript_script, + 'macros' => $macros); $result = false; if ($values['name'] != '' && $values['script'] != '') $result = db_process_sql_insert('trecon_script', $values); @@ -218,4 +384,8 @@ else { echo ""; echo "
"; } + +ui_require_javascript_file('pandora_modules'); + ?> + diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index b5eccdd88d..b2f5822133 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -461,13 +461,15 @@ function delete_macro(prefix) { } var next_row = parseInt($('#next_row').html()); $('#next_macro').html(next_number-1); - $('#next_row').html(next_row-2); + $('#next_row').html(next_row-3); - var nrow1 = next_row - 2; - var nrow2 = next_row - 1; + var nrow1 = next_row - 3; + var nrow2 = next_row - 2; + var nrow3 = next_row - 1; var $row1 = $('#'+prefix+nrow1).remove(); var $row2 = $('#'+prefix+nrow2).remove(); + var $row3 = $('#'+prefix+nrow3).remove(); } function new_macro(prefix) { diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index f4dc27c9ee..182a745dfe 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -1199,10 +1199,9 @@ treport_custom_sql_insert(4, 'Group view','< (select count COMMIT; END;; -INSERT INTO trecon_script VALUES (1,'SNMP Recon Script','This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * custom_field1 = network. i.e.: 192.168.100.0/24 * custom_field2 = several communities separated by comma. For example: snmp_community,public,private * custom_field3 = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.','/usr/share/pandora_server/util/recon_scripts/snmpdevices.pl'); - -INSERT INTO trecon_script VALUES -(2,'IPMI 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 trecon_script VALUES (1,'SNMP Recon Script','This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * Network = network. i.e.: 192.168.100.0/24 * Community = several communities separated by comma. For example: snmp_community,public,private * Optative parameter = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.','/usr/share/pandora_server/util/recon_scripts/snmpdevices.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Network i.e.: 192.168.100.0/24 Networks must be separated by comma. For example: 192.168.100.0/24,192.168.50.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Communities must be separated by comma. For example: snmp_community,public,private \",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Optative parameter\",\"help\":\"Optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default \",\"value\":\"\",\"hide\":\"\"}}'); +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 (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 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_'); diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 9b4c47d809..3c202bff14 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -1042,10 +1042,9 @@ 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" ("id_recon_script", "name", "description", "script") VALUES (1,'SNMP Recon Script','This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * custom_field1 = network. i.e.: 192.168.100.0/24 * custom_field2 = several communities separated by comma. For example: snmp_community,public,private * custom_field3 = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.','/usr/share/pandora_server/util/recon_scripts/snmpdevices.pl'); - -INSERT INTO "trecon_script" ("id_recon_script", "name", "description", "script") VALUES -(2,'IPMI 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 "trecon_script" VALUES (1,'SNMP Recon Script','This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * Network = network. i.e.: 192.168.100.0/24 * Community = several communities separated by comma. For example: snmp_community,public,private * Optative parameter = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.','/usr/share/pandora_server/util/recon_scripts/snmpdevices.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Network i.e.: 192.168.100.0/24 Networks must be separated by comma. For example: 192.168.100.0/24,192.168.50.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Communities must be separated by comma. For example: snmp_community,public,private \",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Optative parameter\",\"help\":\"Optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default \",\"value\":\"\",\"hide\":\"\"}}'); +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 (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 "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_'); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 4152c321c3..69cc8030bf 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -840,7 +840,8 @@ CREATE TABLE trecon_script ( id_recon_script NUMBER(10, 0) NOT NULL PRIMARY KEY, name VARCHAR2(100) default '', description CLOB default NULL, - script VARCHAR2(250) default '' + script VARCHAR2(250) default '', + macros CLOB default '' ); CREATE SEQUENCE trecon_script_s INCREMENT BY 1 START WITH 1; @@ -871,7 +872,8 @@ CREATE TABLE trecon_task ( resolve_names NUMBER(5, 0) default 1 NOT NULL, parent_detection NUMBER(5, 0) default 1 NOT NULL, parent_recursion NUMBER(5, 0) default 1 NOT NULL, - disabled NUMBER(5, 0) default 1 NOT NULL + disabled NUMBER(5, 0) default 1 NOT NULL, + macros CLOB default '' ); CREATE INDEX trecon_task_id_rec_serv_idx ON trecon_task(id_recon_server); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index b58c33f13b..f886409d7e 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -737,7 +737,8 @@ CREATE TABLE "trecon_script" ( "id_recon_script" SERIAL NOT NULL PRIMARY KEY, "name" varchar(100) default '', "description" TEXT default NULL, - "script" varchar(250) default '' + "script" varchar(250) default '', + "macros" TEXT NOT NULL default '' ); -- --------------------------------------------------------------------- @@ -767,7 +768,8 @@ CREATE TABLE "trecon_task" ( "resolve_names" SMALLINT NOT NULL default 1, "parent_detection" SMALLINT NOT NULL default 1, "parent_recursion" SMALLINT NOT NULL default 1, - "disabled" SMALLINT NOT NULL default 1 + "disabled" SMALLINT NOT NULL default 1, + "macros" TEXT NOT NULL default '' ); CREATE INDEX "trecon_task_id_recon_server_idx" ON "trecon_task"("id_recon_server"); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0ead8cb2e0..1323e63a93 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -800,6 +800,7 @@ CREATE TABLE IF NOT EXISTS `trecon_script` ( `name` varchar(100) default '', `description` TEXT, `script` varchar(250) default '', + `macros` TEXT, PRIMARY KEY (`id_recon_script`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -831,6 +832,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` ( `parent_detection` tinyint(1) unsigned default '0', `parent_recursion` tinyint(1) unsigned default '0', `disabled` tinyint(1) unsigned NOT NULL DEFAULT '0', + `macros` TEXT, PRIMARY KEY (`id_rt`), KEY `recon_task_daemon` (`id_recon_server`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 78cceb58f2..a804d174ca 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -996,12 +996,11 @@ 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 (1,'SNMP Recon Script','This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * custom_field1 = network. i.e.: 192.168.100.0/24 * custom_field2 = several communities separated by comma. For example: snmp_community,public,private * custom_field3 = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.','/usr/share/pandora_server/util/recon_scripts/snmpdevices.pl'); +INSERT INTO `trecon_script` VALUES (1,'SNMP Recon Script','This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * Network = network. i.e.: 192.168.100.0/24 * Community = several communities separated by comma. For example: snmp_community,public,private * Optative parameter = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.','/usr/share/pandora_server/util/recon_scripts/snmpdevices.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"Network i.e.: 192.168.100.0/24 Networks must be separated by comma. For example: 192.168.100.0/24,192.168.50.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"Communities must be separated by comma. For example: snmp_community,public,private \",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Optative parameter\",\"help\":\"Optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default \",\"value\":\"\",\"hide\":\"\"}}'); -INSERT INTO `trecon_script` VALUES -(2,'IPMI 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 `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 (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'); +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 `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_');