mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feat(apps/mysql): add error-state to non-responsive mysql-servers (#13993)
* feat(apps/mysql): add error-state to non-responsive mysql-servers * feat(alerting): add alert-rule for offline mysql-servers * fixup! feat(alerting): add alert-rule for offline mysql-servers * chore(style): replaced ticks * fixup! chore(style): replaced ticks * feat: added migration to make app_status field bigger * feat: moved error-detection to the application_update function * fixup! feat: moved error-detection to the application_update function * chore: updated schema * chore: fix styling * Cleaner way to handle the error states * regex should not include OK Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -459,12 +459,15 @@ function update_application($app, $response, $metrics = [], $status = '')
|
||||
];
|
||||
|
||||
if ($response != '' && $response !== false) {
|
||||
// if the response indicates an error, set it and set app_status to the raw response
|
||||
if (Str::contains($response, [
|
||||
'Traceback (most recent call last):',
|
||||
])) {
|
||||
$data['app_state'] = 'ERROR';
|
||||
} elseif (in_array($response, ['OK', 'ERROR', 'LEGACY', 'UNSUPPORTED'])) {
|
||||
$data['app_state'] = $response;
|
||||
$data['app_status'] = $response;
|
||||
} elseif (preg_match('/^(ERROR|LEGACY|UNSUPPORTED)/', $response, $matches)) {
|
||||
$data['app_state'] = $matches[1];
|
||||
$data['app_status'] = $response;
|
||||
} else {
|
||||
// should maybe be 'unknown' as state
|
||||
$data['app_state'] = 'OK';
|
||||
|
Reference in New Issue
Block a user