2013-08-06 Miguel de Dios <miguel.dedios@artica.es>
* godmode/menu.php, godmode/massive/massive_edit_modules.php: improved the source code style. * godmode/snmpconsole/snmp_alert.php, godmode/massive/massive_operations.php: added snmp alert operations. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
267b28ed0a
commit
aa3e7d0f76
|
@ -1,3 +1,11 @@
|
|||
2013-08-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/menu.php, godmode/massive/massive_edit_modules.php:
|
||||
improved the source code style.
|
||||
|
||||
* godmode/snmpconsole/snmp_alert.php,
|
||||
godmode/massive/massive_operations.php: added snmp alert operations.
|
||||
|
||||
2013-08-05 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/constants.php, godmode/snmpconsole/snmp_alert.php: added
|
||||
|
|
|
@ -420,9 +420,9 @@ $table->data['edit8'][1] = html_print_select_from_sql ('SELECT id_tag, name FROM
|
|||
$table->data['edit8'][2] = __('Category');
|
||||
$table->data['edit8'][3] = html_print_select (categories_get_all_categories('forselect'), 'id_category', '','', __('No change'), '', true, false, false);
|
||||
|
||||
if(enterprise_installed()) {
|
||||
if (enterprise_installed()) {
|
||||
$table->rowspan['edit8'][0] = $table->rowspan['edit8'][1] = 2;
|
||||
|
||||
|
||||
$table->data['edit81'][2] = __('Policy linking status') . ui_print_help_tip(__("This field only has sense in modules adopted by a policy."), true);
|
||||
$table->data['edit81'][3] = html_print_select (array(MODULE_PENDING_LINK => __('Linked'), MODULE_PENDING_UNLINK => __('Unlinked')), 'policy_linked', '','', __('No change'), '', true, false, false);
|
||||
}
|
||||
|
|
|
@ -32,14 +32,16 @@ enterprise_include ('godmode/massive/massive_operations.php');
|
|||
$tab = (string) get_parameter ('tab', 'massive_agents');
|
||||
$option = (string) get_parameter ('option', '');
|
||||
|
||||
$options_alerts = array('add_alerts' => __('Massive alerts addition'),
|
||||
$options_alerts = array(
|
||||
'add_alerts' => __('Massive alerts addition'),
|
||||
'delete_alerts' => __('Massive alerts deletion'),
|
||||
'add_action_alerts' => __('Massive alert actions addition'),
|
||||
'delete_action_alerts' => __('Massive alert actions deletion'),
|
||||
'enable_disable_alerts' => __('Massive alert enable/disable'),
|
||||
'standby_alerts' => __('Massive alert setting standby'));
|
||||
|
||||
$options_agents = array('edit_agents' => __('Massive agents edition'),
|
||||
$options_agents = array(
|
||||
'edit_agents' => __('Massive agents edition'),
|
||||
'delete_agents' => __('Massive agents deletion'));
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "PM")) {
|
||||
|
@ -61,14 +63,21 @@ if (! check_acl ($config['id_user'], 0, "PM")) {
|
|||
}
|
||||
|
||||
$options_policies = array();
|
||||
|
||||
$policies_options = enterprise_hook('massive_policies_options');
|
||||
|
||||
if($policies_options != -1) {
|
||||
if ($policies_options != ENTERPRISE_NOT_HOOK) {
|
||||
$options_policies =
|
||||
array_merge($options_policies, $policies_options);
|
||||
}
|
||||
|
||||
$options_snmp = array();
|
||||
$snmp_options = enterprise_hook('massive_snmp_options');
|
||||
|
||||
if ($snmp_options != ENTERPRISE_NOT_HOOK) {
|
||||
$options_snmp =
|
||||
array_merge($options_snmp, $snmp_options);
|
||||
}
|
||||
|
||||
if (in_array($option, array_keys($options_alerts))) {
|
||||
$tab = 'massive_alerts';
|
||||
}
|
||||
|
@ -84,11 +93,14 @@ elseif (in_array($option, array_keys($options_modules))) {
|
|||
elseif (in_array($option, array_keys($options_policies))) {
|
||||
$tab = 'massive_policies';
|
||||
}
|
||||
elseif (in_array($option, array_keys($options_snmp))) {
|
||||
$tab = 'massive_snmp';
|
||||
}
|
||||
else {
|
||||
$option = '';
|
||||
}
|
||||
|
||||
switch($tab) {
|
||||
switch ($tab) {
|
||||
case 'massive_alerts':
|
||||
$options = $options_alerts;
|
||||
break;
|
||||
|
@ -104,6 +116,9 @@ switch($tab) {
|
|||
case 'massive_policies':
|
||||
$options = $options_policies;
|
||||
break;
|
||||
case 'massive_snmp':
|
||||
$options = $options_snmp;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the default option of the category
|
||||
|
@ -127,12 +142,19 @@ $modulestab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/mass
|
|||
. html_print_image ('images/brick.png', true, array ('title' => __('Modules operations')))
|
||||
. '</a>', 'active' => $tab == 'massive_modules');
|
||||
|
||||
/* Collection */
|
||||
|
||||
|
||||
$policiestab = enterprise_hook('massive_policies_tab');
|
||||
|
||||
if ($policiestab == -1)
|
||||
if ($policiestab == ENTERPRISE_NOT_HOOK)
|
||||
$policiestab = "";
|
||||
|
||||
$snmptab = enterprise_hook('massive_snmp_tab');
|
||||
|
||||
if ($snmptab == ENTERPRISE_NOT_HOOK)
|
||||
$snmptab = "";
|
||||
|
||||
|
||||
$onheader = array();
|
||||
$onheader['massive_agents'] = $agentstab;
|
||||
$onheader['massive_modules'] = $modulestab;
|
||||
|
@ -141,11 +163,16 @@ if (check_acl ($config['id_user'], 0, "PM")) {
|
|||
}
|
||||
$onheader['massive_alerts'] = $alertstab;
|
||||
$onheader['policies'] = $policiestab;
|
||||
$onheader['snmp'] = $snmptab;
|
||||
|
||||
ui_print_page_header (__('Massive operations'). ' » '. $options[$option], "images/gm_massive_operations.png", false, "", true, $onheader);
|
||||
ui_print_page_header(
|
||||
__('Massive operations') . ' » '. $options[$option],
|
||||
"images/gm_massive_operations.png", false, "", true, $onheader);
|
||||
|
||||
// Checks if the PHP configuration is correctly
|
||||
if ((get_cfg_var("max_execution_time") != 0) or (get_cfg_var("max_input_time") != -1)) {
|
||||
if ((get_cfg_var("max_execution_time") != 0)
|
||||
or (get_cfg_var("max_input_time") != -1)) {
|
||||
|
||||
echo '<div id="notify_conf" class="notify">';
|
||||
echo __("In order to perform massive operations, PHP needs a correct configuration in timeout parameters. Please, open your PHP configuration file (php.ini) for example: <i>sudo vi /etc/php5/apache2/php.ini;</i><br> And set your timeout parameters to a correct value: <br><i> max_execution_time = 0</i> and <i>max_input_time = -1</i>");
|
||||
echo '</div>';
|
||||
|
@ -192,7 +219,6 @@ echo '</div>';
|
|||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
echo "<br />";
|
||||
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
|
||||
echo '<table border="0"><tr><td>';
|
||||
|
@ -200,7 +226,7 @@ echo __("Action");
|
|||
echo '</td><td>';
|
||||
html_print_select($options, 'option', $option, 'this.form.submit()', '',
|
||||
0, false, false, false);
|
||||
if($option == 'edit_agents' || $option == 'edit_modules')
|
||||
if ($option == 'edit_agents' || $option == 'edit_modules')
|
||||
ui_print_help_tip(__("The blank fields will not be updated"));
|
||||
echo '</td></tr></table>';
|
||||
echo '</form>';
|
||||
|
|
|
@ -29,7 +29,7 @@ if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0,
|
|||
$menu_godmode["gagente"]["sec2"] = "godmode/agentes/modificar_agente";
|
||||
$menu_godmode["gagente"]["id"] = "god-agents";
|
||||
|
||||
if(check_acl ($config['id_user'], 0, "AW")) {
|
||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||
$sub = array ();
|
||||
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
|
||||
$sub["godmode/agentes/modificar_agente"]["subsecs"] = array(
|
||||
|
@ -64,6 +64,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
|
|||
}
|
||||
$sub["godmode/massive/massive_operations&tab=massive_alerts"]["text"] = __('Alerts operations');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
|
||||
$menu_godmode["gmassive"]["sub"] = $sub;
|
||||
}
|
||||
|
@ -104,7 +105,7 @@ if (check_acl ($config['id_user'], 0, "LM") || check_acl ($config['id_user'], 0,
|
|||
$menu_godmode["galertas"]["sec2"] = "godmode/alerts/alert_list";
|
||||
$menu_godmode["galertas"]["id"] = "god-alerts";
|
||||
|
||||
if(check_acl ($config['id_user'], 0, "LM")) {
|
||||
if (check_acl ($config['id_user'], 0, "LM")) {
|
||||
$sub = array ();
|
||||
$sub["godmode/alerts/alert_templates"]["text"] = __('Templates');
|
||||
$sub["godmode/alerts/alert_actions"]["text"] = __('Actions');
|
||||
|
|
|
@ -446,10 +446,17 @@ if ($create_alert || $update_alert) {
|
|||
|
||||
// Alert fields
|
||||
|
||||
$al = array('al_field1' => $al_field1, 'al_field2' => $al_field2, 'al_field3' => $al_field3,
|
||||
'al_field4' => $al_field4, 'al_field5' => $al_field5, 'al_field6' => $al_field6,
|
||||
'al_field7' => $al_field7, 'al_field8' => $al_field8, 'al_field9' => $al_field9,
|
||||
'al_field10' => $al_field10);
|
||||
$al = array(
|
||||
'al_field1' => $al_field1,
|
||||
'al_field2' => $al_field2,
|
||||
'al_field3' => $al_field3,
|
||||
'al_field4' => $al_field4,
|
||||
'al_field5' => $al_field5,
|
||||
'al_field6' => $al_field6,
|
||||
'al_field7' => $al_field7,
|
||||
'al_field8' => $al_field8,
|
||||
'al_field9' => $al_field9,
|
||||
'al_field10' => $al_field10);
|
||||
|
||||
// Hidden div with help hint to fill with javascript
|
||||
html_print_div(array('id' => 'help_snmp_alert_hint', 'content' => ui_print_help_icon ("snmp_alert_field1", true), 'hidden' => true));
|
||||
|
@ -462,7 +469,7 @@ if ($create_alert || $update_alert) {
|
|||
}
|
||||
|
||||
// Max / Min alerts
|
||||
echo '<tr><td class="datos2">'.__('Min. number of alerts').'</td><td class="datos2">';
|
||||
echo '<tr><td class="datos2">' . __('Min. number of alerts').'</td><td class="datos2">';
|
||||
html_print_input_text ("min_alerts", $min_alerts, '', 3);
|
||||
|
||||
echo '</td></tr><tr><td class="datos">'.__('Max. number of alerts').'</td><td class="datos">';
|
||||
|
@ -509,19 +516,25 @@ if ($create_alert || $update_alert) {
|
|||
$fields[$row["id"]] = $row["name"];
|
||||
}
|
||||
|
||||
switch ($config['dbtype']){
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name',
|
||||
"alert_type", $alert_type, '', '', 0, false, false, false);
|
||||
html_print_select_from_sql(
|
||||
'SELECT id, name
|
||||
FROM talert_actions
|
||||
ORDER BY name',
|
||||
"alert_type", $alert_type, '', '', 0, false, false, false);
|
||||
break;
|
||||
case "oracle":
|
||||
html_print_select_from_sql ('SELECT id, dbms_lob.substr(name,4000,1) as name FROM talert_actions ORDER BY dbms_lob.substr(name,4000,1)',
|
||||
"alert_type", $alert_type, '', '', 0, false, false, false);
|
||||
html_print_select_from_sql(
|
||||
'SELECT id, dbms_lob.substr(name,4000,1) as name
|
||||
FROM talert_actions
|
||||
ORDER BY dbms_lob.substr(name,4000,1)',
|
||||
"alert_type", $alert_type, '', '', 0, false, false, false);
|
||||
break;
|
||||
}
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td class="datos">'.__('Position').'</td><td class="datos">';
|
||||
echo '<tr><td class="datos">' . __('Position') . '</td><td class="datos">';
|
||||
html_print_input_text ("position", $position, '', 3);
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
|
@ -697,14 +710,9 @@ else {
|
|||
|
||||
$data[1] = '<a href="' . $url . '">' .
|
||||
alerts_get_alert_action_name ($row["id_alert"]) . '</a>';
|
||||
|
||||
$data[2] = __('SNMP Agent');
|
||||
$data[2] = $row["agent"];
|
||||
$data[3] = __('OID');
|
||||
$data[3] = $row["oid"];
|
||||
$data[4] = __('Custom Value/OID');
|
||||
$data[4] = $row["custom_oid"];
|
||||
|
||||
$data[5] = $row["description"];
|
||||
$data[6] = $row["times_fired"];
|
||||
|
||||
|
|
Loading…
Reference in New Issue