diff options
44 files changed, 24 insertions, 7207 deletions
diff --git a/.codacy.yml b/.codacy.yml index 3d88a253ca..f1a4259a00 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -4,7 +4,6 @@ exclude_paths: - collectors/python.d.plugin/python_modules/pyyaml3/** - collectors/python.d.plugin/python_modules/urllib3/** - collectors/python.d.plugin/python_modules/third_party/** - - collectors/node.d.plugin/node_modules/** - contrib/** - packaging/makeself/** - web/gui/css/** diff --git a/.codeclimate.yml b/.codeclimate.yml index 59fb3e7958..2d33eafd25 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -91,8 +91,3 @@ exclude_patterns: - "collectors/python.d.plugin/python_modules/pyyaml2/" - "collectors/python.d.plugin/python_modules/pyyaml3/" - "collectors/python.d.plugin/python_modules/urllib3/" - - "collectors/node.d.plugin/node_modules/lib/" - - "collectors/node.d.plugin/node_modules/asn1-ber.js" - - "collectors/node.d.plugin/node_modules/extend.js" - - "collectors/node.d.plugin/node_modules/pixl-xml.js" - - "collectors/node.d.plugin/node_modules/net-snmp.js" diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e402a67a1f..6f7d91792b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,8 +15,6 @@ collectors/ebpf.plugin/ @thiagoftsm @vlvkobal collectors/charts.d.plugin/ @ilyam8 @surajnpn @Ferroin collectors/freebsd.plugin/ @vlvkobal @thiagoftsm @surajnpn collectors/macos.plugin/ @vlvkobal @thiagoftsm @surajnpn -collectors/node.d.plugin/ @jacekkolasa -collectors/node.d.plugin/snmp/ @jacekkolasa collectors/python.d.plugin/ @ilyam8 collectors/cups.plugin/ @simonnagl @vlvkobal @thiagoftsm exporting/ @vlvkobal @thiagoftsm diff --git a/.github/labeler.yml b/.github/labeler.yml index e1faef669a..c72325076c 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -116,10 +116,6 @@ collectors/nfacct: - collectors/nfacct.plugin/* - collectors/nfacct.plugin/**/* -collectors/node.d: - - collectors/node.d.plugin/* - - collectors/node.d.plugin/**/* - collectors/perf: - collectors/perf.plugin/* - collectors/perf.plugin/**/* diff --git a/.gitignore b/.gitignore index 9de4cfe147..2d7051485e 100644 --- a/.gitignore +++ b/.gitignore @@ -136,7 +136,6 @@ health/notifications/alarm-notify.sh claim/netdata-claim.sh collectors/tc.plugin/tc-qos-helper.sh collectors/charts.d.plugin/charts.d.plugin -collectors/node.d.plugin/node.d.plugin collectors/python.d.plugin/python.d.plugin collectors/fping.plugin/fping.plugin collectors/ioping.plugin/ioping.plugin @@ -12,11 +12,6 @@ path_classifiers: - collectors/python.d.plugin/python_modules/urllib3/ - collectors/python.d.plugin/python_modules/pyyaml2/ - collectors/python.d.plugin/python_modules/pyyaml3/ - - collectors/node.d.plugin/node_modules/lib/ - - collectors/node.d.plugin/node_modules/asn1-ber.js - - collectors/node.d.plugin/node_modules/extend.js - - collectors/node.d.plugin/node_modules/net-snmp.js - - collectors/node.d.plugin/node_modules/pixl-xml.js - ml/kmeans/dlib/ - ml/json/ - web/gui/lib/ diff --git a/build_external/scenarios/aclk-testing/agent_netdata.conf b/build_external/scenarios/aclk-testing/agent_netdata.conf index 7a2803c21d..f1ce2b249e 100644 --- a/build_external/scenarios/aclk-testing/agent_netdata.conf +++ b/build_external/scenarios/aclk-testing/agent_netdata.conf @@ -96,7 +96,6 @@ # check for new plugins every = 60
# slabinfo = no
# go.d = yes
- # node.d = yes
# apps = yes
# charts.d = yes
# fping = yes
@@ -265,10 +264,6 @@ # update every = 1
# command options =
-[plugin:node.d]
- # update every = 1
- # command options =
-
[plugin:apps]
# update every = 1
# command options =
diff --git a/build_external/scenarios/gaps_lo/mostly_off.conf b/build_external/scenarios/gaps_lo/mostly_off.conf index 2ac395a9be..079fef063c 100644 --- a/build_external/scenarios/gaps_lo/mostly_off.conf +++ b/build_external/scenarios/gaps_lo/mostly_off.conf @@ -28,7 +28,6 @@ errors flood protection period = 0 fping = no python.d = no charts.d = no - node.d = no nfacct = no cups = no freeipmi = no diff --git a/collectors/COLLECTORS.md b/collectors/COLLECTORS.md index d59a65acf1..c644615288 100644 --- a/collectors/COLLECTORS.md +++ b/collectors/COLLECTORS.md @@ -250,13 +250,15 @@ configure any of these collectors according to your setup and infrastructure. - [AM2320](/collectors/python.d.plugin/am2320/README.md): Monitor sensor temperature and humidity. - [Access point](/collectors/charts.d.plugin/ap/README.md): Monitor client, traffic and signal metrics using the `aw` - tool. + tool. - [APC UPS](/collectors/charts.d.plugin/apcupsd/README.md): Capture status information using the `apcaccess` tool. -- [Energi Core](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/energid): Monitor - blockchain indexes, memory usage, network usage, and transactions of wallet instances. +- [Energi Core (Go)](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/energid): Monitor + blockchain indexes, memory usage, network usage, and transactions of wallet instances. +- [Energi Core (Python)](/collectors/python.d.plugin/energid/README.md): Monitor blockchain, memory, network, and + unspent transactions statistics. - [UPS/PDU](/collectors/charts.d.plugin/nut/README.md): Read the status of UPS/PDU devices using the `upsc` tool. -- [SNMP devices](/collectors/node.d.plugin/snmp/README.md): Gather data using the SNMP protocol. -- [1-Wire sensors](/collectors/python.d.plugin/w1sensor/README.md): Monitor sensor temperature. +- [SNMP devices](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/snmp): Gather data using the SNMP protocol. +- [1-Wire sensors](/collectors/python.d.plugin/w1sensor/README.md): Monitor sensor temperature. ### Search @@ -481,10 +483,9 @@ Plugin orchestrators organize and run many of the above collectors. If you're interested in developing a new collector that you'd like to contribute to Netdata, we highly recommend using the `go.d.plugin`. -- [go.d.plugin](https://github.com/netdata/go.d.plugin): An orchestrator for data collection modules written in `go`. -- [python.d.plugin](python.d.plugin/README.md): An orchestrator for data collection modules written in `python` v2/v3. -- [charts.d.plugin](charts.d.plugin/README.md): An orchestrator for data collection modules written in `bash` v4+. -- [node.d.plugin](node.d.plugin/README.md): An orchestrator for data collection modules written in `node.js`. +- [go.d.plugin](https://github.com/netdata/go.d.plugin): An orchestrator for data collection modules written in `go`. +- [python.d.plugin](python.d.plugin/README.md): An orchestrator for data collection modules written in `python` v2/v3. +- [charts.d.plugin](charts.d.plugin/README.md): An orchestrator for data collection modules written in `bash` v4+. ## Third-party collectors diff --git a/collectors/Makefile.am b/collectors/Makefile.am index 021e2ff23c..a0a972e8f3 100644 --- a/collectors/Makefile.am +++ b/collectors/Makefile.am @@ -20,7 +20,6 @@ SUBDIRS = \ nfacct.plugin \ xenstat.plugin \ perf.plugin \ - node.d.plugin \ proc.plugin \ python.d.plugin \ slabinfo.plugin \ diff --git a/collectors/REFERENCE.md b/collectors/REFERENCE.md index bd267c5c6f..5f2127b585 100644 --- a/collectors/REFERENCE.md +++ b/collectors/REFERENCE.md @@ -67,9 +67,6 @@ field contains `go.d`, that collector uses the Go orchestrator. # Python orchestrator (python.d.plugin) ./python.d.plugin <MODULE_NAME> debug trace -# Node orchestrator (node.d.plugin) -./node.d.plugin debug 1 <MODULE_NAME> - # Bash orchestrator (bash.d.plugin) ./charts.d.plugin debug 1 <MODULE_NAME> ``` @@ -100,7 +97,6 @@ This section features a list of Netdata's plugins, with a boolean setting to ena # slabinfo = no # fping = yes # ioping = yes - # node.d = yes # python.d = yes # go.d = yes # apps = yes diff --git a/collectors/apps.plugin/apps_groups.conf b/collectors/apps.plugin/apps_groups.conf index 8dc5e2ac51..ebbd7c8f7b 100644 --- a/collectors/apps.plugin/apps_groups.conf +++ b/collectors/apps.plugin/apps_groups.conf @@ -82,7 +82,6 @@ cups.plugin: cups.plugin xenstat.plugin: xenstat.plugin perf.plugin: perf.plugin charts.d.plugin: *charts.d.plugin* -node.d.plugin: *node.d.plugin* python.d.plugin: *python.d.plugin* tc-qos-helper: *tc-qos-helper.sh* fping: fping diff --git a/collectors/node.d.plugin/Makefile.am b/collectors/node.d.plugin/Makefile.am deleted file mode 100644 index 1b8281748f..0000000000 --- a/collectors/node.d.plugin/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in -CLEANFILES = \ - node.d.plugin \ - $(NULL) - -include $(top_srcdir)/build/subst.inc -SUFFIXES = .in - -dist_libconfig_DATA = \ - node.d.conf \ - $(NULL) - -dist_plugins_SCRIPTS = \ - node.d.plugin \ - $(NULL) - -dist_noinst_DATA = \ - node.d.plugin.in \ - README.md \ - $(NULL) - -usernodeconfigdir=$(configdir)/node.d -dist_usernodeconfig_DATA = \ - $(NULL) - -# Explicitly install directories to avoid permission issues due to umask -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(usernodeconfigdir) - -nodeconfigdir=$(libconfigdir)/node.d -dist_nodeconfig_DATA = \ - $(NULL) - -dist_node_DATA = \ - $(NULL) - -include snmp/Makefile.inc - -nodemodulesdir=$(nodedir)/node_modules -dist_nodemodules_DATA = \ - node_modules/netdata.js \ - node_modules/extend.js \ - node_modules/pixl-xml.js \ - node_modules/net-snmp.js \ - node_modules/asn1-ber.js \ - $(NULL) - -nodemoduleslibberdir=$(nodedir)/node_modules/lib/ber -dist_nodemoduleslibber_DATA = \ - node_modules/lib/ber/index.js \ - node_modules/lib/ber/errors.js \ - node_modules/lib/ber/reader.js \ - node_modules/lib/ber/types.js \ - node_modules/lib/ber/writer.js \ - $(NULL) diff --git a/collectors/node.d.plugin/README.md b/collectors/node.d.plugin/README.md deleted file mode 100644 index 4c5f278bd6..0000000000 --- a/collectors/node.d.plugin/README.md +++ /dev/null @@ -1,236 +0,0 @@ -<!-- -title: "node.d.plugin" -custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/node.d.plugin/README.md ---> - -# node.d.plugin - -`node.d.plugin` is a Netdata external plugin. It is an **orchestrator** for data collection modules written in `node.js`. - -1. It runs as an independent process `ps fax` shows it -2. It is started and stopped automatically by Netdata -3. It communicates with Netdata via a unidirectional pipe (sending data to the `netdata` daemon) -4. Supports any number of data collection **modules** -5. Allows each **module** to have one or more data collection **jobs** -6. Each **job** is collecting one or more metrics from a single data source - -## Pull Request Checklist for Node.js Plugins - -This is a generic checklist for submitting a new Node.js plugin for Netdata. It is by no means comprehensive. - -At minimum, to be buildable and testable, the PR needs to include: - -- The module itself, following proper naming conventions: `node.d/<module_dir>/<module_name>.node.js` -- A README.md file for the plugin. -- The configuration file for the module -- A basic configuration for the plugin in the appropriate global config file: `conf.d/node.d.conf`, which is also in JSON format. If the module should be enabled by default, add a section for it in the `modules` dictionary. -- A line for the plugin in the appropriate `Makefile.am` file: `node.d/Makefile.am` under `dist_node_DATA`. -- A line for the plugin configuration file in `conf.d/Makefile.am`: under `dist_nodeconfig_DATA` -- Optionally, chart information in `web/dashboard_info.js`. This generally involves specifying a name and icon for the section, and may include descriptions for the section or individual charts. - -## Motivation - -Node.js is perfect for asynchronous operations. It is very fast and quite common (actually the whole web is based on it). -Since data collection is not a CPU intensive task, node.js is an ideal solution for it. - -`node.d.plugin` is a Netdata plugin that provides an abstraction layer to allow easy and quick development of data -collectors in node.js. It also manages all its data collectors (placed in `/usr/libexec/netdata/node.d`) using a single -instance of node, thus lowering the memory footprint of data collection. - -Of course, there can be independent plugins written in node.js (placed in `/usr/libexec/netdata/plugins`). -These will have to be developed using the guidelines of **[External Plugins](/collectors/plugins.d/README.md)**. - -To run `node.js` plugins you need to have `node` installed in your system. - -In some older systems, the package named `node` is not node.js. It is a terminal emulation program called `ax25-node`. -In this case the node.js package may be referred as `nodejs`. Once you install `nodejs`, we suggest to link -`/usr/bin/nodejs` to `/usr/bin/node`, so that typing `node` in your terminal, opens node.js. - -## configuring `node.d.plugin` - -`node.d.plugin` can work even without any configuration. Its default configuration file is -`node.d.conf`. To edit it on your system, run `/etc/netdata/edit-config node.d.conf`. - -## configuring `node.d.plugin` modules - -`node.d.plugin` modules accept configuration in `JSON` format. - -Unfortunately, `JSON` files do not accept comments. So, the best way to describe them is to have markdown text files -with instructions. - -`JSON` has a very strict formatting. If you get errors from Netdata at `/var/log/netdata/error.log` that a certain -configuration file cannot be loaded, we suggest to verify it at <http://jsonlint.com/>. - -The files in this directory, provide usable examples for configuring each `node.d.plugin` module. - -## debugging modules written for node.d.plugin - -To test `node.d.plugin` modules, which are placed in `/usr/libexec/netdata/node.d`, you can run `node.d.plugin` by hand, -like this: - -```sh -# become user netdata -sudo su -s /bin/sh netdata - -# run the plugin in debug mode -/usr/libexec/netdata/plugins.d/node.d.plugin debug 1 X Y Z -``` - -`node.d.plugin` will run in `debug` mode (lots of debug info), with an update frequency of `1` second, evaluating only -the collector scripts `X` (i.e. `/usr/libexec/netdata/node.d/X.node.js`), `Y` and `Z`. -You can define zero or more modules. If none is defined, `node.d.plugin` will evaluate all modules available. - -Keep in mind that if your configs are not in `/etc/netdata`, you should do the following before running `node.d.plugin`: - -```sh -export NETDATA_USER_CONFIG_DIR="/path/to/etc/netdata" -``` - ---- - -## developing `node.d.plugin` modules - -Your data collection module should be split in 3 parts: - -- a function to fetch the data from its source. `node.d.plugin` already can fetch data from web sources, - so you don't need to do anything about it for http. - -- a function to process the fetched/manipulate the data fetched. This function will make a number of calls - to create charts and dimensions and pass the collected values to Netdata. - This is the only function you need to write for collecting http JSON data. - -- a `configure` and an `update` function, which take care of your module configuration and data refresh - respectively. You can use the supplied ones. - -Your module will automatically be able to process any number of servers, with different settings (even different -data collection frequencies). You will write just the work needed for one and `node.d.plugin` will do the rest. -For each server you are going to fetch data from, you will have to create a `service` (more later). - -### writing the data collection module - -To provide a module called `mymodule`, you have create the file `/usr/libexec/netdata/node.d/mymodule.node.js`, with this structure: - -```js -// the processor is needed only -// if you need a custom processor -// other than http -netdata.processors.myprocessor = { - name: 'myprocessor', - - process: function(service, callback) { - - /* do data collection here */ - - callback(data); - } -}; - -// this is the mymodule definition -var mymodule = { - processResponse: function(service, data) { - - /* send information to the Netdata server here */ - - }, - - configure: function(config) { - var eligible_services = 0; - - if(typeof(config.servers) === 'undefined' || config.servers.length === 0) { - - /* - * create a service using internal defaults; - * this is used for auto-detecting the settings - * if possible - */ - - netdata.service({ - name: 'a name for this service', - update_every: this.update_every, - module: this, - processor: netdata.processors.myprocessor, - // any other information your processor needs - }).execute(this.processResponse); - - eligible_services++; - } - else { - - /* - * create a service for each server in the - * configuration file - */ - - var len = config.servers.length; - while(len--) { - var server = config.servers[len]; - - netdata.service({ - name: server.name, - update_every: server.update_every, - module: this, - processor: netdata.processors.myprocessor, - // any other information your processor needs - }).execute(this.processResponse); - - eligible_services++; - } - } - - return eligible_services; - }, - - update: function(service, callback) { - - /* - * this function is called when each service - * created by the configure function, needs to - * collect updated values. - * - * You normally will not need to change it. - */ - - service.execute(function(service, data) { - mymodule.processResponse(service, data); - callback(); - }); - }, -}; - -module.exports = mymodule; -``` - -#### configure(config) - -`configure(config)` is called just once, when `node.d.plugin` starts. -The config file will contain the contents of `/etc/netdata/node.d/mymodule.conf`. -This file should have the following format: - -```js -{ - "enable_autodetect": false, - "update_every": 5, - "servers": [ { /* server 1 */ }, { /* server 2 */ } ] -} -``` - -If the config file `/etc/netdata/node.d/mymodule.conf` does not give a `enable_autodetect` or `update_every`, these -will be added by `node.d.plugin`. So you module will always have them. - -The configuration file `/etc/netdata/node.d/mymodule.conf` may contain whatever else is needed for `mymodule`. - -#### processResponse(data) - -`data` may be `null` or whatever the processor specified in the `service` returned. - -The `service` object defines a set of functions to allow you send information to the Netdata core about: - -1. Charts and dimension definitions -2. Updated values, from the collected values - ---- - -_FIXME: document an operational node.d.plugin data collector - the best example is the -[snmp collector](https://raw.githubusercontent.com/netdata/netdata/master/collectors/node.d.plugin/snmp/snmp.node.js)_ - - diff --git a/collectors/node.d.plugin/node.d.conf b/collectors/node.d.plugin/node.d.conf deleted file mode 100644 index c79274a5e4..0000000000 --- a/collectors/node.d.plugin/node.d.conf +++ /dev/null @@ -1,33 +0,0 @@ -{
- "___help_1": "Default options for node.d.plugin - this is a JSON file.",
- "___help_2": "Use http://jsonlint.com/ to verify it is valid JSON.",
- "___help_3": "------------------------------------------------------------",
-
- "___help_update_every": "Minimum data collection frequency for all node.d/*.node.js modules. Set it to 0 to inherit it from netdata.",
- "update_every": 0,
-
- "___help_modules_enable_autodetect": "Enable/disable auto-detection for node.d/*.node.js modules that support it.",
- "modules_enable_autodetect": true,
-
- "___help_modules_enable_all": "Enable all node.d/*.node.js modules by default.",
- "modules_enable_all": true,
-
- "___help_modules": "Enable/disable the following modules. Give only XXX for node.d/XXX.node.js",
- "modules": {
- "snmp": {
- "enabled": true
- }
- },
-
- "___help_paths": "Paths that control the operation of node.d.plugin",
- "paths": {
- "___help_plugins": "The full path to the modules javascript node.d/ directory",
- "plugins": null,
-
- "___help_config": "The full path to the modules configs node.d/ directory",
- "config": null,
-
- "___help_modules": "Array of paths to add to node.js when searching for node_modules",
- "modules": []
- }
-}
diff --git a/collectors/node.d.plugin/node.d.plugin.in b/collectors/node.d.plugin/node.d.plugin.in deleted file mode 100755 index 05c126e900..0000000000 --- a/collectors/node.d.plugin/node.d.plugin.in +++ /dev/null @@ -1,303 +0,0 @@ -#!/usr/bin/env bash -':' //; exec "$(command -v nodejs || command -v node || echo "ERROR node IS NOT AVAILABLE IN THIS SYSTEM")" "$0" "$@" - -// shebang hack from: -// http://unix.stackexchange.com/questions/65235/universal-node-js-shebang - -// Initially this is run as a shell script. -// Then, the second line, finds nodejs or node or js in the system path -// and executes it with the shell parameters. - -// netdata -// real-time performance and health monitoring, done right! -// (C) 2017 Costa Tsaousis <costa@tsaousis.gr> -// SPDX-License-Identifier: GPL-3.0-or-later - -// -------------------------------------------------------------------------------------------------------------------- - -'use strict'; - -// -------------------------------------------------------------------------------------------------------------------- -// get NETDATA environment variables - -var NETDATA_PLUGINS_DIR = process.env.NETDATA_PLUGINS_DIR || __dirname; -var NETDATA_USER_CONFIG_DIR = process.env.NETDATA_USER_CONFIG_DIR || '@configdir_POST@'; -var NETDATA_STOCK_CONFIG_DIR = process.env.NETDATA_STOCK_CONFIG_DIR || '@libconfigdir_POST@'; -var NETDATA_UPDATE_EVERY = process.env.NETDATA_UPDATE_EVERY || 1; -var NODE_D_DIR = NETDATA_PLUGINS_DIR + '/../node.d'; - -// make sure the modules are found -process.mainModule.paths.unshift(NODE_D_DIR + '/node_modules'); -process.mainModule.paths.unshift(NODE_D_DIR); - - -// -------------------------------------------------------------------------------------------------------------------- -// load required modules - -var fs = require('fs'); -var url = require('url'); -var util = require('util'); -var http = require('http'); -var path = require('path'); -var extend = require('extend'); -var netdata = require('netdata'); - - -// -------------------------------------------------------------------------------------------------------------------- -// configuration - -function netdata_read_json_config_file(module_filename) { - var f = path.basename(module_filename); - - var ufilename, sfilename; |