mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-23 05:45:59 +02:00
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_events.php, include/functions_reporting.php, include/functions_db.php, extensions/users_connected.php, general/logon_ok.php: added the SQL queries PostgreSQL compatible, in this case with the function to get unix_timestamp. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4060 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dc16266ef9
commit
8e3a474bf4
@ -1,3 +1,10 @@
|
|||||||
|
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_events.php, include/functions_reporting.php,
|
||||||
|
include/functions_db.php, extensions/users_connected.php,
|
||||||
|
general/logon_ok.php: added the SQL queries PostgreSQL
|
||||||
|
compatible, in this case with the function to get unix_timestamp.
|
||||||
|
|
||||||
2011-03-04 Miguel de Dios <miguel.dedios@artica.es>
|
2011-03-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/functions_db.php: made rollback the version of function
|
* include/functions_db.php: made rollback the version of function
|
||||||
|
@ -17,6 +17,8 @@ function users_extension_main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function users_extension_main_god ($god = true) {
|
function users_extension_main_god ($god = true) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
if (isset($config["id_user"])) {
|
if (isset($config["id_user"])) {
|
||||||
if (!check_acl ($config["id_user"], 0, "UM")) {
|
if (!check_acl ($config["id_user"], 0, "UM")) {
|
||||||
return;
|
return;
|
||||||
@ -25,9 +27,19 @@ function users_extension_main_god ($god = true) {
|
|||||||
|
|
||||||
// Header
|
// Header
|
||||||
print_page_header (__("Users connected"), "images/extensions.png", false, "", $god);
|
print_page_header (__("Users connected"), "images/extensions.png", false, "", $god);
|
||||||
|
|
||||||
$sql = "SELECT id_usuario, ip_origen, fecha, accion FROM tsesion WHERE descripcion = 'Logged in' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - 3600) GROUP BY id_usuario, ip_origen, accion";
|
|
||||||
|
|
||||||
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
$sql = "SELECT id_usuario, ip_origen, fecha, accion
|
||||||
|
FROM tsesion
|
||||||
|
WHERE descripcion = 'Logged in' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - 3600) GROUP BY id_usuario, ip_origen, accion";
|
||||||
|
case "postgresql":
|
||||||
|
$sql = "SELECT id_usuario, ip_origen, fecha, accion
|
||||||
|
FROM tsesion
|
||||||
|
WHERE descripcion = 'Logged in' AND utimestamp > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 3600) GROUP BY id_usuario, ip_origen, accion";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$rows = get_db_all_rows_sql ($sql);
|
$rows = get_db_all_rows_sql ($sql);
|
||||||
if (empty ($rows)) {
|
if (empty ($rows)) {
|
||||||
$rows = array ();
|
$rows = array ();
|
||||||
|
@ -152,10 +152,21 @@ $table->head[2] = __('Date');
|
|||||||
$table->head[3] = __('Source IP');
|
$table->head[3] = __('Source IP');
|
||||||
$table->head[4] = __('Comments');
|
$table->head[4] = __('Comments');
|
||||||
|
|
||||||
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
|
switch ($config["dbtype"]) {
|
||||||
FROM tsesion
|
case "mysql":
|
||||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
|
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
|
||||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
|
FROM tsesion
|
||||||
|
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
|
||||||
|
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
|
||||||
|
FROM tsesion
|
||||||
|
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 604800)
|
||||||
|
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$sessions = get_db_all_rows_sql ($sql);
|
$sessions = get_db_all_rows_sql ($sql);
|
||||||
|
|
||||||
if ($sessions === false)
|
if ($sessions === false)
|
||||||
|
@ -2638,6 +2638,8 @@ function get_agentmodule_last_status($id_agentmodule = 0) {
|
|||||||
* The value -1 is returned in case the agent has exceed its interval.
|
* The value -1 is returned in case the agent has exceed its interval.
|
||||||
*/
|
*/
|
||||||
function get_agent_status($id_agent = 0) {
|
function get_agent_status($id_agent = 0) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
$modules = get_agent_modules ($id_agent, 'id_agente_modulo', array('disabled' => 0), true, false);
|
$modules = get_agent_modules ($id_agent, 'id_agente_modulo', array('disabled' => 0), true, false);
|
||||||
|
|
||||||
$modules_status = array();
|
$modules_status = array();
|
||||||
@ -2654,12 +2656,24 @@ function get_agent_status($id_agent = 0) {
|
|||||||
// If all the modules are asynchronous or keep alive, the group cannot be unknown
|
// If all the modules are asynchronous or keep alive, the group cannot be unknown
|
||||||
if($modules_async < count($modules)) {
|
if($modules_async < count($modules)) {
|
||||||
$time = get_system_time ();
|
$time = get_system_time ();
|
||||||
$status = get_db_value_filter ('COUNT(*)',
|
|
||||||
'tagente',
|
switch ($config["dbtype"]) {
|
||||||
array ('id_agente' => (int) $id_agent,
|
case "mysql":
|
||||||
'UNIX_TIMESTAMP(ultimo_contacto) + intervalo * 2 > '.$time));
|
$status = get_db_value_filter ('COUNT(*)',
|
||||||
|
'tagente',
|
||||||
|
array ('id_agente' => (int) $id_agent,
|
||||||
|
'UNIX_TIMESTAMP(ultimo_contacto) + intervalo * 2 > '.$time));
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$status = get_db_value_filter ('COUNT(*)',
|
||||||
|
'tagente',
|
||||||
|
array ('id_agente' => (int) $id_agent,
|
||||||
|
'ceil(date_part(\'epoch\', ultimo_contacto)) + intervalo * 2 > '.$time));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $status)
|
if (! $status)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status is 0 for normal, 1 for critical, 2 for warning and 3 for unknown. 4 for alert fired
|
// Status is 0 for normal, 1 for critical, 2 for warning and 3 for unknown. 4 for alert fired
|
||||||
@ -2738,13 +2752,6 @@ function get_group_status ($id_group = 0) {
|
|||||||
*/
|
*/
|
||||||
function get_module_status ($id_module = 0) {
|
function get_module_status ($id_module = 0) {
|
||||||
$time = get_system_time ();
|
$time = get_system_time ();
|
||||||
/*$status = get_db_value_filter ('COUNT(*)',
|
|
||||||
'tagente',
|
|
||||||
array ('id_agente' => (int) $id_agent,
|
|
||||||
'UNIX_TIMESTAMP(ultimo_contacto) + intervalo * 2 > '.$time,
|
|
||||||
'UNIX_TIMESTAMP(ultimo_contacto_remoto) + intervalo * 2 > '.$time));
|
|
||||||
if (! $status)
|
|
||||||
return -1;*/
|
|
||||||
|
|
||||||
$status = get_db_sql ("SELECT estado
|
$status = get_db_sql ("SELECT estado
|
||||||
FROM tagente_estado, tagente_modulo
|
FROM tagente_estado, tagente_modulo
|
||||||
|
@ -259,12 +259,26 @@ function get_event_description ($id_event) {
|
|||||||
* @return int event id
|
* @return int event id
|
||||||
*/
|
*/
|
||||||
function create_event ($event, $id_group, $id_agent, $status = 0, $id_user = "", $event_type = "unknown", $priority = 0, $id_agent_module = 0, $id_aam = 0) {
|
function create_event ($event, $id_group, $id_agent, $status = 0, $id_user = "", $event_type = "unknown", $priority = 0, $id_agent_module = 0, $id_aam = 0) {
|
||||||
$sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp,
|
global $config;
|
||||||
estado, utimestamp, id_usuario, event_type, criticity,
|
|
||||||
id_agentmodule, id_alert_am)
|
switch ($config["dbtype"]) {
|
||||||
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()), "%s", "%s", %d, %d, %d)',
|
case "mysql":
|
||||||
$id_agent, $id_group, $event, $status, $id_user, $event_type,
|
$sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp,
|
||||||
$priority, $id_agent_module, $id_aam);
|
estado, utimestamp, id_usuario, event_type, criticity,
|
||||||
|
id_agentmodule, id_alert_am)
|
||||||
|
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()), "%s", "%s", %d, %d, %d)',
|
||||||
|
$id_agent, $id_group, $event, $status, $id_user, $event_type,
|
||||||
|
$priority, $id_agent_module, $id_aam);
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp,
|
||||||
|
estado, utimestamp, id_usuario, event_type, criticity,
|
||||||
|
id_agentmodule, id_alert_am)
|
||||||
|
VALUES (%d, %d, "%s", NOW(), %d, ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s", "%s", %d, %d, %d)',
|
||||||
|
$id_agent, $id_group, $event, $status, $id_user, $event_type,
|
||||||
|
$priority, $id_agent_module, $id_aam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return (int) process_sql ($sql, "insert_id");
|
return (int) process_sql ($sql, "insert_id");
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,8 @@ function get_group_stats ($id_group = 0) {
|
|||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Realtime stats, done by PHP Console
|
// Realtime stats, done by PHP Console
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
if (!is_array($id_group)){
|
if (!is_array($id_group)){
|
||||||
$my_group = $id_group;
|
$my_group = $id_group;
|
||||||
@ -585,28 +586,126 @@ function get_group_stats ($id_group = 0) {
|
|||||||
foreach ($id_group as $group){
|
foreach ($id_group as $group){
|
||||||
|
|
||||||
|
|
||||||
$data["agents_unknown"] += get_db_sql ("SELECT COUNT(*) FROM tagente WHERE id_grupo = $group AND disabled = 0 AND ultimo_contacto < NOW() - (intervalo *2)");
|
$data["agents_unknown"] += get_db_sql ("SELECT COUNT(*)
|
||||||
|
FROM tagente
|
||||||
|
WHERE id_grupo = $group AND disabled = 0 AND ultimo_contacto < NOW() - (intervalo * 2)");
|
||||||
|
|
||||||
$data["total_agents"] += get_db_sql ("SELECT COUNT(*) FROM tagente WHERE id_grupo = $group AND disabled = 0");
|
$data["total_agents"] += get_db_sql ("SELECT COUNT(*)
|
||||||
|
FROM tagente WHERE id_grupo = $group AND disabled = 0");
|
||||||
|
|
||||||
$data["monitor_checks"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0");
|
$data["monitor_checks"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0");
|
||||||
|
|
||||||
$data["total_not_init"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0
|
$data["total_not_init"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND tagente_estado.utimestamp = 0");
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24)
|
||||||
|
AND tagente_estado.utimestamp = 0");
|
||||||
|
|
||||||
$data["monitor_ok"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))");
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
$data["monitor_ok"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND estado = 0
|
||||||
|
AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2)
|
||||||
|
OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100)))
|
||||||
|
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))");
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$data["monitor_ok"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND estado = 0
|
||||||
|
AND ((ceil(date_part('epoch', CURRENT_TIMESTAMP)) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2)
|
||||||
|
OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100)))
|
||||||
|
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$data["monitor_critical"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0");
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
$data["monitor_critical"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0");
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$data["monitor_critical"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND estado = 1 AND ((ceil(date_part('epoch', CURRENT_TIMESTAMP)) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$data["monitor_warning"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 2 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0");
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
$data["monitor_warning"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0
|
||||||
|
AND estado = 2 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2)
|
||||||
|
OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0");
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$data["monitor_warning"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0
|
||||||
|
AND estado = 2 AND ((ceil(date_part('epoch', CURRENT_TIMESTAMP)) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2)
|
||||||
|
OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$data["monitor_unknown"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)");
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
$data["monitor_unknown"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0
|
||||||
|
AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100)
|
||||||
|
AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)");
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
$data["monitor_unknown"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0
|
||||||
|
AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100)
|
||||||
|
AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$data["monitor_not_init"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0");
|
$data["monitor_not_init"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0
|
||||||
|
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0");
|
||||||
|
|
||||||
$data["monitor_alerts"] += get_db_sql ("SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = $group AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo");
|
$data["monitor_alerts"] += get_db_sql ("SELECT COUNT(talert_template_modules.id)
|
||||||
|
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente_modulo.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND tagente.disabled = 0
|
||||||
|
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo");
|
||||||
|
|
||||||
$data["monitor_alerts_fired"] += get_db_sql ("SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = $group AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0");
|
$data["monitor_alerts_fired"] += get_db_sql ("SELECT COUNT(talert_template_modules.id)
|
||||||
|
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
|
||||||
|
WHERE tagente.id_grupo = $group AND tagente_modulo.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0 AND tagente.disabled = 0
|
||||||
|
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Monitor health (percentage)
|
Monitor health (percentage)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user