Move plugins.d directory outside of collectors (#18637)
* Move plugins.d out of collectors It's being used by streaming as well. * Move ndsudo and local_listeners back to collectors.
vkalintiris committed
Sep 30, 2024 at 16:14 UTC
7d4f9c58d5d82f5aad9fad12265b2dad6be5875c
37 files changed
+44
-44
.github/labeler.yml
+6
-6
@@ -77,12 +77,6 @@ area/collectors:
77
- src/collectors/**
78
- src/go/**
79
80
-collectors/plugins.d:
81
- - any:
82
- - changed-files:
83
- - any-glob-to-any-file:
84
- - src/collectors/plugins.d/**
85
-
80
collectors/apps:
81
- any:
82
- changed-files:
@@ -289,3 +283,9 @@ area/web:
283
- changed-files:
284
- any-glob-to-any-file:
285
- src/web/**
286
+
287
+area/plugins.d:
288
+ - any:
289
+ - changed-files:
290
+ - any-glob-to-any-file:
291
+ - src/plugins.d/**
CMakeLists.txt
+14
-14
@@ -1136,18 +1136,18 @@ set(INTERNAL_COLLECTORS_FILES
1136
)
1137
1138
set(PLUGINSD_PLUGIN_FILES
1139
- src/collectors/plugins.d/plugins_d.c
1140
- src/collectors/plugins.d/plugins_d.h
1141
- src/collectors/plugins.d/pluginsd_dyncfg.c
1142
- src/collectors/plugins.d/pluginsd_dyncfg.h
1143
- src/collectors/plugins.d/pluginsd_functions.c
1144
- src/collectors/plugins.d/pluginsd_functions.h
1145
- src/collectors/plugins.d/pluginsd_internals.c
1146
- src/collectors/plugins.d/pluginsd_internals.h
1147
- src/collectors/plugins.d/pluginsd_parser.c
1148
- src/collectors/plugins.d/pluginsd_parser.h
1149
- src/collectors/plugins.d/pluginsd_replication.c
1150
- src/collectors/plugins.d/pluginsd_replication.h
1139
+ src/plugins.d/plugins_d.c
1140
+ src/plugins.d/plugins_d.h
1141
+ src/plugins.d/pluginsd_dyncfg.c
1142
+ src/plugins.d/pluginsd_dyncfg.h
1143
+ src/plugins.d/pluginsd_functions.c
1144
+ src/plugins.d/pluginsd_functions.h
1145
+ src/plugins.d/pluginsd_internals.c
1146
+ src/plugins.d/pluginsd_internals.h
1147
+ src/plugins.d/pluginsd_parser.c
1148
+ src/plugins.d/pluginsd_parser.h
1149
+ src/plugins.d/pluginsd_replication.c
1150
+ src/plugins.d/pluginsd_replication.h
1151
)
1152
1153
set(RRD_PLUGIN_FILES
@@ -2068,7 +2068,7 @@ if(ENABLE_PLUGIN_CUPS)
2068
endif()
2069
2070
if(NEED_NDSUDO)
2071
- set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c)
2071
+ set(NDSUDO_FILES src/collectors/utils/ndsudo.c)
2072
2073
add_executable(ndsudo ${NDSUDO_FILES})
2074
@@ -2212,7 +2212,7 @@ endif()
2212
2213
if(ENABLE_PLUGIN_LOCAL_LISTENERS)
2214
set(LOCAL_LISTENERS_FILES
2215
- src/collectors/plugins.d/local_listeners.c
2215
+ src/collectors/utils/local_listeners.c
2216
src/libnetdata/maps/local-sockets.h
2217
)
2218
docs/developer-and-contributor-corner/python-collector.md
+1
-1
@@ -73,7 +73,7 @@ The basic elements of a Netdata collector are:
73
- `get_data()`: The basic function of the plugin which will return to Netdata the correct values.
74
75
**Note**: All names are better explained in the
76
-[External Plugins Documentation](/src/collectors/plugins.d/README.md).
76
+[External Plugins Documentation](/src/plugins.d/README.md).
77
Parameters like `priority` and `update_every` mentioned in that documentation are handled by the `python.d.plugin`,
78
not by each collection module.
79
docs/diagrams/netdata-overview.xml
+1
-1
@@ -78,7 +78,7 @@
78
<mxGeometry x="254" y="690" width="770" height="93" as="geometry" />
79
</mxCell>
80
</UserObject>
81
- <UserObject label="<div><font style="font-size: 16px"><b>plugins.d</b></font></div><font style="font-size: 16px"><b>external plugins API</b></font><div><font style="font-size: 14px">text format, over pipes</font></div>" link="https://github.com/netdata/netdata/tree/master/src/collectors/plugins.d" id="32">
81
+ <UserObject label="<div><font style="font-size: 16px"><b>plugins.d</b></font></div><font style="font-size: 16px"><b>external plugins API</b></font><div><font style="font-size: 14px">text format, over pipes</font></div>" link="https://github.com/netdata/netdata/tree/master/src/plugins.d" id="32">
82
<mxCell style="whiteSpace=wrap;html=1;fontSize=16;fillColor=#FFFFFF;strokeColor=#59DE9C;" parent="1" vertex="1">
83
<mxGeometry x="74" y="887" width="580" height="130" as="geometry" />
84
</mxCell>
docs/glossary.md
+1
-1
@@ -53,7 +53,7 @@ Use the alphabatized list below to find the answer to your single-term questions
53
54
## E
55
56
-- [**External Plugins**](/src/collectors/plugins.d/README.md): These gather metrics from external processes, such as a webserver or database, and run as independent processes that communicate with the Netdata daemon via pipes.
56
+- [**External Plugins**](/src/plugins.d/README.md): These gather metrics from external processes, such as a webserver or database, and run as independent processes that communicate with the Netdata daemon via pipes.
57
58
## F
59
docs/top-monitoring-netdata-functions.md
+1
-1
@@ -7,7 +7,7 @@ executed on the node/host where the function is made available.
7
8
Collectors besides the metric collection, storing, and/or streaming work are capable of executing specific routines on request. These routines will bring additional information to help you troubleshoot or even trigger some action to happen on the node itself.
9
10
-For more details please check out documentation on how we use our internal collector to get this from the first collector that exposes functions - [plugins.d](/src/collectors/plugins.d/README.md#function).
10
+For more details please check out documentation on how we use our internal collector to get this from the first collector that exposes functions - [plugins.d](/src/plugins.d/README.md#function).
11
12
## Prerequisites
13
packaging/installer/methods/macos.md
+1
-1
@@ -9,7 +9,7 @@ learn_rel_path: "Installation/Install on specific environments"
9
# Install Netdata on macOS
10
11
Netdata works on macOS, albeit with some limitations.
12
-The number of charts displaying system metrics is limited, but you can use any of Netdata's [external plugins](/src/collectors/plugins.d/README.md) to monitor any services you might have installed on your macOS system.
12
+The number of charts displaying system metrics is limited, but you can use any of Netdata's [external plugins](/src/plugins.d/README.md) to monitor any services you might have installed on your macOS system.
13
You could also use a macOS system as the parent node in a [streaming configuration](/src/streaming/README.md).
14
15
You can install Netdata in one of the three following ways:
src/collectors/README.md
+1
-1
@@ -45,7 +45,7 @@ specifics of what a given collector does.
45
- **External** plugins organize collectors that gather metrics from external processes, such as a MySQL database or
46
Nginx web server. They can be written in any language, and the `netdata` daemon spawns them as long-running
47
independent processes. They communicate with the daemon via pipes. All external plugins are managed by
48
- [plugins.d](/src/collectors/plugins.d/README.md), which provides additional management options.
48
+ [plugins.d](/src/plugins.d/README.md), which provides additional management options.
49
50
- **Orchestrators** are external plugins that run and manage one or more modules. They run as independent processes.
51
The Go orchestrator is in active development.
src/collectors/charts.d.plugin/README.md
+1
-1
@@ -7,7 +7,7 @@
7
3. It communicates with Netdata via a unidirectional pipe (sending data to the `netdata` daemon)
8
4. Supports any number of data collection **modules**
9
10
-To better understand the guidelines and the API behind our External plugins, please have a look at the [Introduction to External plugins](/src/collectors/plugins.d/README.md) prior to reading this page.
10
+To better understand the guidelines and the API behind our External plugins, please have a look at the [Introduction to External plugins](/src/plugins.d/README.md) prior to reading this page.
11
12
13
`charts.d.plugin` has been designed so that the actual script that will do data collection will be permanently in
src/collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md
+2
-2
@@ -231,7 +231,7 @@ See [this issue](https://github.com/netdata/netdata/pull/1902#issuecomment-28449
231
232
Please see these two links to the official Netdata documentation for more information about the values:
233
234
-- [External plugins - charts](/src/collectors/plugins.d/README.md#chart)
234
+- [External plugins - charts](/src/plugins.d/README.md#chart)
235
- [Chart variables](/src/collectors/python.d.plugin/README.md#global-variables-order-and-chart)
236
237
**Line definitions**
@@ -255,7 +255,7 @@ hidden: False
255
```
256
257
Please see the following link for more information about the options and their default values:
258
-[External plugins - dimensions](/src/collectors/plugins.d/README.md#dimension)
258
+[External plugins - dimensions](/src/plugins.d/README.md#dimension)
259
260
Apart from top-level expvars, this plugin can also parse expvars stored in a multi-level map;
261
All dicts in the resulting JSON document are then flattened to one level.
src/collectors/python.d.plugin/go_expvar/metadata.yaml
+2
-2
@@ -200,7 +200,7 @@ modules:
200
201
Please see these two links to the official Netdata documentation for more information about the values:
202
203
- - [External plugins - charts](/src/collectors/plugins.d/README.md#chart)
203
+ - [External plugins - charts](/src/plugins.d/README.md#chart)
204
- [Chart variables](/src/collectors/python.d.plugin/README.md#global-variables-order-and-chart)
205
206
**Line definitions**
@@ -224,7 +224,7 @@ modules:
224
```
225
226
Please see the following link for more information about the options and their default values:
227
- [External plugins - dimensions](/src/collectors/plugins.d/README.md#dimension)
227
+ [External plugins - dimensions](/src/plugins.d/README.md#dimension)
228
229
Apart from top-level expvars, this plugin can also parse expvars stored in a multi-level map;
230
All dicts in the resulting JSON document are then flattened to one level.
src/collectors/utils/local_listeners.c
renamed
src/collectors/utils/ndsudo.c
renamed
src/go/pkg/netdataapi/api.go
+1
-1
@@ -11,7 +11,7 @@ import (
11
12
type (
13
// API implements Netdata external plugins API.
14
- // https://learn.netdata.cloud/docs/agent/collectors/plugins.d#the-output-of-the-plugin
14
+ // https://learn.netdata.cloud/docs/agent/plugins.d#the-output-of-the-plugin
15
API struct {
16
io.Writer
17
}
src/go/plugin/go.d/agent/discovery/sd/discoverer/netlisteners/netlisteners.go
+1
-1
@@ -294,7 +294,7 @@ func (e *localListenersExec) discover(ctx context.Context) ([]byte, error) {
294
defer cancel()
295
296
// TCPv4/6 and UPDv4 sockets in LISTEN state
297
- // https://github.com/netdata/netdata/blob/master/src/collectors/plugins.d/local_listeners.c
297
+ // https://github.com/netdata/netdata/blob/master/src/collectors/utils/local_listeners.c
298
args := []string{
299
"no-udp6",
300
"no-local",
src/go/plugin/go.d/agent/module/charts.go
+3
-3
@@ -78,7 +78,7 @@ type (
78
}
79
80
// Chart represents a chart.
81
- // For the full description please visit https://docs.netdata.cloud/collectors/plugins.d/#chart
81
+ // For the full description please visit https://docs.netdata.cloud/plugins.d/#chart
82
Chart struct {
83
// typeID is the unique identification of the chart, if not specified,
84
// the orchestrator will use job full name + chart ID as typeID (default behaviour).
@@ -128,7 +128,7 @@ type (
128
}
129
130
// Dim represents a chart dimension.
131
- // For detailed description please visit https://docs.netdata.cloud/collectors/plugins.d/#dimension.
131
+ // For detailed description please visit https://docs.netdata.cloud/plugins.d/#dimension.
132
Dim struct {
133
ID string
134
Name string
@@ -141,7 +141,7 @@ type (
141
}
142
143
// Var represents a chart variable.
144
- // For detailed description please visit https://docs.netdata.cloud/collectors/plugins.d/#variable
144
+ // For detailed description please visit https://docs.netdata.cloud/plugins.d/#variable
145
Var struct {
146
ID string
147
Name string
src/go/plugin/go.d/docs/how-to-write-a-module.md
+3
-3
@@ -48,7 +48,7 @@ The steps are:
48
developed collector. It will be placed into the `bin` directory (e.g `go.d.plugin/bin`)
49
- Run it in the debug mode `bin/godplugin -d -m <MODULE_NAME>`. This will output the `STDOUT` of the collector, the same
50
output that is sent to the Netdata Agent and is transformed into charts. You can read more about this collector API in
51
- our [documentation](/src/collectors/plugins.d/README.md#external-plugins-api).
51
+ our [documentation](/src/plugins.d/README.md#external-plugins-api).
52
- If you want to test the collector with the actual Netdata Agent, you need to replace the `go.d.plugin` binary that
53
exists in the Netdata Agent installation directory with the one you just compiled. Once
54
you restart the Netdata Agent, it will detect and run it, creating all the charts. It is advised not to remove the default `go.d.plugin` binary, but simply rename it to `go.d.plugin.old` so that the Agent doesn't run it, but you can easily rename it back once you are done.
@@ -119,7 +119,7 @@ func (e *Example) Check() bool {
119
### Charts method
120
121
:exclamation: Netdata module
122
-produces [`charts`](/src/collectors/plugins.d/README.md#chart), not
122
+produces [`charts`](/src/plugins.d/README.md#chart), not
123
raw metrics.
124
125
Use [`agent/module`](https://github.com/netdata/netdata/blob/master/src/go/plugin/go.d/agent/module/charts.go)
@@ -127,7 +127,7 @@ package to create them,
127
it contains charts and dimensions structs.
128
129
- `Charts` returns
130
- the [charts](/src/collectors/plugins.d/README.md#chart) (`*module.Charts`).
130
+ the [charts](/src/plugins.d/README.md#chart) (`*module.Charts`).
131
- Called after `Check` and only if `Check` returned `true`.
132
- If it returns `nil`, the job will be disabled
133
- :warning: Make sure not to share returned value between module instances (jobs).
src/plugins.d/README.md
renamed
+1
-1
@@ -1,6 +1,6 @@
1
<!--
2
title: "External plugins"
3
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/plugins.d/README.md"
3
+custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/plugins.d/README.md"
4
sidebar_label: "External plugins"
5
learn_status: "Published"
6
learn_topic_type: "References"
src/plugins.d/functions-table.md
renamed
src/plugins.d/gperf-config.txt
renamed
src/plugins.d/gperf-hashtable.h
renamed
src/plugins.d/plugins_d.c
renamed
src/plugins.d/plugins_d.h
renamed
src/plugins.d/pluginsd_dyncfg.c
renamed
src/plugins.d/pluginsd_dyncfg.h
renamed
src/plugins.d/pluginsd_functions.c
renamed
src/plugins.d/pluginsd_functions.h
renamed
src/plugins.d/pluginsd_internals.c
renamed
src/plugins.d/pluginsd_internals.h
renamed
src/plugins.d/pluginsd_parser.c
renamed
src/plugins.d/pluginsd_parser.h
renamed
src/plugins.d/pluginsd_replication.c
renamed
src/plugins.d/pluginsd_replication.h
renamed
src/streaming/protocol/command-claimed_id.c
+1
-1
@@ -1,7 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "commands.h"
4
-#include "collectors/plugins.d/pluginsd_internals.h"
4
+#include "plugins.d/pluginsd_internals.h"
5
6
PARSER_RC rrdpush_receiver_pluginsd_claimed_id(char **words, size_t num_words, PARSER *parser) {
7
const char *machine_guid_str = get_word(words, num_words, 1);
src/streaming/protocol/command-nodeid.c
+1
-1
@@ -1,7 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "commands.h"
4
-#include "collectors/plugins.d/pluginsd_internals.h"
4
+#include "plugins.d/pluginsd_internals.h"
5
6
// the child disconnected from the parent, and it has to clear the parent's claim id
7
void rrdpush_sender_clear_parent_claim_id(RRDHOST *host) {
src/streaming/receiver.c
+1
-1
@@ -34,7 +34,7 @@ void receiver_state_free(struct receiver_state *rpt) {
34
freez(rpt);
35
}
36
37
-#include "collectors/plugins.d/pluginsd_parser.h"
37
+#include "plugins.d/pluginsd_parser.h"
38
39
// IMPORTANT: to add workers, you have to edit WORKER_PARSER_FIRST_JOB accordingly
40
#define WORKER_RECEIVER_JOB_BYTES_READ (WORKER_PARSER_FIRST_JOB - 1)
src/streaming/stream_path.c
+1
-1
@@ -2,7 +2,7 @@
2
3
#include "stream_path.h"
4
#include "rrdpush.h"
5
-#include "collectors/plugins.d/pluginsd_internals.h"
5
+#include "plugins.d/pluginsd_internals.h"
6
7
ENUM_STR_MAP_DEFINE(STREAM_PATH_FLAGS) = {
8
{ .id = STREAM_PATH_FLAG_ACLK, .name = "aclk" },