From 7d9f22705f34c4a2bae313e2c04e6845aff52334 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 31 Oct 2022 08:13:41 -0500 Subject: [PATCH] Memcached application improve error visibility (#14536) --- includes/polling/applications/memcached.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/polling/applications/memcached.inc.php b/includes/polling/applications/memcached.inc.php index 7761d0ac53..8c3d98c85c 100644 --- a/includes/polling/applications/memcached.inc.php +++ b/includes/polling/applications/memcached.inc.php @@ -12,8 +12,9 @@ if (! empty($agent_data['app']['memcached'])) { $data = json_app_get($device, $name, '1.1')['data'] ?? []; $data = $data[$app->app_instance] ?? reset($data); } catch (JsonAppException $e) { - echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; - update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message + $error_string = 'ERROR: ' . $e->getCode() . ':' . $e->getMessage(); + echo PHP_EOL . $name . ':' . $error_string . PHP_EOL; + update_application($app, $error_string); // Set empty metrics and error message return; } @@ -66,4 +67,4 @@ $fields = [ $app_id = $app->app_id; $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); -update_application($app, $result, $fields); +update_application($app, empty($data) ? 'ERROR: No Data' : 'OK', $fields);