Added server component status - crash -

This commit is contained in:
fbsanchez 2020-10-21 14:03:46 +02:00
parent 7bd7d190c5
commit bfa5b81ee8
5 changed files with 20 additions and 3 deletions

View File

@ -92,7 +92,17 @@ foreach ($servers as $server) {
// Status
$data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true);
if (($server['status'] == 0) || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)) {
$data[1] = ui_print_status_image(STATUS_SERVER_DOWN, '', true);
$data[1] = ui_print_status_image(
STATUS_SERVER_DOWN,
__('Server is stopped.'),
true
);
} else if ($server['status'] == -1) {
$data[1] = ui_print_status_image(
STATUS_SERVER_CRASH,
__('Server has crashed.'),
true
);
}
// Type

View File

@ -309,7 +309,7 @@ define('STATUS_ALERT_DISABLED', 'alert_disabled.png');
// For servers.
define('STATUS_SERVER_OK', 'server_ok.png');
define('STATUS_SERVER_DOWN', 'server_down.png');
define('STATUS_SERVER_CRASH', 'server_crash.png');
// Status images (ball).
@ -335,6 +335,7 @@ define('STATUS_ALERT_DISABLED_BALL', 'alert_disabled_ball.png');
// For servers.
define('STATUS_SERVER_OK_BALL', 'server_ok_ball.png');
define('STATUS_SERVER_DOWN_BALL', 'server_down_ball.png');
define('STATUS_SERVER_CRASH_BALL', 'server_crash_ball.png');

View File

@ -2494,6 +2494,8 @@ function modules_get_color_status($status, $force_module=false)
case STATUS_AGENT_CRITICAL:
case STATUS_MODULE_CRITICAL_BALL:
case STATUS_AGENT_CRITICAL_BALL:
case STATUS_SERVER_CRASH:
case STATUS_SERVER_CRASH_BALL:
return COL_CRITICAL;
case AGENT_MODULE_STATUS_WARNING:

View File

@ -2762,6 +2762,7 @@ function get_shape_status_set($type)
// Small squares.
case STATUS_SERVER_OK:
case STATUS_SERVER_DOWN:
case STATUS_SERVER_CRASH:
$return = ['class' => 'status_small_squares'];
break;
@ -2773,6 +2774,9 @@ function get_shape_status_set($type)
case STATUS_AGENT_OK_BALL:
case STATUS_AGENT_NO_DATA_BALL:
case STATUS_AGENT_NO_MONITORS_BALL:
case STATUS_SERVER_OK_BALL:
case STATUS_SERVER_DOWN_BALL:
case STATUS_SERVER_CRASH_BALL:
$return = ['class' => 'status_balls'];
break;

View File

@ -771,7 +771,7 @@ sub main() {
die("Server thread crashed.") unless (check_server_threads() == 1);
db_do ($DBH,
"UPDATE tserver SET status = 0
"UPDATE tserver SET status = -1
WHERE UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(keepalive) > 2*server_keepalive"
);