2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_edit_agents.php, godmode/massive/massive_delete_modules.php, godmode/massive/massive_add_action_alerts.php, godmode/massive/massive_delete_profiles.php, godmode/massive/massive_delete_alerts.php, godmode/groups/modu_group_list.php, godmode/groups/group_list.php, godmode/reporting/graph_builder.php, godmode/reporting/graphs.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_action.php, include/functions_ui.php, include/functions_graph.php: improved the source code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5333840059
commit
ff8ffd53b2
|
@ -1,3 +1,18 @@
|
|||
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/events/custom_events.php,
|
||||
godmode/massive/massive_enable_disable_alerts.php,
|
||||
godmode/massive/massive_edit_agents.php,
|
||||
godmode/massive/massive_delete_modules.php,
|
||||
godmode/massive/massive_add_action_alerts.php,
|
||||
godmode/massive/massive_delete_profiles.php,
|
||||
godmode/massive/massive_delete_alerts.php,
|
||||
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
|
||||
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
|
||||
godmode/alerts/alert_templates.php,
|
||||
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
|
||||
include/functions_graph.php: improved the source code.
|
||||
|
||||
2013-04-25 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* pandoradb.sql,
|
||||
|
|
|
@ -155,7 +155,7 @@ if ($delete_template) {
|
|||
|
||||
if ($al_template !== false){
|
||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
||||
if ($al_template['id_group'] == 0){
|
||||
if ($al_template['id_group'] == 0) {
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
|
@ -167,7 +167,10 @@ if ($delete_template) {
|
|||
alerts_meta_print_header ();
|
||||
}
|
||||
else {
|
||||
ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alert_template", true);
|
||||
ui_print_page_header(
|
||||
__('Alerts') . " » " . __('Alert templates'),
|
||||
"images/gm_alerts.png", false, "alert_template",
|
||||
true);
|
||||
}
|
||||
}
|
||||
} // If user tries to delete a template of others groups
|
||||
|
|
|
@ -130,7 +130,7 @@ $table->data[2][0] = __('Command');
|
|||
$table->data[2][1] = html_print_select_from_sql ('SELECT id, name FROM talert_commands',
|
||||
'id_command', $id_command, '', __('None'), 0, true);
|
||||
$table->data[2][1] .= ' ';
|
||||
if (check_acl ($config['id_user'], 0, "PM")){
|
||||
if (check_acl ($config['id_user'], 0, "PM")) {
|
||||
$table->data[2][1] .= html_print_image ('images/add.png', true);
|
||||
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
$table->data[2][1] .= __('Create Command');
|
||||
|
@ -144,7 +144,7 @@ $table->data[4][0] = __('Command preview');
|
|||
$table->data[4][1] = html_print_textarea ('command_preview', 10, 30, '',
|
||||
'disabled="disabled"', true);
|
||||
$row = 5;
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$table->data['field'.$i][0] = html_print_image('images/spinner.gif',true);
|
||||
$table->data['field'.$i][1] = html_print_image('images/spinner.gif',true);
|
||||
// Store the value in a hidden to keep it on first execution
|
||||
|
|
|
@ -194,11 +194,11 @@ echo '</div>';
|
|||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
$("#right").click (function () {
|
||||
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>){
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||
|
|
|
@ -139,7 +139,7 @@ if ($create_group) {
|
|||
|
||||
/*Check if name field is empty*/
|
||||
if ($name != "") {
|
||||
if (!$check){
|
||||
if (!$check) {
|
||||
$values = array(
|
||||
'nombre' => $name,
|
||||
'icon' => substr ($icon, 0, -4),
|
||||
|
|
|
@ -65,11 +65,11 @@ if ($create_group) {
|
|||
$alerts_disabled = (bool) get_parameter ('alerts_disabled');
|
||||
$custom_id = (string) get_parameter ('custom_id');
|
||||
$check = db_get_value('name', 'tmodule_group', 'name', $name);
|
||||
|
||||
if ($name){
|
||||
|
||||
if ($name) {
|
||||
if (!$check) {
|
||||
$result = db_process_sql_insert('tmodule_group', array('name' => $name));
|
||||
|
||||
|
||||
if ($result) {
|
||||
ui_print_success_message(__('Group successfully created'));
|
||||
}
|
||||
|
|
|
@ -67,13 +67,13 @@ if ($add) {
|
|||
$agent_alerts = agents_get_alerts($id_agents);
|
||||
$cont = 0;
|
||||
$agent_alerts_id = array();
|
||||
foreach($agent_alerts['simple'] as $agent_alert){
|
||||
foreach ($agent_alerts['simple'] as $agent_alert) {
|
||||
if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) {
|
||||
$agent_alerts_id[$cont] = $agent_alert['id'];
|
||||
$cont = $cont + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$options = array();
|
||||
|
||||
if($fires_min > 0)
|
||||
|
|
|
@ -72,8 +72,8 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
|||
|
||||
$module_selection_mode = get_parameter('modules_selection_mode');
|
||||
|
||||
foreach($module_names as $module){
|
||||
foreach($id_agents as $id_agent) {
|
||||
foreach ($module_names as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
|||
if (count($module_names) == 1 && $module_names[0] == '0') {
|
||||
|
||||
if ($module_selection_mode == 'common')
|
||||
$modules_id = agents_common_modules_with_alerts ($id_agents, false, true);
|
||||
$modules_id = agents_common_modules_with_alerts ($id_agents, false, true);
|
||||
else {
|
||||
// For agents selected
|
||||
$modules_id = array();
|
||||
|
@ -111,12 +111,12 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
|||
|
||||
$conttotal = 0;
|
||||
$contsuccess = 0;
|
||||
foreach($modules_id as $module){
|
||||
foreach ($modules_id as $module) {
|
||||
$success = alerts_delete_alert_agent_module (false,
|
||||
array ('id_agent_module' => $module,
|
||||
'id_alert_template' => $id_alert_template));
|
||||
|
||||
if($success)
|
||||
if ($success)
|
||||
$contsuccess ++;
|
||||
$conttotal ++;
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ echo '<h3 class="error invisible" id="message"> </h3>';
|
|||
ui_require_jquery_file ('form');
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
|
||||
if ($selection_mode == 'modules'){
|
||||
if ($selection_mode == 'modules') {
|
||||
$modules_row = '';
|
||||
$agents_row = 'none';
|
||||
}
|
||||
|
@ -404,19 +404,19 @@ $(document).ready (function () {
|
|||
|
||||
$('input[type=checkbox]').change (
|
||||
function () {
|
||||
if(this.id == "checkbox-force_type"){
|
||||
if(this.checked) {
|
||||
if (this.id == "checkbox-force_type") {
|
||||
if (this.checked) {
|
||||
$(".select_modules_row_2").css('display', 'none');
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").show ();
|
||||
}
|
||||
else {
|
||||
$(".select_modules_row_2").css('display', '');
|
||||
if($('#module_name option:selected').val() == undefined) {
|
||||
if ($('#module_name option:selected').val() == undefined) {
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(this.id == "checkbox-recursion"){
|
||||
else if (this.id == "checkbox-recursion") {
|
||||
$("#groups_select").trigger("change");
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -50,13 +50,13 @@ if ($delete_profiles) {
|
|||
$groups_id = get_parameter ('groups_id', -1);
|
||||
$users_id = get_parameter ('users_id', -1);
|
||||
|
||||
if($profiles_id == -1 || $groups_id == -1 || $users_id == -1){
|
||||
if ($profiles_id == -1 || $groups_id == -1 || $users_id == -1) {
|
||||
$result = false;
|
||||
}
|
||||
else {
|
||||
foreach($profiles_id as $profile) {
|
||||
foreach($groups_id as $group) {
|
||||
foreach($users_id as $id_up) {
|
||||
foreach ($profiles_id as $profile) {
|
||||
foreach ($groups_id as $group) {
|
||||
foreach ($users_id as $id_up) {
|
||||
if ($id_up == 0) {
|
||||
echo '<h3 class="error">'.__('Not deleted. You must select an existing user').'</h3>';
|
||||
$result="";
|
||||
|
|
|
@ -456,7 +456,7 @@ $(document).ready (function () {
|
|||
$("select#id_os").pandoraSelectOS ();
|
||||
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function (){
|
||||
$("#checkbox-recursion").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
|
|
@ -184,7 +184,7 @@ $(document).ready (function () {
|
|||
clear_alert_fields();
|
||||
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function (){
|
||||
$("#checkbox-recursion").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
|
|
@ -243,10 +243,10 @@ if (!$delete_module) {
|
|||
$chunk1 = array();
|
||||
$chunk1 = explode ("|", $chunkdata);
|
||||
$modules="";$weights="";
|
||||
for ($a=0; $a < count($chunk1); $a++){
|
||||
for ($a = 0; $a < count($chunk1); $a++) {
|
||||
$chunk2[$a] = array();
|
||||
$chunk2[$a] = explode ( ",", $chunk1[$a]);
|
||||
if (strpos($modules, $chunk2[$a][1]) == 0){ // Skip dupes
|
||||
if (strpos($modules, $chunk2[$a][1]) == 0) { // Skip dupes
|
||||
$module_array[] = $chunk2[$a][1];
|
||||
$agent_array[] = $chunk2[$a][0];
|
||||
$weight_array[] = $chunk2[$a][2];
|
||||
|
|
|
@ -35,30 +35,33 @@ if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NO
|
|||
}
|
||||
|
||||
$buttons['graph_list'] = array('active' => true,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">' .
|
||||
html_print_image("images/list.png", true, array ("title" => __('Graph list'))) .'</a>');
|
||||
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">' .
|
||||
html_print_image("images/list.png", true, array ("title" => __('Graph list'))) .'</a>');
|
||||
|
||||
if ($enterpriseEnable){
|
||||
$buttons = reporting_enterprise_add_template_graph_tabs($buttons);
|
||||
}
|
||||
|
||||
$subsection = '';
|
||||
switch ($activeTab){
|
||||
|
||||
case 'main': $buttons['graph_list']['active'] = true;
|
||||
$subsection = ' » '.__('Graph list');
|
||||
break;
|
||||
default: $subsection = reporting_enterprise_add_graph_template_subsection($activeTab, $buttons);
|
||||
break;
|
||||
}
|
||||
switch ($activeTab) {
|
||||
case 'main':
|
||||
$buttons['graph_list']['active'] = true;
|
||||
$subsection = ' » '.__('Graph list');
|
||||
break;
|
||||
default:
|
||||
$subsection = reporting_enterprise_add_graph_template_subsection($activeTab, $buttons);
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($activeTab) {
|
||||
case 'main': require_once('godmode/reporting/graphs.php');
|
||||
break;
|
||||
default: reporting_enterprise_select_graph_template_tab($activeTab);
|
||||
break;
|
||||
case 'main':
|
||||
require_once('godmode/reporting/graphs.php');
|
||||
break;
|
||||
default:
|
||||
reporting_enterprise_select_graph_template_tab($activeTab);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$delete_graph = (bool) get_parameter ('delete_graph');
|
||||
$view_graph = (bool) get_parameter ('view_graph');
|
||||
$id = (int) get_parameter ('id');
|
||||
|
@ -76,7 +79,7 @@ if ($delete_graph) {
|
|||
$result = "<h3 class=suc>".__('Successfully deleted')."</h3>";
|
||||
else
|
||||
$result = "<h3 class=error>".__('Not deleted. Error deleting data')."</h3>";
|
||||
|
||||
|
||||
$result = db_process_sql_delete("tgraph", array('id_graph' =>$id));
|
||||
|
||||
if ($result) {
|
||||
|
@ -104,8 +107,8 @@ if ($multiple_delete) {
|
|||
|
||||
foreach ($ids as $id) {
|
||||
$result = db_process_sql_delete ('tgraph',
|
||||
array ('id_graph' => $id));
|
||||
|
||||
array('id_graph' => $id));
|
||||
|
||||
if ($result === false) {
|
||||
db_process_sql_rollback();
|
||||
break;
|
||||
|
@ -116,8 +119,10 @@ if ($multiple_delete) {
|
|||
db_process_sql_commit();
|
||||
}
|
||||
|
||||
if ($result !== false) $result = true;
|
||||
else $result = false;
|
||||
if ($result !== false)
|
||||
$result = true;
|
||||
else
|
||||
$result = false;
|
||||
|
||||
$str_ids = implode (',', $ids);
|
||||
if ($result) {
|
||||
|
@ -135,7 +140,7 @@ if ($multiple_delete) {
|
|||
|
||||
$graphs = custom_graphs_get_user ($config['id_user'], false, true, "RR");
|
||||
|
||||
if (! empty ($graphs)) {
|
||||
if (!empty ($graphs)) {
|
||||
$table->width = '98%';
|
||||
$tale->class = 'databox_frame';
|
||||
$table->align = array ();
|
||||
|
|
|
@ -2146,17 +2146,19 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200) {
|
|||
$legend = array ();
|
||||
$total = 0;
|
||||
|
||||
$sql = "SELECT criticity, COUNT(id_evento) events FROM tevento GROUP BY criticity ORDER BY events DESC";
|
||||
$sql = "SELECT criticity, COUNT(id_evento) events
|
||||
FROM tevento
|
||||
GROUP BY criticity ORDER BY events DESC";
|
||||
|
||||
$criticities = db_get_all_rows_sql ($sql, false, false);
|
||||
|
||||
if(empty($criticities)) {
|
||||
if (empty($criticities)) {
|
||||
$criticities = array();
|
||||
$colors = array();
|
||||
}
|
||||
|
||||
foreach($criticities as $cr) {
|
||||
switch($cr['criticity']) {
|
||||
foreach ($criticities as $cr) {
|
||||
switch ($cr['criticity']) {
|
||||
case EVENT_CRIT_MAINTENANCE:
|
||||
$data[__('Maintenance')] = $cr['events'];
|
||||
$colors[__('Maintenance')] = COL_MAINTENANCE;
|
||||
|
@ -2395,13 +2397,13 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
'utimestamp > '.$bottom,
|
||||
'utimestamp < '.$top), 'criticity, utimestamp');
|
||||
|
||||
if (!empty($event['utimestamp'])){
|
||||
if (!empty($event['utimestamp'])) {
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
switch ($event['criticity']) {
|
||||
case 3:
|
||||
case EVENT_CRIT_WARNING:
|
||||
$data[$cont]['data'] = 2;
|
||||
break;
|
||||
case 4:
|
||||
case EVENT_CRIT_CRITICAL:
|
||||
$data[$cont]['data'] = 3;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1724,8 +1724,9 @@ function ui_print_module_warn_value ($max_warning, $min_warning, $str_warning, $
|
|||
|
||||
$data .= " - ";
|
||||
|
||||
if ($max_critical != $min_critical){
|
||||
$data .= format_for_graph($max_critical) ."/". format_for_graph ($min_critical);
|
||||
if ($max_critical != $min_critical) {
|
||||
$data .= format_for_graph($max_critical) . "/" .
|
||||
format_for_graph ($min_critical);
|
||||
}
|
||||
else {
|
||||
$data .= __("N/A");
|
||||
|
|
Loading…
Reference in New Issue