diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2023-12-05 13:42:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-05 13:42:46 +0200 |
commit | d2f4ef9674f481cbcc0c3f2c9cbe11e4e2b51106 (patch) | |
tree | 010c4156e4d70762d74187e9fb2f09416a0dec5d /collectors | |
parent | c77c5eca4e54715c281676bea7fa7526b3dde36d (diff) |
apps: fix uptime for groups with 0 processes (#16538)
Diffstat (limited to 'collectors')
-rw-r--r-- | collectors/apps.plugin/apps_plugin.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c index c8f7e74400..a53457f187 100644 --- a/collectors/apps.plugin/apps_plugin.c +++ b/collectors/apps.plugin/apps_plugin.c @@ -3750,7 +3750,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type struct target *w; for (w = root; w ; w = w->next) { - if (unlikely(!w->exposed && !w->is_other)) + if (unlikely(!w->exposed)) continue; send_BEGIN(type, w->clean_name, "processes", dt); @@ -3806,16 +3806,30 @@ static void send_collected_data_to_netdata(struct target *root, const char *type #endif #ifndef __FreeBSD__ - send_BEGIN(type, w->clean_name, "uptime", dt); - send_SET("uptime", (global_uptime > w->starttime) ? (global_uptime - w->starttime) : 0); - send_END(); + if (w->processes == 0) { + send_BEGIN(type, w->clean_name, "uptime", dt); + send_SET("uptime", 0); + send_END(); - if (enable_detailed_uptime_charts) { - send_BEGIN(type, w->clean_name, "uptime_summary", dt); - send_SET("min", w->uptime_min); - send_SET("avg", w->processes > 0 ? w->uptime_sum / w->processes : 0); - send_SET("max", w->uptime_max); + if (enable_detailed_uptime_charts) { + send_BEGIN(type, w->clean_name, "uptime_summary", dt); + send_SET("min", 0); + send_SET("avg", 0); + send_SET("max", 0); + send_END(); + } + } else { + send_BEGIN(type, w->clean_name, "uptime", dt); + send_SET("uptime", (global_uptime > w->starttime) ? (global_uptime - w->starttime) : 0); send_END(); + + if (enable_detailed_uptime_charts) { + send_BEGIN(type, w->clean_name, "uptime_summary", dt); + send_SET("min", w->uptime_min); + send_SET("avg", w->processes > 0 ? w->uptime_sum / w->processes : 0); + send_SET("max", w->uptime_max); + send_END(); + } } #endif |