diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-17 09:30:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-17 09:30:20 +0000 |
commit | 386ccdd61e8256c8b21ee27ee2fc12438fc5ca98 (patch) | |
tree | c9fbcacdb01f029f46133a5ba7ecd610c2bcb041 /collectors/nfacct.plugin | |
parent | Adding upstream version 1.42.4. (diff) | |
download | netdata-386ccdd61e8256c8b21ee27ee2fc12438fc5ca98.tar.xz netdata-386ccdd61e8256c8b21ee27ee2fc12438fc5ca98.zip |
Adding upstream version 1.43.0.upstream/1.43.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/nfacct.plugin')
l---------[-rw-r--r--] | collectors/nfacct.plugin/README.md | 64 | ||||
-rw-r--r-- | collectors/nfacct.plugin/integrations/netfilter.md | 131 | ||||
-rw-r--r-- | collectors/nfacct.plugin/plugin_nfacct.c | 16 |
3 files changed, 143 insertions, 68 deletions
diff --git a/collectors/nfacct.plugin/README.md b/collectors/nfacct.plugin/README.md index ae6597a40..ea320d139 100644..120000 --- a/collectors/nfacct.plugin/README.md +++ b/collectors/nfacct.plugin/README.md @@ -1,63 +1 @@ -<!-- -title: "Monitor Netfilter statistics (nfacct.plugin)" -custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/nfacct.plugin/README.md" -sidebar_label: "Netfilter statistics (nfacct.plugin)" -learn_status: "Published" -learn_topic_type: "References" -learn_rel_path: "Integrations/Monitor/Networking" ---> - -# Monitor Netfilter statistics (nfacct.plugin) - -`nfacct.plugin` collects Netfilter statistics. - -## Prerequisites - -If you are using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), install the -`netdata-plugin-nfacct` package using your system package manager. - -If you built Netdata locally: - -1. install `libmnl-dev` and `libnetfilter-acct-dev` using the package manager of your system. - -2. re-install Netdata from source. The installer will detect that the required libraries are now available and will also build `netdata.plugin`. - -Keep in mind that NFACCT requires root access, so the plugin is setuid to root. - -## Charts - -The plugin provides Netfilter connection tracker statistics and nfacct packet and bandwidth accounting: - -Connection tracker: - -1. Connections. -2. Changes. -3. Expectations. -4. Errors. -5. Searches. - -Netfilter accounting: - -1. Packets. -2. Bandwidth. - -## Configuration - -If you need to disable NFACCT for Netdata, edit /etc/netdata/netdata.conf and set: - -``` -[plugins] - nfacct = no -``` - -## Debugging - -You can run the plugin by hand: - -``` -sudo /usr/libexec/netdata/plugins.d/nfacct.plugin 1 debug -``` - -You will get verbose output on what the plugin does. - - +integrations/netfilter.md
\ No newline at end of file diff --git a/collectors/nfacct.plugin/integrations/netfilter.md b/collectors/nfacct.plugin/integrations/netfilter.md new file mode 100644 index 000000000..616e29e97 --- /dev/null +++ b/collectors/nfacct.plugin/integrations/netfilter.md @@ -0,0 +1,131 @@ +<!--startmeta +custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/nfacct.plugin/README.md" +meta_yaml: "https://github.com/netdata/netdata/edit/master/collectors/nfacct.plugin/metadata.yaml" +sidebar_label: "Netfilter" +learn_status: "Published" +learn_rel_path: "Data Collection/Linux Systems/Firewall" +message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" +endmeta--> + +# Netfilter + + +<img src="https://netdata.cloud/img/netfilter.png" width="150"/> + + +Plugin: nfacct.plugin +Module: nfacct.plugin + +<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> + +## Overview + +Monitor Netfilter metrics for optimal packet filtering and manipulation. Keep tabs on packet counts, dropped packets, and error rates to secure network operations. + +Netdata uses libmnl (https://www.netfilter.org/projects/libmnl/index.html) to collect information. + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + +This plugin needs setuid. + +### Default Behavior + +#### Auto-Detection + +This plugin uses socket to connect with netfilter to collect data + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per Netfilter instance + + + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | +|:------|:----------|:----| +| netfilter.netlink_new | new, ignore, invalid | connections/s | +| netfilter.netlink_changes | insert, delete, delete_list | changes/s | +| netfilter.netlink_search | searched, search_restart, found | searches/s | +| netfilter.netlink_errors | icmp_error, insert_failed, drop, early_drop | events/s | +| netfilter.netlink_expect | created, deleted, new | expectations/s | +| netfilter.nfacct_packets | a dimension per nfacct object | packets/s | +| netfilter.nfacct_bytes | a dimension per nfacct object | kilobytes/s | + + + +## Alerts + +There are no alerts configured by default for this integration. + + +## Setup + +### Prerequisites + +#### Install required packages + +Install `libmnl-dev` and `libnetfilter-acct-dev` using the package manager of your system. + + + +### Configuration + +#### File + +The configuration file name for this integration is `netdata.conf`. +Configuration for this specific integration is located in the `[plugin:nfacct]` section within that file. + +The file format is a modified INI syntax. The general structure is: + +```ini +[section1] + option1 = some value + option2 = some other value + +[section2] + option3 = some third value +``` +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config netdata.conf +``` +#### Options + + + +<details><summary>Config options</summary> + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| update every | Data collection frequency. | 1 | False | +| command options | Additinal parameters for collector | | False | + +</details> + +#### Examples +There are no configuration examples. + + diff --git a/collectors/nfacct.plugin/plugin_nfacct.c b/collectors/nfacct.plugin/plugin_nfacct.c index 430ceab52..a788d1a03 100644 --- a/collectors/nfacct.plugin/plugin_nfacct.c +++ b/collectors/nfacct.plugin/plugin_nfacct.c @@ -18,6 +18,8 @@ #define NETDATA_CHART_PRIO_NETFILTER_PACKETS 8906 #define NETDATA_CHART_PRIO_NETFILTER_BYTES 8907 +#define NFACCT_RESTART_EVERY_SECONDS 86400 // restart the plugin every this many seconds + static inline size_t mnl_buffer_size() { long s = MNL_SOCKET_BUFFER_SIZE; if(s <= 0) return 8192; @@ -760,6 +762,8 @@ int main(int argc, char **argv) { error_log_errors_per_period = 100; error_log_throttle_period = 3600; + log_set_global_severity_for_external_plugins(); + // ------------------------------------------------------------------------ // parse command line parameters @@ -852,7 +856,7 @@ int main(int argc, char **argv) { if(unlikely(netdata_exit)) break; if(debug && iteration) - fprintf(stderr, "nfacct.plugin: iteration %zu, dt %llu usec\n" + fprintf(stderr, "nfacct.plugin: iteration %zu, dt %"PRIu64" usec\n" , iteration , dt ); @@ -879,9 +883,11 @@ int main(int argc, char **argv) { fflush(stdout); - // restart check (14400 seconds) - if(now_monotonic_sec() - started_t > 14400) break; + if (now_monotonic_sec() - started_t > NFACCT_RESTART_EVERY_SECONDS) { + collector_info("NFACCT reached my lifetime expectancy. Exiting to restart."); + fprintf(stdout, "EXIT\n"); + fflush(stdout); + exit(0); + } } - - collector_info("NFACCT process exiting"); } |