master
c 35 lines 1.03 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #include "rrdhost-collection.h"
4 #include "rrdset.h"
5
6 void rrd_finalize_collection_for_all_hosts(void) {
7 RRDHOST *host;
8 dfe_start_reentrant(rrdhost_root_index, host) {
9 rrdhost_finalize_collection(host);
10 }
11 dfe_done(host);
12 }
13
14 void rrdhost_finalize_collection(RRDHOST *host) {
15 ND_LOG_STACK lgs[] = {
16 ND_LOG_FIELD_TXT(NDF_NIDL_NODE, rrdhost_hostname(host)),
17 ND_LOG_FIELD_END(),
18 };
19 ND_LOG_STACK_PUSH(lgs);
20
21 nd_log(NDLS_DAEMON, NDLP_DEBUG,
22 "RRD: 'host:%s' stopping data collection...",
23 rrdhost_hostname(host));
24
25 RRDSET *st;
26 rrdset_foreach_read(st, host)
27 rrdset_finalize_collection(st, true);
28 rrdset_foreach_done(st);
29 }
30
31 bool rrdhost_matches_window(RRDHOST *host, time_t after, time_t before, time_t now) {
32 time_t first_time_s, last_time_s;
33 rrdhost_retention(host, now, rrdhost_is_online(host), &first_time_s, &last_time_s);
34 return query_matches_retention(after, before, first_time_s, last_time_s, 0);
35 }