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:
parent
53e5025f1d
commit
fc7c2f8430
|
@ -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
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
// Load global vars
|
// Load global vars
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
if (! check_acl ($config['id_user'], 0, "DM")) {
|
if (! check_acl ($config['id_user'], 0, "DM")) {
|
||||||
db_pandora_audit("ACL Violation","Trying to access Database Debug Admin section");
|
db_pandora_audit("ACL Violation","Trying to access Database Debug Admin section");
|
||||||
|
|
|
@ -19,9 +19,9 @@ if (is_ajax ()) {
|
||||||
$id_plugin = get_parameter('id_plugin');
|
$id_plugin = get_parameter('id_plugin');
|
||||||
|
|
||||||
$description = db_get_value_filter('description', 'tplugin', array('id' => $id_plugin));
|
$description = db_get_value_filter('description', 'tplugin', array('id' => $id_plugin));
|
||||||
$preload = io_safe_output($description);
|
$preload = io_safe_output($description);
|
||||||
$preload = str_replace ("\n", "<br>", $preload);
|
$preload = str_replace ("\n", "<br>", $preload);
|
||||||
|
|
||||||
echo $preload;
|
echo $preload;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ if (($create != "") OR ($view != "")) {
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$table->style[2] = 'font-weight: bold';
|
$table->style[2] = 'font-weight: bold';
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = __('Name');
|
$data[0] = __('Name');
|
||||||
$data[1] = '<input type="text" name="form_name" size=100 value="'.$form_name.'">';
|
$data[1] = '<input type="text" name="form_name" size=100 value="'.$form_name.'">';
|
||||||
|
@ -123,14 +123,14 @@ if (($create != "") OR ($view != "")) {
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
$plugin_id = get_parameter ("view", 0);
|
$plugin_id = get_parameter ("view", 0);
|
||||||
|
|
||||||
$locked = true;
|
$locked = true;
|
||||||
|
|
||||||
// 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) {
|
||||||
|
@ -140,16 +140,16 @@ if (($create != "") OR ($view != "")) {
|
||||||
else {
|
else {
|
||||||
$locked = false;
|
$locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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>';
|
||||||
|
@ -286,7 +286,7 @@ else {
|
||||||
$plugin_execute = get_parameter ("form_execute", "");
|
$plugin_execute = get_parameter ("form_execute", "");
|
||||||
$plugin_plugin_type = get_parameter ("form_plugin_type", "0");
|
$plugin_plugin_type = get_parameter ("form_plugin_type", "0");
|
||||||
$parameters = get_parameter ("form_parameters", "");
|
$parameters = get_parameter ("form_parameters", "");
|
||||||
|
|
||||||
// Get macros
|
// Get macros
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$macros = array();
|
$macros = array();
|
||||||
|
@ -299,16 +299,16 @@ else {
|
||||||
$desc = (string)get_parameter ('field'.$i.'_desc');
|
$desc = (string)get_parameter ('field'.$i.'_desc');
|
||||||
$help = (string)get_parameter ('field'.$i.'_help');
|
$help = (string)get_parameter ('field'.$i.'_help');
|
||||||
$value = (string)get_parameter ('field'.$i.'_value');
|
$value = (string)get_parameter ('field'.$i.'_value');
|
||||||
|
|
||||||
$macros[$i]['macro'] = $macro;
|
$macros[$i]['macro'] = $macro;
|
||||||
$macros[$i]['desc'] = $desc;
|
$macros[$i]['desc'] = $desc;
|
||||||
$macros[$i]['help'] = $help;
|
$macros[$i]['help'] = $help;
|
||||||
$macros[$i]['value'] = $value;
|
$macros[$i]['value'] = $value;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$macros = json_encode($macros);
|
$macros = json_encode($macros);
|
||||||
|
|
||||||
$values = array(
|
$values = array(
|
||||||
'name' => $plugin_name,
|
'name' => $plugin_name,
|
||||||
'description' => $plugin_description,
|
'description' => $plugin_description,
|
||||||
|
@ -330,7 +330,7 @@ else {
|
||||||
echo "<h3 class='suc'>".__('Plugin updated successfully')."</h3>";
|
echo "<h3 class='suc'>".__('Plugin updated successfully')."</h3>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create plugin
|
// Create plugin
|
||||||
if (isset($_GET["create_plugin"])){
|
if (isset($_GET["create_plugin"])){
|
||||||
$plugin_name = get_parameter ("form_name", "");
|
$plugin_name = get_parameter ("form_name", "");
|
||||||
|
@ -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;
|
||||||
|
@ -353,14 +353,14 @@ else {
|
||||||
$desc = (string)get_parameter ('field'.$i.'_desc');
|
$desc = (string)get_parameter ('field'.$i.'_desc');
|
||||||
$help = (string)get_parameter ('field'.$i.'_help');
|
$help = (string)get_parameter ('field'.$i.'_help');
|
||||||
$value = (string)get_parameter ('field'.$i.'_value');
|
$value = (string)get_parameter ('field'.$i.'_value');
|
||||||
|
|
||||||
$macros[$i]['macro'] = $macro;
|
$macros[$i]['macro'] = $macro;
|
||||||
$macros[$i]['desc'] = $desc;
|
$macros[$i]['desc'] = $desc;
|
||||||
$macros[$i]['help'] = $help;
|
$macros[$i]['help'] = $help;
|
||||||
$macros[$i]['value'] = $value;
|
$macros[$i]['value'] = $value;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$macros = json_encode($macros);
|
$macros = json_encode($macros);
|
||||||
|
|
||||||
$values = array(
|
$values = array(
|
||||||
|
@ -378,29 +378,31 @@ 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not edition or insert, then list available plugins
|
// If not edition or insert, then list available plugins
|
||||||
$rows = db_get_all_rows_sql('SELECT * FROM tplugin ORDER BY name');
|
$rows = db_get_all_rows_sql('SELECT * FROM tplugin ORDER BY name');
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue