summaryrefslogtreecommitdiffstats
path: root/src/collectors/profile.plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/collectors/profile.plugin')
-rw-r--r--src/collectors/profile.plugin/README.md24
-rw-r--r--src/collectors/profile.plugin/plugin_profile.cc10
2 files changed, 18 insertions, 16 deletions
diff --git a/src/collectors/profile.plugin/README.md b/src/collectors/profile.plugin/README.md
index 7e3681208..992e6de99 100644
--- a/src/collectors/profile.plugin/README.md
+++ b/src/collectors/profile.plugin/README.md
@@ -4,25 +4,25 @@ This plugin allows someone to backfill an agent with random data.
A user can specify:
- - The number charts they want,
- - the number of dimensions per chart,
- - the desire update every collection frequency,
- - the number of seconds to backfill.
- - the number of collection threads.
+- The number charts they want,
+- the number of dimensions per chart,
+- the desire update every collection frequency,
+- the number of seconds to backfill.
+- the number of collection threads.
## Configuration
-Edit the `netdata.conf` configuration file using [`edit-config`](/docs/netdata-agent/configuration/README.md#edit-netdataconf) from the [Netdata config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory), which is typically at `/etc/netdata`.
+Edit the `netdata.conf` configuration file using [`edit-config`](/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) from the [Netdata config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory), which is typically at `/etc/netdata`.
Scroll down to the `[plugin:profile]` section to find the available options:
-```
+```text
[plugin:profile]
- update every = 5
- number of charts = 200
- number of dimensions per chart = 5
- seconds to backfill = 86400
- number of threads = 16
+ update every = 5
+ number of charts = 200
+ number of dimensions per chart = 5
+ seconds to backfill = 86400
+ number of threads = 16
```
The `number of threads` option will create the specified number of collection
diff --git a/src/collectors/profile.plugin/plugin_profile.cc b/src/collectors/profile.plugin/plugin_profile.cc
index 390bca29e..14de55db1 100644
--- a/src/collectors/profile.plugin/plugin_profile.cc
+++ b/src/collectors/profile.plugin/plugin_profile.cc
@@ -117,7 +117,7 @@ public:
worker_register_job_custom_metric(WORKER_JOB_METRIC_POINTS_BACKFILLED, "points backfilled", "points", WORKER_METRIC_ABSOLUTE);
heartbeat_t HB;
- heartbeat_init(&HB);
+ heartbeat_init(&HB, UpdateEvery * USEC_PER_SEC);
worker_is_busy(WORKER_JOB_CREATE_CHARTS);
create();
@@ -157,7 +157,7 @@ public:
if (CollectionTV.tv_sec >= NowTV.tv_sec) {
worker_is_idle();
- heartbeat_next(&HB, UpdateEvery * USEC_PER_SEC);
+ heartbeat_next(&HB);
}
}
}
@@ -194,9 +194,11 @@ static void profile_main_cleanup(void *pptr) {
extern "C" void *profile_main(void *ptr) {
CLEANUP_FUNCTION_REGISTER(profile_main_cleanup) cleanup_ptr = ptr;
- int UpdateEvery = (int) config_get_number(CONFIG_SECTION_PROFILE, "update every", 1);
- if (UpdateEvery < localhost->rrd_update_every)
+ int UpdateEvery = (int) config_get_duration_seconds(CONFIG_SECTION_PROFILE, "update every", 1);
+ if (UpdateEvery < localhost->rrd_update_every) {
UpdateEvery = localhost->rrd_update_every;
+ config_set_duration_seconds(CONFIG_SECTION_PROFILE, "update every", UpdateEvery);
+ }
// pick low-default values, in case this plugin is ever enabled accidentaly.
size_t NumThreads = config_get_number(CONFIG_SECTION_PROFILE, "number of threads", 2);