2013-02-07 Miguel de Dios <miguel.dedios@artica.es>

* godmode/db/db_refine.php, godmode/servers/plugin.php: improved
	the code style.
	
	* include/functions_reporting.php: fixed the SLA when it is the
	equal to limit.
	
	Fixes: #3602722




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7606 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-07 13:43:23 +00:00
parent 2415e5ed9a
commit f6fd3a085d
4 changed files with 50 additions and 36 deletions

View File

@ -1,3 +1,13 @@
2013-02-07 Miguel de Dios <miguel.dedios@artica.es>
* godmode/db/db_refine.php, godmode/servers/plugin.php: improved
the code style.
* include/functions_reporting.php: fixed the SLA when it is the
equal to limit.
Fixes: #3602722
2013-02-07 Miguel de Dios <miguel.dedios@artica.es> 2013-02-07 Miguel de Dios <miguel.dedios@artica.es>
* godmode/modules/manage_network_components_form_common.php: fixed * godmode/modules/manage_network_components_form_common.php: fixed

View File

@ -130,7 +130,7 @@ if (($create != "") OR ($view != "")) {
// If we have plugin id (update mode) and this plugin used by any module or component // If we have plugin id (update mode) and this plugin used by any module or component
// The command configuration will be locked // The command configuration will be locked
if($plugin_id > 0) { if ($plugin_id > 0) {
$modules_using_plugin = db_get_value_filter('count(*)','tagente_modulo', array('delete_pending' => 0, 'id_plugin' => $plugin_id)); $modules_using_plugin = db_get_value_filter('count(*)','tagente_modulo', array('delete_pending' => 0, 'id_plugin' => $plugin_id));
$components_using_plugin = db_get_value_filter('count(*)','tnetwork_component', array('id_plugin' => $plugin_id)); $components_using_plugin = db_get_value_filter('count(*)','tnetwork_component', array('id_plugin' => $plugin_id));
if(($components_using_plugin + $modules_using_plugin) == 0) { if(($components_using_plugin + $modules_using_plugin) == 0) {
@ -142,14 +142,14 @@ if (($create != "") OR ($view != "")) {
} }
$disabled = ''; $disabled = '';
if($locked) { if ($locked) {
$disabled = 'readonly="readonly"'; $disabled = 'readonly="readonly"';
} }
$data = array(); $data = array();
$data[0] = __('Plugin command'); $data[0] = __('Plugin command');
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf" size=100 value="'.$form_execute.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf" size=100 value="'.$form_execute.'" '.$disabled.'>';
if($locked) { if ($locked) {
$data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
} }
$table->data['plugin_command'] = $data; $table->data['plugin_command'] = $data;
@ -157,7 +157,7 @@ if (($create != "") OR ($view != "")) {
$data = array(); $data = array();
$data[0] = __('Plug-in parameters').ui_print_help_icon ('plugin_parameters', true); $data[0] = __('Plug-in parameters').ui_print_help_icon ('plugin_parameters', true);
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>';
if($locked) { if ($locked) {
$data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
} }
$table->data['plugin_parameters'] = $data; $table->data['plugin_parameters'] = $data;
@ -180,7 +180,7 @@ if (($create != "") OR ($view != "")) {
// The next row number is plugin_9 // The next row number is plugin_9
$next_name_number = 9; $next_name_number = 9;
$i = 1; $i = 1;
while(1) { while (1) {
// Always print at least one macro // Always print at least one macro
if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) { if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
break; break;
@ -239,7 +239,7 @@ if (($create != "") OR ($view != "")) {
$i++; $i++;
} }
if(!$locked) { if (!$locked) {
$datam = array (); $datam = array ();
$datam[0] = '<span style="font-weight: bold">'.__('Add macro').'</span> <a href="javascript:new_macro(\'table-form-plugin_\');update_preview();">'.html_print_image('images/add.png',true).'</a>'; $datam[0] = '<span style="font-weight: bold">'.__('Add macro').'</span> <a href="javascript:new_macro(\'table-form-plugin_\');update_preview();">'.html_print_image('images/add.png',true).'</a>';
$datam[0] .= '<div id="next_macro" style="display:none">'.$i.'</div>'; $datam[0] .= '<div id="next_macro" style="display:none">'.$i.'</div>';
@ -344,7 +344,7 @@ else {
// Get macros // Get macros
$i = 1; $i = 1;
$macros = array(); $macros = array();
while(1) { while (1) {
$macro = (string)get_parameter ('field'.$i.'_macro'); $macro = (string)get_parameter ('field'.$i.'_macro');
if($macro == '') { if($macro == '') {
break; break;
@ -378,25 +378,27 @@ else {
$result = db_process_sql_insert('tplugin', $values); $result = db_process_sql_insert('tplugin', $values);
if (! $result) { if (! $result) {
echo "<h3 class='error'>".__('Problem creating plugin')."</h3>"; echo "<h3 class='error'>" .
__('Problem creating plugin') . "</h3>";
} }
else { else {
echo "<h3 class='suc'>".__('Plugin created successfully')."</h3>"; echo "<h3 class='suc'>" .
__('Plugin created successfully') . "</h3>";
} }
} }
if (isset($_GET["kill_plugin"])){ // if delete alert if (isset($_GET["kill_plugin"])) { // if delete alert
$plugin_id = get_parameter ("kill_plugin", 0); $plugin_id = get_parameter ("kill_plugin", 0);
$result = db_process_sql_delete('tplugin', array('id' => $plugin_id)); $result = db_process_sql_delete('tplugin', array('id' => $plugin_id));
if (! $result){ if (! $result) {
echo "<h3 class='error'>".__('Problem deleting plugin')."</h3>"; echo "<h3 class='error'>".__('Problem deleting plugin')."</h3>";
} }
else { else {
echo "<h3 class='suc'>".__('Plugin deleted successfully')."</h3>"; echo "<h3 class='suc'>".__('Plugin deleted successfully')."</h3>";
} }
if ($plugin_id != 0){ if ($plugin_id != 0) {
$result = db_process_sql_delete('tagente_modulo', array('id_plugin' => $plugin_id)); $result = db_process_sql_delete('tagente_modulo', array('id_plugin' => $plugin_id));
} }
} }

View File

@ -2790,15 +2790,15 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'], $sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'],
$content['time_to']); $content['time_to']);
if($data_sla == false) { if ($data_sla == false) {
$data_sla = array(); $data_sla = array();
} }
//Get the sla_value in % and store it on $sla_value //Get the sla_value in % and store it on $sla_value
$data_total = 0; $data_total = 0;
$data_pass = 0; $data_pass = 0;
foreach($data_sla as $d) { foreach ($data_sla as $d) {
switch($d['data']) { switch ($d['data']) {
case 1: case 1:
$data_pass += $d['utimestamp']; $data_pass += $d['utimestamp'];
$data_total += $d['utimestamp']; $data_total += $d['utimestamp'];
@ -2824,11 +2824,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
//Do not show right modules if 'only_display_wrong' is active //Do not show right modules if 'only_display_wrong' is active
if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) continue; if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit'])
continue;
// Calculate general pie graph data // Calculate general pie graph data
foreach($data_sla as $d) { foreach ($data_sla as $d) {
switch($d['data']) { switch ($d['data']) {
case 1: case 1:
$data_graph[__('Inside limits')] += $d['utimestamp']; $data_graph[__('Inside limits')] += $d['utimestamp'];
break; break;
@ -2914,7 +2915,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[5] = ''; $data[5] = '';
$data[6] = ''; $data[6] = '';
if ($sla_value > $sla['sla_limit']) { if ($sla_value >= $sla['sla_limit']) {
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'; $data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>'; $data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
} }
@ -2925,10 +2926,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
// Print icon with status including edge // Print icon with status including edge
if ($sla_value > $sla['sla_limit']+$edge_interval) { if ($sla_value > ($sla['sla_limit'] + $edge_interval)) {
$data[6] = html_print_image('images/status_sets/default/severity_normal.png',true,array('title'=>__('Inside limits'))); $data[6] = html_print_image('images/status_sets/default/severity_normal.png',true,array('title'=>__('Inside limits')));
} }
elseif ($sla_value <= $sla['sla_limit']+$edge_interval && $sla_value >= $sla['sla_limit']-$edge_interval) { elseif (($sla_value <= $sla['sla_limit'] + $edge_interval)
&& ($sla_value >= $sla['sla_limit'] - $edge_interval)) {
$data[6] = html_print_image('images/status_sets/default/severity_warning.png',true,array('title'=>__('On the edge'))); $data[6] = html_print_image('images/status_sets/default/severity_warning.png',true,array('title'=>__('On the edge')));
} }
else { else {