summaryrefslogtreecommitdiffstats
path: root/collectors/statsd.plugin
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/statsd.plugin')
-rw-r--r--collectors/statsd.plugin/README.md6
-rw-r--r--collectors/statsd.plugin/statsd.c23
-rw-r--r--collectors/statsd.plugin/statsd.h2
3 files changed, 18 insertions, 13 deletions
diff --git a/collectors/statsd.plugin/README.md b/collectors/statsd.plugin/README.md
index f3050ceb..ba4ada51 100644
--- a/collectors/statsd.plugin/README.md
+++ b/collectors/statsd.plugin/README.md
@@ -21,7 +21,7 @@ Netdata statsd is fast. It can collect more than **1.200.000 metrics per second*
# Available StatsD collectors
-Netdata ships with collectors implemented using the StatsD collector. They are configuration files (as you will read bellow), but they function as a collector, in the sense that configuration file organize the metrics of a data source into pre-defined charts.
+Netdata ships with collectors implemented using the StatsD collector. They are configuration files (as you will read below), but they function as a collector, in the sense that configuration file organize the metrics of a data source into pre-defined charts.
On these charts, we can have alarms as with any metric and chart.
@@ -64,7 +64,7 @@ Netdata fully supports the StatsD protocol. All StatsD client libraries can be u
- Timers use `|ms`
- Histograms use `|h`
- The only difference between the two, is the `units` of the charts, as timers report *miliseconds*.
+ The only difference between the two, is the `units` of the charts, as timers report *milliseconds*.
[Sampling rate](#sampling-rates) is supported.
@@ -102,7 +102,7 @@ When sending multiple packets over UDP, it is important not to exceed the networ
Netdata will accept UDP packets up to 9000 bytes, but the underlying network will not exceed MTU.
-> You can read more about the network maxium transmission unit(MTU) in this cloudflare [article](https://www.cloudflare.com/en-gb/learning/network-layer/what-is-mtu/).
+> You can read more about the network maximum transmission unit(MTU) in this cloudflare [article](https://www.cloudflare.com/en-gb/learning/network-layer/what-is-mtu/).
## Configuration
diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c
index e30cc6e2..9e152b09 100644
--- a/collectors/statsd.plugin/statsd.c
+++ b/collectors/statsd.plugin/statsd.c
@@ -196,13 +196,13 @@ typedef struct statsd_app_chart_dimension {
} STATSD_APP_CHART_DIM;
typedef struct statsd_app_chart {
- const char *source;
const char *id;
const char *name;
const char *title;
const char *family;
const char *context;
const char *units;
+ const char *module;
long priority;
RRDSET_TYPE chart_type;
STATSD_APP_CHART_DIM *dimensions;
@@ -1214,10 +1214,15 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
chart->next = app->charts;
app->charts = chart;
- {
- char lineandfile[FILENAME_MAX + 1];
- snprintfz(lineandfile, FILENAME_MAX, "%zu@%s", line, filename);
- chart->source = strdupz(lineandfile);
+ if (!strncmp(
+ filename,
+ netdata_configured_stock_config_dir,
+ strlen(netdata_configured_stock_config_dir))) {
+ char tmpfilename[FILENAME_MAX + 1];
+ strncpyz(tmpfilename, filename, FILENAME_MAX);
+ chart->module = strdupz(basename(tmpfilename));
+ } else {
+ chart->module = strdupz("synthetic_chart");
}
}
}
@@ -1996,7 +2001,7 @@ static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *ch
, chart->title // title
, chart->units // units
, PLUGIN_STATSD_NAME // plugin
- , chart->source // module
+ , chart->module // module
, chart->priority // priority
, statsd.update_every // update every
, chart->chart_type // chart type
@@ -2175,8 +2180,8 @@ void *statsd_main(void *ptr) {
statsd.histogram_percentile = 95.0;
}
{
- char buffer[100 + 1];
- snprintf(buffer, 100, "%0.1f%%", statsd.histogram_percentile);
+ char buffer[314 + 1];
+ snprintfz(buffer, 314, "%0.1f%%", statsd.histogram_percentile);
statsd.histogram_percentile_str = strdupz(buffer);
}
@@ -2436,7 +2441,7 @@ void *statsd_main(void *ptr) {
char title[100 + 1];
snprintfz(id, 100, "plugin_statsd_collector%d_cpu", i + 1);
- snprintfz(title, 100, "NetData statsd collector thread No %d CPU usage", i + 1);
+ snprintfz(title, 100, "Netdata statsd collector thread No %d CPU usage", i + 1);
statsd.collection_threads_status[i].st_cpu = rrdset_create_localhost(
"netdata"
diff --git a/collectors/statsd.plugin/statsd.h b/collectors/statsd.plugin/statsd.h
index b741be76..37d6a08b 100644
--- a/collectors/statsd.plugin/statsd.h
+++ b/collectors/statsd.plugin/statsd.h
@@ -3,7 +3,7 @@
#ifndef NETDATA_STATSD_H
#define NETDATA_STATSD_H 1
-#include "../../daemon/common.h"
+#include "daemon/common.h"
#define STATSD_LISTEN_PORT 8125
#define STATSD_LISTEN_BACKLOG 4096