summaryrefslogtreecommitdiffstats
path: root/src/plugin_checks.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2017-04-30 16:09:37 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2017-04-30 18:09:45 +0000
commitbed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521 (patch)
tree519e5945ec0db75bfb50583539caa408a5819e87 /src/plugin_checks.c
parentTemporarily disable signature checking (diff)
downloadnetdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.tar.xz
netdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.zip
New upstream version 1.6.0+dfsg
Diffstat (limited to 'src/plugin_checks.c')
-rw-r--r--src/plugin_checks.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/plugin_checks.c b/src/plugin_checks.c
index fcc542e6..3a0a83bd 100644
--- a/src/plugin_checks.c
+++ b/src/plugin_checks.c
@@ -11,23 +11,26 @@ void *checks_main(void *ptr) {
if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
error("Cannot set pthread cancel state to ENABLE.");
- usec_t usec = 0, susec = rrd_update_every * USEC_PER_SEC, loop_usec = 0, total_susec = 0;
+ usec_t usec = 0, susec = localhost->rrd_update_every * USEC_PER_SEC, loop_usec = 0, total_susec = 0;
struct timeval now, last, loop;
RRDSET *check1, *check2, *check3, *apps_cpu = NULL;
- check1 = rrdset_create("netdata", "check1", NULL, "netdata", NULL, "Caller gives microseconds", "a million !", 99999, rrd_update_every, RRDSET_TYPE_LINE);
- rrddim_add(check1, "absolute", NULL, -1, 1, RRDDIM_ABSOLUTE);
- rrddim_add(check1, "incremental", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ check1 = rrdset_create_localhost("netdata", "check1", NULL, "netdata", NULL, "Caller gives microseconds"
+ , "a million !", 99999, localhost->rrd_update_every, RRDSET_TYPE_LINE);
+ rrddim_add(check1, "absolute", NULL, -1, 1, RRD_ALGORITHM_ABSOLUTE);
+ rrddim_add(check1, "incremental", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- check2 = rrdset_create("netdata", "check2", NULL, "netdata", NULL, "Netdata calcs microseconds", "a million !", 99999, rrd_update_every, RRDSET_TYPE_LINE);
- rrddim_add(check2, "absolute", NULL, -1, 1, RRDDIM_ABSOLUTE);
- rrddim_add(check2, "incremental", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ check2 = rrdset_create_localhost("netdata", "check2", NULL, "netdata", NULL, "Netdata calcs microseconds"
+ , "a million !", 99999, localhost->rrd_update_every, RRDSET_TYPE_LINE);
+ rrddim_add(check2, "absolute", NULL, -1, 1, RRD_ALGORITHM_ABSOLUTE);
+ rrddim_add(check2, "incremental", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- check3 = rrdset_create("netdata", "checkdt", NULL, "netdata", NULL, "Clock difference", "microseconds diff", 99999, rrd_update_every, RRDSET_TYPE_LINE);
- rrddim_add(check3, "caller", NULL, 1, 1, RRDDIM_ABSOLUTE);
- rrddim_add(check3, "netdata", NULL, 1, 1, RRDDIM_ABSOLUTE);
- rrddim_add(check3, "apps.plugin", NULL, 1, 1, RRDDIM_ABSOLUTE);
+ check3 = rrdset_create_localhost("netdata", "checkdt", NULL, "netdata", NULL, "Clock difference"
+ , "microseconds diff", 99999, localhost->rrd_update_every, RRDSET_TYPE_LINE);
+ rrddim_add(check3, "caller", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ rrddim_add(check3, "netdata", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ rrddim_add(check3, "apps.plugin", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
now_realtime_timeval(&last);
while(1) {
@@ -39,8 +42,8 @@ void *checks_main(void *ptr) {
usec = loop_usec - susec;
debug(D_PROCNETDEV_LOOP, "CHECK: last loop took %llu usec (worked for %llu, sleeped for %llu).", loop_usec, usec, susec);
- if(usec < (rrd_update_every * USEC_PER_SEC / 2ULL)) susec = (rrd_update_every * USEC_PER_SEC) - usec;
- else susec = rrd_update_every * USEC_PER_SEC / 2ULL;
+ if(usec < (localhost->rrd_update_every * USEC_PER_SEC / 2ULL)) susec = (localhost->rrd_update_every * USEC_PER_SEC) - usec;
+ else susec = localhost->rrd_update_every * USEC_PER_SEC / 2ULL;
// --------------------------------------------------------------------
// Calculate loop time
@@ -68,7 +71,7 @@ void *checks_main(void *ptr) {
// --------------------------------------------------------------------
// check chart 3
- if(!apps_cpu) apps_cpu = rrdset_find("apps.cpu");
+ if(!apps_cpu) apps_cpu = rrdset_find_localhost("apps.cpu");
if(check3->counter_done) rrdset_next_usec(check3, loop_usec);
now_realtime_timeval(&loop);
rrddim_set(check3, "caller", (long long) dt_usec(&loop, &check1->last_collected_time));