2014-07-29 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php, operation/agentes/estado_monitores.php: tiny fixes for the improve the support of postgreSQL databases. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10361 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bf919297b4
commit
6488476d99
|
@ -1,3 +1,9 @@
|
|||
2014-07-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_graph.php, include/functions_reporting.php,
|
||||
operation/agentes/estado_monitores.php: tiny fixes for the improve
|
||||
the support of postgreSQL databases.
|
||||
|
||||
2014-07-29 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* include/functions_events.php: Fixed a bug that event's comment
|
||||
|
|
|
@ -1459,16 +1459,19 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
|||
$filter['id_agente'] = $id_agent;
|
||||
}
|
||||
|
||||
$fields = array('SUM(critical_count) Critical',
|
||||
'SUM(warning_count) Warning',
|
||||
'SUM(normal_count) Normal',
|
||||
'SUM(unknown_count) Unknown');
|
||||
$fields = array('SUM(critical_count) AS Critical',
|
||||
'SUM(warning_count) AS Warning',
|
||||
'SUM(normal_count) AS Normal',
|
||||
'SUM(unknown_count) AS Unknown');
|
||||
|
||||
if ($show_not_init) {
|
||||
$fields[] = 'SUM(notinit_count) "Not init"';
|
||||
}
|
||||
|
||||
$data = db_get_row_filter('tagente', $filter, $fields);
|
||||
if (empty($data)) {
|
||||
$data = array();
|
||||
}
|
||||
|
||||
array_walk($data, 'truncate_negatives');
|
||||
|
||||
|
|
|
@ -1126,16 +1126,21 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
|
|||
$tdata = array();
|
||||
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
|
||||
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
|
||||
$tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px"><div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div></div>';
|
||||
$tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px">' .
|
||||
'<div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' .
|
||||
graph_agent_status(false, $graph_width, $graph_height, true, true) .
|
||||
'</div></div>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
}
|
||||
|
||||
$output = '<fieldset class="databox tactical_set">
|
||||
<legend>' .
|
||||
__('Monitors by status') .
|
||||
'</legend>' .
|
||||
html_print_table($table_mbs, true) . '</fieldset>';
|
||||
$output = '
|
||||
<fieldset class="databox tactical_set">
|
||||
<legend>' .
|
||||
__('Monitors by status') .
|
||||
'</legend>' .
|
||||
html_print_table($table_mbs, true) .
|
||||
'</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,6 @@ if (!empty($status_text_monitor)) {
|
|||
//Count monitors/modules
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf("
|
||||
SELECT COUNT(*)
|
||||
FROM tagente_estado,
|
||||
|
@ -246,7 +245,28 @@ switch ($config["dbtype"]) {
|
|||
AND %s %s
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf("
|
||||
SELECT COUNT(DISTINCT tagente_modulo.id_module_group)
|
||||
FROM tagente_estado,
|
||||
(SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d AND nombre LIKE '%s'
|
||||
AND delete_pending = 0
|
||||
AND disabled = 0) tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND %s %s
|
||||
AND tagente_estado.estado != %d
|
||||
GROUP BY tagente_modulo.id_module_group,
|
||||
tagente_modulo.nombre
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql,
|
||||
$tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'],
|
||||
$order['order']);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("
|
||||
|
@ -265,15 +285,18 @@ switch ($config["dbtype"]) {
|
|||
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
}
|
||||
$count_modules = db_get_all_rows_sql ($sql);
|
||||
$count_modules = reset($count_modules[0]);
|
||||
|
||||
$count_modules = db_get_all_rows_sql($sql);
|
||||
if (isset($count_modules[0]))
|
||||
$count_modules = reset($count_modules[0]);
|
||||
else
|
||||
$count_modules = 0;
|
||||
|
||||
|
||||
//Get monitors/modules
|
||||
// Get all module from agent
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf("
|
||||
SELECT *
|
||||
FROM tagente_estado,
|
||||
|
@ -287,7 +310,23 @@ switch ($config["dbtype"]) {
|
|||
AND %s %s
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf("
|
||||
SELECT *
|
||||
FROM tagente_estado,
|
||||
(SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d AND nombre LIKE '%s' AND delete_pending = 0
|
||||
AND disabled = 0) tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND %s %s
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
// If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table()
|
||||
case "oracle":
|
||||
|
|
Loading…
Reference in New Issue