Merge branch 'ent-6571-failazo-ha-al-perder-hilos' into 'develop'

Added server component status - crash -

See merge request artica/pandorafms!3547
This commit is contained in:
Daniel Rodriguez 2020-11-04 16:39:28 +01:00
commit a786f5e132
7 changed files with 23 additions and 4 deletions

View File

@ -91,8 +91,20 @@ 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);
if ($server['status'] == -1) {
$data[1] = ui_print_status_image(
STATUS_SERVER_CRASH,
__('Server has crashed.'),
true
);
} else if (($server['status'] == 0)
|| (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)
) {
$data[1] = ui_print_status_image(
STATUS_SERVER_DOWN,
__('Server is stopped.'),
true
);
}
// Type

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

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"
);