From 03bf87dcb06f7021bfb2df2fa8691593c6148aff Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 30 Nov 2022 19:47:00 +0100 Subject: Adding upstream version 1.37.0. Signed-off-by: Daniel Baumann --- collectors/proc.plugin/proc_mdstat.c | 40 ++---------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'collectors/proc.plugin/proc_mdstat.c') diff --git a/collectors/proc.plugin/proc_mdstat.c b/collectors/proc.plugin/proc_mdstat.c index c8015827e..63e0c68eb 100644 --- a/collectors/proc.plugin/proc_mdstat.c +++ b/collectors/proc.plugin/proc_mdstat.c @@ -78,8 +78,8 @@ static inline void make_chart_obsolete(char *name, const char *id_modifier) } static void add_labels_to_mdstat(struct raid *raid, RRDSET *st) { - rrdlabels_add(st->state->chart_labels, "device", raid->name, RRDLABEL_SRC_AUTO); - rrdlabels_add(st->state->chart_labels, "raid_level", raid->level, RRDLABEL_SRC_AUTO); + rrdlabels_add(st->rrdlabels, "device", raid->name, RRDLABEL_SRC_AUTO); + rrdlabels_add(st->rrdlabels, "raid_level", raid->level, RRDLABEL_SRC_AUTO); } int do_proc_mdstat(int update_every, usec_t dt) @@ -392,8 +392,6 @@ int do_proc_mdstat(int update_every, usec_t dt) } } - // -------------------------------------------------------------------- - if (likely(do_health && redundant_num)) { static RRDSET *st_mdstat_health = NULL; if (unlikely(!st_mdstat_health)) { @@ -413,8 +411,6 @@ int do_proc_mdstat(int update_every, usec_t dt) rrdset_isnot_obsolete(st_mdstat_health); } - else - rrdset_next(st_mdstat_health); if (!redundant_num) { if (likely(make_charts_obsolete)) @@ -435,8 +431,6 @@ int do_proc_mdstat(int update_every, usec_t dt) } } - // -------------------------------------------------------------------- - for (raid_idx = 0; raid_idx < raids_num; raid_idx++) { struct raid *raid = &raids[raid_idx]; char id[50 + 1]; @@ -467,8 +461,6 @@ int do_proc_mdstat(int update_every, usec_t dt) add_labels_to_mdstat(raid, raid->st_disks); } - else - rrdset_next(raid->st_disks); if (unlikely(!raid->rd_inuse && !(raid->rd_inuse = rrddim_find_active(raid->st_disks, "inuse")))) raid->rd_inuse = rrddim_add(raid->st_disks, "inuse", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -477,12 +469,9 @@ int do_proc_mdstat(int update_every, usec_t dt) rrddim_set_by_pointer(raid->st_disks, raid->rd_inuse, raid->inuse_disks); rrddim_set_by_pointer(raid->st_disks, raid->rd_down, raid->failed_disks); - rrdset_done(raid->st_disks); } - // -------------------------------------------------------------------- - if (likely(do_mismatch)) { snprintfz(id, 50, "%s_mismatch", raid->name); @@ -507,19 +496,14 @@ int do_proc_mdstat(int update_every, usec_t dt) add_labels_to_mdstat(raid, raid->st_mismatch_cnt); } - else - rrdset_next(raid->st_mismatch_cnt); if (unlikely(!raid->rd_mismatch_cnt && !(raid->rd_mismatch_cnt = rrddim_find_active(raid->st_mismatch_cnt, "count")))) raid->rd_mismatch_cnt = rrddim_add(raid->st_mismatch_cnt, "count", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); rrddim_set_by_pointer(raid->st_mismatch_cnt, raid->rd_mismatch_cnt, raid->mismatch_cnt); - rrdset_done(raid->st_mismatch_cnt); } - // -------------------------------------------------------------------- - if (likely(do_operations)) { snprintfz(id, 50, "%s_operation", raid->name); @@ -544,8 +528,6 @@ int do_proc_mdstat(int update_every, usec_t dt) add_labels_to_mdstat(raid, raid->st_operation); } - else - rrdset_next(raid->st_operation); if(unlikely(!raid->rd_check && !(raid->rd_check = rrddim_find_active(raid->st_operation, "check")))) raid->rd_check = rrddim_add(raid->st_operation, "check", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -560,13 +542,9 @@ int do_proc_mdstat(int update_every, usec_t dt) rrddim_set_by_pointer(raid->st_operation, raid->rd_resync, raid->resync); rrddim_set_by_pointer(raid->st_operation, raid->rd_recovery, raid->recovery); rrddim_set_by_pointer(raid->st_operation, raid->rd_reshape, raid->reshape); - rrdset_done(raid->st_operation); - // -------------------------------------------------------------------- - snprintfz(id, 50, "%s_finish", raid->name); - if (unlikely(!raid->st_finish && !(raid->st_finish = rrdset_find_active_byname_localhost(id)))) { snprintfz(family, 50, "%s (%s)", raid->name, raid->level); @@ -587,20 +565,14 @@ int do_proc_mdstat(int update_every, usec_t dt) add_labels_to_mdstat(raid, raid->st_finish); } - else - rrdset_next(raid->st_finish); if(unlikely(!raid->rd_finish_in && !(raid->rd_finish_in = rrddim_find_active(raid->st_finish, "finish_in")))) raid->rd_finish_in = rrddim_add(raid->st_finish, "finish_in", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); rrddim_set_by_pointer(raid->st_finish, raid->rd_finish_in, raid->finish_in); - rrdset_done(raid->st_finish); - // -------------------------------------------------------------------- - snprintfz(id, 50, "%s_speed", raid->name); - if (unlikely(!raid->st_speed && !(raid->st_speed = rrdset_find_active_byname_localhost(id)))) { snprintfz(family, 50, "%s (%s)", raid->name, raid->level); @@ -622,19 +594,14 @@ int do_proc_mdstat(int update_every, usec_t dt) add_labels_to_mdstat(raid, raid->st_speed); } - else - rrdset_next(raid->st_speed); if (unlikely(!raid->rd_speed && !(raid->rd_speed = rrddim_find_active(raid->st_speed, "speed")))) raid->rd_speed = rrddim_add(raid->st_speed, "speed", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); rrddim_set_by_pointer(raid->st_speed, raid->rd_speed, raid->speed); - rrdset_done(raid->st_speed); } } else { - // -------------------------------------------------------------------- - if (likely(do_nonredundant)) { snprintfz(id, 50, "%s_availability", raid->name); @@ -659,14 +626,11 @@ int do_proc_mdstat(int update_every, usec_t dt) add_labels_to_mdstat(raid, raid->st_nonredundant); } - else - rrdset_next(raid->st_nonredundant); if (unlikely(!raid->rd_nonredundant && !(raid->rd_nonredundant = rrddim_find_active(raid->st_nonredundant, "available")))) raid->rd_nonredundant = rrddim_add(raid->st_nonredundant, "available", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); rrddim_set_by_pointer(raid->st_nonredundant, raid->rd_nonredundant, 1); - rrdset_done(raid->st_nonredundant); } } -- cgit v1.2.3