From 145aad2703ff6de8363b6b38774dfa7337bb8bfb Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Mon, 16 Oct 2023 12:38:39 +0300 Subject: apps: fix divide by zero when calc avg uptime (#16211) --- collectors/apps.plugin/apps_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c index bd204afc60..152038968b 100644 --- a/collectors/apps.plugin/apps_plugin.c +++ b/collectors/apps.plugin/apps_plugin.c @@ -3813,7 +3813,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type if (enable_detailed_uptime_charts) { send_BEGIN(type, w->clean_name, "uptime_summary", dt); send_SET("min", w->uptime_min); - send_SET("avg", w->uptime_sum / w->processes); + send_SET("avg", w->processes > 0 ? w->uptime_sum / w->processes : 0); send_SET("max", w->uptime_max); send_END(); } -- cgit v1.2.3