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:
mdtrooper 2013-08-06 12:53:39 +00:00
parent 267b28ed0a
commit aa3e7d0f76
5 changed files with 74 additions and 31 deletions

View File

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

View File

@ -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,6 +93,9 @@ 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 = '';
}
@ -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'). ' &raquo; '. $options[$option], "images/gm_massive_operations.png", false, "", true, $onheader);
ui_print_page_header(
__('Massive operations') . ' &raquo; '. $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>';

View File

@ -64,6 +64,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
}
$sub["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations');
enterprise_hook('massivepolicies_submenu');
enterprise_hook('massivesnmp_submenu');
$menu_godmode["gmassive"]["sub"] = $sub;
}

View File

@ -446,9 +446,16 @@ 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 = 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
@ -512,11 +519,17 @@ if ($create_alert || $update_alert) {
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name',
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)',
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;
}
@ -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"];