diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 17:33:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 17:34:10 +0000 |
commit | 83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch) | |
tree | 2e69833b43f791ed253a7a20318b767ebe56cdb8 /src/collectors/charts.d.plugin | |
parent | Releasing debian version 1.47.5-1. (diff) | |
download | netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip |
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/collectors/charts.d.plugin')
14 files changed, 10 insertions, 1545 deletions
diff --git a/src/collectors/charts.d.plugin/README.md b/src/collectors/charts.d.plugin/README.md index 3558985db..309f60e63 100644 --- a/src/collectors/charts.d.plugin/README.md +++ b/src/collectors/charts.d.plugin/README.md @@ -7,8 +7,7 @@ 3. It communicates with Netdata via a unidirectional pipe (sending data to the `netdata` daemon) 4. Supports any number of data collection **modules** -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. - +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. `charts.d.plugin` has been designed so that the actual script that will do data collection will be permanently in memory, collecting data with as little overheads as possible @@ -21,11 +20,11 @@ By default, `charts.d.plugin` is not included as part of the install when using ## Configuration -`charts.d.plugin` itself can be [configured](/docs/netdata-agent/configuration/README.md#edit-netdataconf)using the configuration file `/etc/netdata/charts.d.conf`. This file is also a BASH script. +`charts.d.plugin` itself can be [configured](/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config)using the configuration file `/etc/netdata/charts.d.conf`. This file is also a BASH script. In this file, you can place statements like this: -```conf +```text enable_all_charts="yes" X="yes" Y="no" @@ -121,7 +120,7 @@ Using the above, if the command `mysql` is not available in the system, the `mys `fixid()` will get a string and return a properly formatted id for a chart or dimension. This is an expensive function that should not be used in `X_update()`. -You can keep the generated id in a BASH associative array to have the values availables in `X_update()`, like this: +You can keep the generated id in a BASH associative array to have the values available in `X_update()`, like this: ```sh declare -A X_ids=() diff --git a/src/collectors/charts.d.plugin/apcupsd/README.md b/src/collectors/charts.d.plugin/apcupsd/README.md deleted file mode 120000 index fc6681fe6..000000000 --- a/src/collectors/charts.d.plugin/apcupsd/README.md +++ /dev/null @@ -1 +0,0 @@ -integrations/apc_ups.md
\ No newline at end of file diff --git a/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh b/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh deleted file mode 100644 index 58132024b..000000000 --- a/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh +++ /dev/null @@ -1,306 +0,0 @@ -# shellcheck shell=bash -# no need for shebang - this file is loaded from charts.d.plugin -# SPDX-License-Identifier: GPL-3.0-or-later - -# netdata -# real-time performance and health monitoring, done right! -# (C) 2016 Costa Tsaousis <costa@tsaousis.gr> -# - -apcupsd_ip= -apcupsd_port= - -declare -A apcupsd_sources=( - ["local"]="127.0.0.1:3551" -) - -# how frequently to collect UPS data -apcupsd_update_every=10 - -apcupsd_timeout=3 - -# the priority of apcupsd related to other charts -apcupsd_priority=90000 - -apcupsd_get() { - run -t $apcupsd_timeout apcaccess status "$1" -} - -is_ups_alive() { - local status - status="$(apcupsd_get "$1" | sed -e 's/STATUS.*: //' -e 't' -e 'd')" - case "$status" in - "" | "COMMLOST" | "SHUTTING DOWN") return 1 ;; - *) return 0 ;; - esac -} - -apcupsd_check() { - - # this should return: - # - 0 to enable the chart - # - 1 to disable the chart - - require_cmd apcaccess || return 1 - - # backwards compatibility - if [ "${apcupsd_ip}:${apcupsd_port}" != ":" ]; then - apcupsd_sources["local"]="${apcupsd_ip}:${apcupsd_port}" - fi - - local host working=0 failed=0 - for host in "${!apcupsd_sources[@]}"; do - apcupsd_get "${apcupsd_sources[${host}]}" >/dev/null - # shellcheck disable=2181 - if [ $? -ne 0 ]; then - error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}." - failed=$((failed + 1)) - else - if ! is_ups_alive ${apcupsd_sources[${host}]}; then - error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online." - failed=$((failed + 1)) - else - working=$((working + 1)) - fi - fi - done - - if [ ${working} -eq 0 ]; then - error "No APC UPSes found available." - return 1 - fi - - return 0 -} - -apcupsd_create() { - local host - for host in "${!apcupsd_sources[@]}"; do - # create the charts - cat <<EOF -CHART apcupsd_${host}.charge '' "UPS Charge" "percentage" ups apcupsd.charge area $((apcupsd_priority + 2)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION battery_charge charge absolute 1 100 - -CHART apcupsd_${host}.battery_voltage '' "UPS Battery Voltage" "Volts" ups apcupsd.battery.voltage line $((apcupsd_priority + 4)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION battery_voltage voltage absolute 1 100 -DIMENSION battery_voltage_nominal nominal absolute 1 100 - -CHART apcupsd_${host}.input_voltage '' "UPS Input Voltage" "Volts" input apcupsd.input.voltage line $((apcupsd_priority + 5)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION input_voltage voltage absolute 1 100 -DIMENSION input_voltage_min min absolute 1 100 -DIMENSION input_voltage_max max absolute 1 100 - -CHART apcupsd_${host}.input_frequency '' "UPS Input Frequency" "Hz" input apcupsd.input.frequency line $((apcupsd_priority + 6)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION input_frequency frequency absolute 1 100 - -CHART apcupsd_${host}.output_voltage '' "UPS Output Voltage" "Volts" output apcupsd.output.voltage line $((apcupsd_priority + 7)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION output_voltage voltage absolute 1 100 -DIMENSION output_voltage_nominal nominal absolute 1 100 - -CHART apcupsd_${host}.load '' "UPS Load" "percentage" ups apcupsd.load area $((apcupsd_priority)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION load load absolute 1 100 - -CHART apcupsd_${host}.load_usage '' "UPS Load Usage" "Watts" ups apcupsd.load_usage area $((apcupsd_priority + 1)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION load_usage load absolute 1 100 - -CHART apcupsd_${host}.temp '' "UPS Temperature" "Celsius" ups apcupsd.temperature line $((apcupsd_priority + 8)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION temp temp absolute 1 100 - -CHART apcupsd_${host}.time '' "UPS Time Remaining" "Minutes" ups apcupsd.time area $((apcupsd_priority + 3)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION time time absolute 1 100 - -CHART apcupsd_${host}.online '' "UPS ONLINE flag" "boolean" ups apcupsd.online line $((apcupsd_priority + 9)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION online online absolute 1 1 - -CHART apcupsd_${host}.selftest '' "UPS Self-Test status" "status" ups apcupsd.selftest line $((apcupsd_priority + 10)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION selftest_OK 'OK' absolute 1 1 -DIMENSION selftest_NO 'NO' absolute 1 1 -DIMENSION selftest_BT 'BT' absolute 1 1 -DIMENSION selftest_NG 'NG' absolute 1 1 - -CHART apcupsd_${host}.status '' "UPS Status" "status" ups apcupsd.status line $((apcupsd_priority + 11)) $apcupsd_update_every '' '' 'apcupsd' -DIMENSION status_ONLINE 'ONLINE' absolute 1 1 -DIMENSION status_ONBATT 'ONBATT' absolute 1 1 -DIMENSION status_OVERLOAD 'OVERLOAD' absolute 1 1 -DIMENSION status_LOWBATT 'LOWBATT' absolute 1 1 -DIMENSION status_REPLACEBATT 'REPLACEBATT' absolute 1 1 -DIMENSION status_NOBATT 'NOBATT' absolute 1 1 -DIMENSION status_SLAVE 'SLAVE' absolute 1 1 -DIMENSION status_SLAVEDOWN 'SLAVEDOWN' absolute 1 1 -DIMENSION status_COMMLOST 'COMMLOST' absolute 1 1 -DIMENSION status_CAL 'CAL' absolute 1 1 -DIMENSION status_TRIM 'TRIM' absolute 1 1 -DIMENSION status_BOOST 'BOOST' absolute 1 1 -DIMENSION status_SHUTTING_DOWN 'SHUTTING_DOWN' absolute 1 1 - -EOF - done - return 0 -} - -apcupsd_update() { - # the first argument to this function is the microseconds since last update - # pass this parameter to the BEGIN statement (see below). - - # do all the work to collect / calculate the values - # for each dimension - # remember: KEEP IT SIMPLE AND SHORT - - local host working=0 failed=0 - for host in "${!apcupsd_sources[@]}"; do - apcupsd_get "${apcupsd_sources[${host}]}" | awk " - -BEGIN { - battery_charge = 0; - battery_voltage = 0; - battery_voltage_nominal = 0; - input_voltage = 0; - input_voltage_min = 0; - input_voltage_max = 0; - input_frequency = 0; - output_voltage = 0; - output_voltage_nominal = 0; - load = 0; - temp = 0; - time = 0; - online = 0; - nompower = 0; - load_usage = 0; - selftest_OK = 0; - selftest_NO = 0; - selftest_BT = 0; - selftest_NG = 0; - status_ONLINE = 0; - status_CAL = 0; - status_TRIM = 0; - status_BOOST = 0; - status_ONBATT = 0; - status_OVERLOAD = 0; - status_LOWBATT = 0; - status_REPLACEBATT = 0; - status_NOBATT = 0; - status_SLAVE = 0; - status_SLAVEDOWN = 0; - status_COMMLOST = 0; - status_SHUTTING_DOWN = 0; - -} -/^BCHARGE.*/ { battery_charge = \$3 * 100 }; -/^BATTV.*/ { battery_voltage = \$3 * 100 }; -/^NOMBATTV.*/ { battery_voltage_nominal = \$3 * 100 }; -/^LINEV.*/ { input_voltage = \$3 * 100 }; -/^MINLINEV.*/ { input_voltage_min = \$3 * 100 }; -/^MAXLINEV.*/ { input_voltage_max = \$3 * 100 }; -/^LINEFREQ.*/ { input_frequency = \$3 * 100 }; -/^OUTPUTV.*/ { output_voltage = \$3 * 100 }; -/^NOMOUTV.*/ { output_voltage_nominal = \$3 * 100 }; -/^LOADPCT.*/ { load = \$3 * 100 }; -/^ITEMP.*/ { temp = \$3 * 100 }; -/^NOMPOWER.*/ { nompower = \$3 }; -/^TIMELEFT.*/ { time = \$3 * 100 }; -/^STATUS.*/ { online=(\$0 !~ \"COMMLOST\" && \$0 !~ \"SHUTTING\") ? 1 : 0; }; -/^SELFTEST.*/ { selftest_OK = (\$3 == \"OK\") ? 1 : 0; - selftest_NO = (\$3 == \"NO\") ? 1 : 0; - selftest_BT = (\$3 == \"BT\") ? 1 : 0; - selftest_NG = (\$3 == \"NG\") ? 1 : 0; - }; -/^STATUS.*/ { status_ONLINE = (\$0 ~ \"ONLINE\") ? 1 : 0; - status_CAL = (\$0 ~ \"CAL\") ? 1 : 0; - status_TRIM = (\$0 ~ \"TRIM\") ? 1 : 0; - status_BOOST = (\$0 ~ \"BOOST\") ? 1 : 0; - status_ONBATT = (\$0 ~ \"ONBATT\") ? 1 : 0; - status_OVERLOAD = (\$0 ~ \"OVERLOAD\") ? 1 : 0; - status_LOWBATT = (\$0 ~ \"LOWBATT\") ? 1 : 0; - status_REPLACEBATT = (\$0 ~ \"REPLACEBATT\") ? 1 : 0; - status_NOBATT = (\$0 ~ \"NOBATT\") ? 1 : 0; - status_SLAVE = (\$0 ~ \"SLAVE( |$)\") ? 1 : 0; - status_SLAVEDOWN = (\$0 ~ \"SLAVEDOWN\") ? 1 : 0; - status_COMMLOST = (\$0 ~ \"COMMLOST\") ? 1 : 0; - status_SHUTTING_DOWN = (\$0 ~ \"SHUTTING\") ? 1 : 0; - }; - -END { - { load_usage = nompower * load / 100 }; - - print \"BEGIN apcupsd_${host}.online $1\"; - print \"SET online = \" online; - print \"END\" - - if (online == 1) { - print \"BEGIN apcupsd_${host}.charge $1\"; - print \"SET battery_charge = \" battery_charge; - print \"END\" - - print \"BEGIN apcupsd_${host}.battery_voltage $1\"; - print \"SET battery_voltage = \" battery_voltage; - print \"SET battery_voltage_nominal = \" battery_voltage_nominal; - print \"END\" - - print \"BEGIN apcupsd_${host}.input_voltage $1\"; - print \"SET input_voltage = \" input_voltage; - print \"SET input_voltage_min = \" input_voltage_min; - print \"SET input_voltage_max = \" input_voltage_max; - print \"END\" - - print \"BEGIN apcupsd_${host}.input_frequency $1\"; - print \"SET input_frequency = \" input_frequency; - print \"END\" - - print \"BEGIN apcupsd_${host}.output_voltage $1\"; - print \"SET output_voltage = \" output_voltage; - print \"SET output_voltage_nominal = \" output_voltage_nominal; - print \"END\" - - print \"BEGIN apcupsd_${host}.load $1\"; - print \"SET load = \" load; - print \"END\" - - print \"BEGIN apcupsd_${host}.load_usage $1\"; - print \"SET load_usage = \" load_usage; - print \"END\" - - print \"BEGIN apcupsd_${host}.temp $1\"; - print \"SET temp = \" temp; - print \"END\" - - print \"BEGIN apcupsd_${host}.time $1\"; - print \"SET time = \" time; - print \"END\" - - print \"BEGIN apcupsd_${host}.selftest $1\"; - print \"SET selftest_OK = \" selftest_OK; - print \"SET selftest_NO = \" selftest_NO; - print \"SET selftest_BT = \" selftest_BT; - print \"SET selftest_NG = \" selftest_NG; - print \"END\" - - print \"BEGIN apcupsd_${host}.status $1\"; - print \"SET status_ONLINE = \" status_ONLINE; - print \"SET status_ONBATT = \" status_ONBATT; - print \"SET status_OVERLOAD = \" status_OVERLOAD; - print \"SET status_LOWBATT = \" status_LOWBATT; - print \"SET status_REPLACEBATT = \" status_REPLACEBATT; - print \"SET status_NOBATT = \" status_NOBATT; - print \"SET status_SLAVE = \" status_SLAVE; - print \"SET status_SLAVEDOWN = \" status_SLAVEDOWN; - print \"SET status_COMMLOST = \" status_COMMLOST; - print \"SET status_CAL = \" status_CAL; - print \"SET status_TRIM = \" status_TRIM; - print \"SET status_BOOST = \" status_BOOST; - print \"SET status_SHUTTING_DOWN = \" status_SHUTTING_DOWN; - print \"END\"; - } -}" - # shellcheck disable=SC2181 - if [ $? -ne 0 ]; then - failed=$((failed + 1)) - error "failed to get values for APC UPS ${host} on ${apcupsd_sources[${host}]}" && return 1 - else - working=$((working + 1)) - fi - done - - [ $working -eq 0 ] && error "failed to get values from all APC UPSes" && return 1 - - return 0 -} diff --git a/src/collectors/charts.d.plugin/apcupsd/apcupsd.conf b/src/collectors/charts.d.plugin/apcupsd/apcupsd.conf deleted file mode 100644 index 679c0d61b..000000000 --- a/src/collectors/charts.d.plugin/apcupsd/apcupsd.conf +++ /dev/null @@ -1,25 +0,0 @@ -# no need for shebang - this file is loaded from charts.d.plugin - -# netdata -# real-time performance and health monitoring, done right! -# (C) 2018 Costa Tsaousis <costa@tsaousis.gr> -# GPL v3+ - -# add all your APC UPSes in this array - uncomment it too -#declare -A apcupsd_sources=( -# ["local"]="127.0.0.1:3551" -#) - -# how long to wait for apcupsd to respond -#apcupsd_timeout=3 - -# the data collection frequency -# if unset, will inherit the netdata update frequency -#apcupsd_update_every=10 - -# the charts priority on the dashboard -#apcupsd_priority=90000 - -# the number of retries to do in case of failure -# before disabling the module -#apcupsd_retries=10 diff --git a/src/collectors/charts.d.plugin/apcupsd/integrations/apc_ups.md b/src/collectors/charts.d.plugin/apcupsd/integrations/apc_ups.md deleted file mode 100644 index fdf1ccc9e..000000000 --- a/src/collectors/charts.d.plugin/apcupsd/integrations/apc_ups.md +++ /dev/null @@ -1,237 +0,0 @@ -<!--startmeta -custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/charts.d.plugin/apcupsd/README.md" -meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/charts.d.plugin/apcupsd/metadata.yaml" -sidebar_label: "APC UPS" -learn_status: "Published" -learn_rel_path: "Collecting Metrics/UPS" -most_popular: False -message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" -endmeta--> - -# APC UPS - - -<img src="https://netdata.cloud/img/apc.svg" width="150"/> - - -Plugin: charts.d.plugin -Module: apcupsd - -<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> - -## Overview - -Monitor APC UPS performance with Netdata for optimal uninterruptible power supply operations. Enhance your power supply reliability with real-time APC UPS metrics. - -The collector uses the `apcaccess` tool to contact the `apcupsd` daemon and get the APC UPS statistics. - -This collector is supported on all platforms. - -This collector only supports collecting metrics from a single instance of this integration. - - -### Default Behavior - -#### Auto-Detection - -By default, with no configuration provided, the collector will try to contact 127.0.0.1:3551 with using the `apcaccess` utility. - -#### 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 ups - -Metrics related to UPS. Each UPS provides its own set of the following metrics. - -This scope has no labels. - -Metrics: - -| Metric | Dimensions | Unit | -|:------|:----------|:----| -| apcupsd.charge | charge | percentage | -| apcupsd.battery.voltage | voltage, nominal | Volts | -| apcupsd.input.voltage | voltage, min, max | Volts | -| apcupsd.output.voltage | absolute, nominal | Volts | -| apcupsd.input.frequency | frequency | Hz | -| apcupsd.load | load | percentage | -| apcupsd.load_usage | load | Watts | -| apcupsd.temperature | temp | Celsius | -| apcupsd.time | time | Minutes | -| apcupsd.online | online | boolean | -| apcupsd.selftest | OK, NO, BT, NG | status | -| apcupsd.status | ONLINE, ONBATT, OVERLOAD, LOWBATT, REPLACEBATT, NOBATT, SLAVE, SLAVEDOWN, COMMLOST, CAL, TRIM, BOOST, SHUTTING_DOWN | status | - - - -## Alerts - - -The following alerts are available: - -| Alert name | On metric | Description | -|:------------|:----------|:------------| -| [ apcupsd_ups_charge ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.charge | average UPS charge over the last minute | -| [ apcupsd_10min_ups_load ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.load | average UPS load over the last 10 minutes | -| [ apcupsd_last_collected_secs ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.load | number of seconds since the last successful data collection | -| [ apcupsd_selftest_warning ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.selftest | self-test failed due to insufficient battery capacity or due to overload. | -| [ apcupsd_status_onbatt ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.status | APC UPS has switched to battery power because the input power has failed | -| [ apcupsd_status_overload ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.status | APC UPS is overloaded and cannot supply enough power to the load | -| [ apcupsd_status_lowbatt ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.status | APC UPS battery is low and needs to be recharged | -| [ apcupsd_status_replacebatt ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.status | APC UPS battery has reached the end of its lifespan and needs to be replaced | -| [ apcupsd_status_nobatt ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.status | APC UPS has no battery | -| [ apcupsd_status_commlost ](https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf) | apcupsd.status | APC UPS communication link is lost | - - -## Setup - -### Prerequisites - -#### Install charts.d plugin - -If [using our official native DEB/RPM packages](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. - - -#### Required software - -Make sure the `apcaccess` and `apcupsd` are installed and running. - - -### Configuration - -#### File - -The configuration file name for this integration is `charts.d/apcupsd.conf`. - - -You can edit the configuration file using the `edit-config` script from the -Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). - -```bash -cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata -sudo ./edit-config charts.d/apcupsd.conf -``` -#### Options - -The config file is sourced by the charts.d plugin. It's a standard bash file. - -The following collapsed table contains all the options that can be configured for the apcupsd collector. - - -<details open><summary>Config options</summary> - -| Name | Description | Default | Required | -|:----|:-----------|:-------|:--------:| -| apcupsd_sources | This is an array of apcupsd sources. You can have multiple entries there. Please refer to the example below on how to set it. | 127.0.0.1:3551 | no | -| apcupsd_timeout | How long to wait for apcupsd to respond. | 3 | no | -| apcupsd_update_every | The data collection frequency. If unset, will inherit the netdata update frequency. | 1 | no | -| apcupsd_priority | The charts priority on the dashboard. | 90000 | no | -| apcupsd_retries | The number of retries to do in case of failure before disabling the collector. | 10 | no | - -</details> - -#### Examples - -##### Multiple apcupsd sources - -Specify a multiple apcupsd sources along with a custom update interval - -```yaml -# add all your APC UPSes in this array - uncomment it too -declare -A apcupsd_sources=( - ["local"]="127.0.0.1:3551", - ["remote"]="1.2.3.4:3551" -) - -# how long to wait for apcupsd to respond -#apcupsd_timeout=3 - -# the data collection frequency -# if unset, will inherit the netdata update frequency -apcupsd_update_every=5 - -# the charts priority on the dashboard -#apcupsd_priority=90000 - -# the number of retries to do in case of failure -# before disabling the module -#apcupsd_retries=10 - -``` - - -## Troubleshooting - -### Debug Mode - - -To troubleshoot issues with the `apcupsd` collector, run the `charts.d.plugin` with the debug option enabled. The output -should give you clues as to why the collector isn't working. - -- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on - your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. - - ```bash - cd /usr/libexec/netdata/plugins.d/ - ``` - -- Switch to the `netdata` user. - - ```bash - sudo -u netdata -s - ``` - -- Run the `charts.d.plugin` to debug the collector: - - ```bash - ./charts.d.plugin debug 1 apcupsd - ``` - -### Getting Logs - -If you're encountering problems with the `apcupsd` collector, follow these steps to retrieve logs and identify potential issues: - -- **Run the command** specific to your system (systemd, non-systemd, or Docker container). -- **Examine the output** for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem. - -#### System with systemd - -Use the following command to view logs generated since the last Netdata service restart: - -```bash -journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep apcupsd -``` - -#### System without systemd - -Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name: - -```bash -grep apcupsd /var/log/netdata/collector.log -``` - -**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues. - -#### Docker Container - -If your Netdata runs in a Docker container named "netdata" (replace if different), use this command: - -```bash -docker logs netdata 2>&1 | grep apcupsd -``` - - diff --git a/src/collectors/charts.d.plugin/apcupsd/metadata.yaml b/src/collectors/charts.d.plugin/apcupsd/metadata.yaml deleted file mode 100644 index 01d86e795..000000000 --- a/src/collectors/charts.d.plugin/apcupsd/metadata.yaml +++ /dev/null @@ -1,256 +0,0 @@ -plugin_name: charts.d.plugin -modules: - - meta: - plugin_name: charts.d.plugin - module_name: apcupsd - monitored_instance: - name: APC UPS - link: "https://www.apc.com" - categories: - - data-collection.ups - icon_filename: "apc.svg" - related_resources: - integrations: - list: [] - info_provided_to_referring_integrations: - description: "" - keywords: - - ups - - apc - - power - - supply - - battery - - apcupsd - most_popular: false - overview: - data_collection: - metrics_description: "Monitor APC UPS performance with Netdata for optimal uninterruptible power supply operations. Enhance your power supply reliability with real-time APC UPS metrics." - method_description: "The collector uses the `apcaccess` tool to contact the `apcupsd` daemon and get the APC UPS statistics." - supported_platforms: - include: [] - exclude: [] - multi_instance: false - additional_permissions: - description: "" - default_behavior: - auto_detection: - description: "By default, with no configuration provided, the collector will try to contact 127.0.0.1:3551 with using the `apcaccess` utility." - limits: - description: "" - performance_impact: - description: "" - setup: - prerequisites: - list: - - title: "Install charts.d plugin" - description: | - If [using our official native DEB/RPM packages](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. - - title: "Required software" - description: "Make sure the `apcaccess` and `apcupsd` are installed and running." - configuration: - file: - name: charts.d/apcupsd.conf - options: - description: | - The config file is sourced by the charts.d plugin. It's a standard bash file. - - The following collapsed table contains all the options that can be configured for the apcupsd collector. - folding: - title: "Config options" - enabled: true - list: - - name: apcupsd_sources - description: This is an array of apcupsd sources. You can have multiple entries there. Please refer to the example below on how to set it. - default_value: "127.0.0.1:3551" - required: false - - name: apcupsd_timeout - description: How long to wait for apcupsd to respond. - default_value: 3 - required: false - - name: apcupsd_update_every - description: The data collection frequency. If unset, will inherit the netdata update frequency. - default_value: 1 - required: false - - name: apcupsd_priority - description: The charts priority on the dashboard. - default_value: 90000 - required: false - - name: apcupsd_retries - description: The number of retries to do in case of failure before disabling the collector. - default_value: 10 - required: false - examples: - folding: - enabled: false - title: "Config" - list: - - name: Multiple apcupsd sources - description: Specify a multiple apcupsd sources along with a custom update interval - config: | - # add all your APC UPSes in this array - uncomment it too - declare -A apcupsd_sources=( - ["local"]="127.0.0.1:3551", - ["remote"]="1.2.3.4:3551" - ) - - # how long to wait for apcupsd to respond - #apcupsd_timeout=3 - - # the data collection frequency - # if unset, will inherit the netdata update frequency - apcupsd_update_every=5 - - # the charts priority on the dashboard - #apcupsd_priority=90000 - - # the number of retries to do in case of failure - # before disabling the module - #apcupsd_retries=10 - troubleshooting: - problems: - list: [] - alerts: - - name: apcupsd_ups_charge - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.charge - info: average UPS charge over the last minute - os: "*" - - name: apcupsd_10min_ups_load - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.load - info: average UPS load over the last 10 minutes - os: "*" - - name: apcupsd_last_collected_secs - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.load - info: number of seconds since the last successful data collection - - name: apcupsd_selftest_warning - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.selftest - info: self-test failed due to insufficient battery capacity or due to overload. - - name: apcupsd_status_onbatt - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.status - info: APC UPS has switched to battery power because the input power has failed - - name: apcupsd_status_overload - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.status - info: APC UPS is overloaded and cannot supply enough power to the load - - name: apcupsd_status_lowbatt - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.status - info: APC UPS battery is low and needs to be recharged - - name: apcupsd_status_replacebatt - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.status - info: APC UPS battery has reached the end of its lifespan and needs to be replaced - - name: apcupsd_status_nobatt - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.status - info: APC UPS has no battery - - name: apcupsd_status_commlost - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/apcupsd.conf - metric: apcupsd.status - info: APC UPS communication link is lost - metrics: - folding: - title: Metrics - enabled: false - description: "" - availability: [] - scopes: - - name: ups - description: "Metrics related to UPS. Each UPS provides its own set of the following metrics." - labels: [] - metrics: - - name: apcupsd.charge - description: UPS Charge - unit: "percentage" - chart_type: area - dimensions: - - name: charge - - name: apcupsd.battery.voltage - description: UPS Battery Voltage - unit: "Volts" - chart_type: line - dimensions: - - name: voltage - - name: nominal - - name: apcupsd.input.voltage - description: UPS Input Voltage - unit: "Volts" - chart_type: line - dimensions: - - name: voltage - - name: min - - name: max - - name: apcupsd.output.voltage - description: UPS Output Voltage - unit: "Volts" - chart_type: line - dimensions: - - name: absolute - - name: nominal - - name: apcupsd.input.frequency - description: UPS Input Voltage - unit: "Hz" - chart_type: line - dimensions: - - name: frequency - - name: apcupsd.load - description: UPS Load - unit: "percentage" - chart_type: area - dimensions: - - name: load - - name: apcupsd.load_usage - description: UPS Load Usage - unit: "Watts" - chart_type: area - dimensions: - - name: load - - name: apcupsd.temperature - description: UPS Temperature - unit: "Celsius" - chart_type: line - dimensions: - - name: temp - - name: apcupsd.time - description: UPS Time Remaining - unit: "Minutes" - chart_type: area - dimensions: - - name: time - - name: apcupsd.online - description: UPS ONLINE flag - unit: "boolean" - chart_type: line - dimensions: - - name: online - - name: apcupsd.selftest - description: UPS Self-Test status - unit: status - chart_type: line - dimensions: - - name: OK - - name: NO - - name: BT - - name: NG - - name: apcupsd.status - description: UPS Status - unit: status - chart_type: line - dimensions: - - name: ONLINE - - name: ONBATT - - name: OVERLOAD - - name: LOWBATT - - name: REPLACEBATT - - name: NOBATT - - name: SLAVE - - name: SLAVEDOWN - - name: COMMLOST - - name: CAL - - name: TRIM - - name: BOOST - - name: SHUTTING_DOWN diff --git a/src/collectors/charts.d.plugin/example/README.md b/src/collectors/charts.d.plugin/example/README.md index a16180581..d676cea77 100644 --- a/src/collectors/charts.d.plugin/example/README.md +++ b/src/collectors/charts.d.plugin/example/README.md @@ -1,12 +1,3 @@ -<!-- -title: "Example" -custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/charts.d.plugin/example/README.md" -sidebar_label: "example-charts.d.plugin" -learn_status: "Published" -learn_topic_type: "References" -learn_rel_path: "Integrations/Monitor/Mock Collectors" ---> - # Example If you want to understand how charts.d data collector functions, check out the [charts.d example](https://raw.githubusercontent.com/netdata/netdata/master/src/collectors/charts.d.plugin/example/example.chart.sh). diff --git a/src/collectors/charts.d.plugin/libreswan/integrations/libreswan.md b/src/collectors/charts.d.plugin/libreswan/integrations/libreswan.md index fa8eb7a97..96691443b 100644 --- a/src/collectors/charts.d.plugin/libreswan/integrations/libreswan.md +++ b/src/collectors/charts.d.plugin/libreswan/integrations/libreswan.md @@ -79,7 +79,7 @@ There are no alerts configured by default for this integration. #### Install charts.d plugin -If [using our official native DEB/RPM packages](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. +If [using our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. #### Permissions to execute `ipsec` @@ -115,8 +115,8 @@ Make sure the path `/sbin/ipsec` matches your setup (execute `which ipsec` to fi The configuration file name for this integration is `charts.d/libreswan.conf`. -You can edit the configuration file using the `edit-config` script from the -Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). +You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). ```bash cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata diff --git a/src/collectors/charts.d.plugin/opensips/integrations/opensips.md b/src/collectors/charts.d.plugin/opensips/integrations/opensips.md index 7fa610eb4..13b573627 100644 --- a/src/collectors/charts.d.plugin/opensips/integrations/opensips.md +++ b/src/collectors/charts.d.plugin/opensips/integrations/opensips.md @@ -96,7 +96,7 @@ There are no alerts configured by default for this integration. #### Install charts.d plugin -If [using our official native DEB/RPM packages](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. +If [using our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. #### Required software @@ -111,8 +111,8 @@ The collector requires the `opensipsctl` to be installed. The configuration file name for this integration is `charts.d/opensips.conf`. -You can edit the configuration file using the `edit-config` script from the -Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). +You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). ```bash cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata diff --git a/src/collectors/charts.d.plugin/sensors/README.md b/src/collectors/charts.d.plugin/sensors/README.md deleted file mode 120000 index 7e5a416c4..000000000 --- a/src/collectors/charts.d.plugin/sensors/README.md +++ /dev/null @@ -1 +0,0 @@ -integrations/linux_sensors_sysfs.md
\ No newline at end of file diff --git a/src/collectors/charts.d.plugin/sensors/integrations/linux_sensors_sysfs.md b/src/collectors/charts.d.plugin/sensors/integrations/linux_sensors_sysfs.md deleted file mode 100644 index f9221caa1..000000000 --- a/src/collectors/charts.d.plugin/sensors/integrations/linux_sensors_sysfs.md +++ /dev/null @@ -1,235 +0,0 @@ -<!--startmeta -custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/charts.d.plugin/sensors/README.md" -meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/charts.d.plugin/sensors/metadata.yaml" -sidebar_label: "Linux Sensors (sysfs)" -learn_status: "Published" -learn_rel_path: "Collecting Metrics/Hardware Devices and Sensors" -most_popular: False -message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" -endmeta--> - -# Linux Sensors (sysfs) - - -<img src="https://netdata.cloud/img/microchip.svg" width="150"/> - - -Plugin: charts.d.plugin -Module: sensors - -<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> - -## Overview - -Use this collector when `lm-sensors` doesn't work on your device (e.g. for RPi temperatures). -For all other cases use the [Go collector](/src/go/plugin/go.d/modules/sensors/README.md), which supports multiple jobs, is more efficient and performs calculations on top of the kernel provided values." - - -It will provide charts for all configured system sensors, by reading sensors directly from the kernel. -The values graphed are the raw hardware values of the sensors. - - -This collector is only supported on the following platforms: - -- Linux - -This collector supports collecting metrics from multiple instances of this integration, including remote instances. - - -### Default Behavior - -#### Auto-Detection - -By default, the collector will try to read entries under `/sys/devices` - -#### 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 sensor chip - -Metrics related to sensor chips. Each chip provides its own set of the following metrics. - -This scope has no labels. - -Metrics: - -| Metric | Dimensions | Unit | -|:------|:----------|:----| -| sensors.temp | {filename} | Celsius | -| sensors.volt | {filename} | Volts | -| sensors.curr | {filename} | Ampere | -| sensors.power | {filename} | Watt | -| sensors.fans | {filename} | Rotations / Minute | -| sensors.energy | {filename} | Joule | -| sensors.humidity | {filename} | Percent | - - - -## Alerts - -There are no alerts configured by default for this integration. - - -## Setup - -### Prerequisites - -#### Install charts.d plugin - -If [using our official native DEB/RPM packages](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. - - -#### Enable the sensors collector - -The `sensors` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config directory](/docs/netdata-agent/configuration/README.md), which is typically at `/etc/netdata`, to edit the `charts.d.conf` file. - -```bash -cd /etc/netdata # Replace this path with your Netdata config directory, if different -sudo ./edit-config charts.d.conf -``` - -Change the value of the `sensors` setting to `force` and uncomment the line. Save the file and restart the Netdata Agent with `sudo systemctl restart netdata`, or the [appropriate method](/packaging/installer/README.md#maintaining-a-netdata-agent-installation) for your system. - - - -### Configuration - -#### File - -The configuration file name for this integration is `charts.d/sensors.conf`. - - -You can edit the configuration file using the `edit-config` script from the -Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). - -```bash -cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata -sudo ./edit-config charts.d/sensors.conf -``` -#### Options - -The config file is sourced by the charts.d plugin. It's a standard bash file. - -The following collapsed table contains all the options that can be configured for the sensors collector. - - -<details open><summary>Config options</summary> - -| Name | Description | Default | Required | -|:----|:-----------|:-------|:--------:| -| sensors_sys_dir | The directory the kernel exposes sensor data. | /sys/devices | no | -| sensors_sys_depth | How deep in the tree to check for sensor data. | 10 | no | -| sensors_source_update | If set to 1, the script will overwrite internal script functions with code generated ones. | 1 | no | -| sensors_update_every | The data collection frequency. If unset, will inherit the netdata update frequency. | 1 | no | -| sensors_priority | The charts priority on the dashboard. | 90000 | no | -| sensors_retries | The number of retries to do in case of failure before disabling the collector. | 10 | no | - -</details> - -#### Examples - -##### Set sensors path depth - -Set a different sensors path depth - -```yaml -# the directory the kernel keeps sensor data -#sensors_sys_dir="/sys/devices" - -# how deep in the tree to check for sensor data -sensors_sys_depth=5 - -# if set to 1, the script will overwrite internal -# script functions with code generated ones -# leave to 1, is faster -#sensors_source_update=1 - -# the data collection frequency -# if unset, will inherit the netdata update frequency -#sensors_update_every= - -# the charts priority on the dashboard -#sensors_priority=90000 - -# the number of retries to do in case of failure -# before disabling the module -#sensors_retries=10 - -``` - - -## Troubleshooting - -### Debug Mode - - -To troubleshoot issues with the `sensors` collector, run the `charts.d.plugin` with the debug option enabled. The output -should give you clues as to why the collector isn't working. - -- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on - your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. - - ```bash - cd /usr/libexec/netdata/plugins.d/ - ``` - -- Switch to the `netdata` user. - - ```bash - sudo -u netdata -s - ``` - -- Run the `charts.d.plugin` to debug the collector: - - ```bash - ./charts.d.plugin debug 1 sensors - ``` - -### Getting Logs - -If you're encountering problems with the `sensors` collector, follow these steps to retrieve logs and identify potential issues: - -- **Run the command** specific to your system (systemd, non-systemd, or Docker container). -- **Examine the output** for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem. - -#### System with systemd - -Use the following command to view logs generated since the last Netdata service restart: - -```bash -journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep sensors -``` - -#### System without systemd - -Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name: - -```bash -grep sensors /var/log/netdata/collector.log -``` - -**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues. - -#### Docker Container - -If your Netdata runs in a Docker container named "netdata" (replace if different), use this command: - -```bash -docker logs netdata 2>&1 | grep sensors -``` - - diff --git a/src/collectors/charts.d.plugin/sensors/metadata.yaml b/src/collectors/charts.d.plugin/sensors/metadata.yaml deleted file mode 100644 index 9aacdd353..000000000 --- a/src/collectors/charts.d.plugin/sensors/metadata.yaml +++ /dev/null @@ -1,182 +0,0 @@ -plugin_name: charts.d.plugin -modules: - - meta: - plugin_name: charts.d.plugin - module_name: sensors - monitored_instance: - name: Linux Sensors (sysfs) - link: "https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface" - categories: - - data-collection.hardware-devices-and-sensors - icon_filename: "microchip.svg" - related_resources: - integrations: - list: [] - info_provided_to_referring_integrations: - description: "" - keywords: - - sensors - - sysfs - - hwmon - - rpi - - raspberry pi - most_popular: false - overview: - data_collection: - metrics_description: | - Use this collector when `lm-sensors` doesn't work on your device (e.g. for RPi temperatures). - For all other cases use the [Go collector](/src/go/plugin/go.d/modules/sensors/README.md), which supports multiple jobs, is more efficient and performs calculations on top of the kernel provided values." - method_description: | - It will provide charts for all configured system sensors, by reading sensors directly from the kernel. - The values graphed are the raw hardware values of the sensors. - supported_platforms: - include: [Linux] - exclude: [] - multi_instance: true - additional_permissions: - description: "" - default_behavior: - auto_detection: - description: "By default, the collector will try to read entries under `/sys/devices`" - limits: - description: "" - performance_impact: - description: "" - setup: - prerequisites: - list: - - title: "Install charts.d plugin" - description: | - If [using our official native DEB/RPM packages](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. - - title: "Enable the sensors collector" - description: | - The `sensors` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config directory](/docs/netdata-agent/configuration/README.md), which is typically at `/etc/netdata`, to edit the `charts.d.conf` file. - - ```bash - cd /etc/netdata # Replace this path with your Netdata config directory, if different - sudo ./edit-config charts.d.conf - ``` - - Change the value of the `sensors` setting to `force` and uncomment the line. Save the file and restart the Netdata Agent with `sudo systemctl restart netdata`, or the [appropriate method](/packaging/installer/README.md#maintaining-a-netdata-agent-installation) for your system. - configuration: - file: - name: charts.d/sensors.conf - options: - description: | - The config file is sourced by the charts.d plugin. It's a standard bash file. - - The following collapsed table contains all the options that can be configured for the sensors collector. - folding: - title: "Config options" - enabled: true - list: - - name: sensors_sys_dir - description: The directory the kernel exposes sensor data. - default_value: "/sys/devices" - required: false - - name: sensors_sys_depth - description: How deep in the tree to check for sensor data. - default_value: 10 - required: false - - name: sensors_source_update - description: If set to 1, the script will overwrite internal script functions with code generated ones. - default_value: 1 - required: false - - name: sensors_update_every - description: The data collection frequency. If unset, will inherit the netdata update frequency. - default_value: 1 - required: false - - name: sensors_priority - description: The charts priority on the dashboard. - default_value: 90000 - required: false - - name: sensors_retries - description: The number of retries to do in case of failure before disabling the collector. - default_value: 10 - required: false - examples: - folding: - enabled: false - title: "Config" - list: - - name: Set sensors path depth - description: Set a different sensors path depth - config: | - # the directory the kernel keeps sensor data - #sensors_sys_dir="/sys/devices" - - # how deep in the tree to check for sensor data - sensors_sys_depth=5 - - # if set to 1, the script will overwrite internal - # script functions with code generated ones - # leave to 1, is faster - #sensors_source_update=1 - - # the data collection frequency - # if unset, will inherit the netdata update frequency - #sensors_update_every= - - # the charts priority on the dashboard - #sensors_priority=90000 - - # the number of retries to do in case of failure - # before disabling the module - #sensors_retries=10 - troubleshooting: - problems: - list: [] - alerts: [] - metrics: - folding: - title: Metrics - enabled: false - description: "" - availability: [] - scopes: - - name: sensor chip - description: "Metrics related to sensor chips. Each chip provides its own set of the following metrics." - labels: [] - metrics: - - name: sensors.temp - description: Temperature - unit: "Celsius" - chart_type: line - dimensions: - - name: "{filename}" - - name: sensors.volt - description: Voltage - unit: "Volts" - chart_type: line - dimensions: - - name: "{filename}" - - name: sensors.curr - description: Current - unit: "Ampere" - chart_type: line - dimensions: - - name: "{filename}" - - name: sensors.power - description: Power - unit: "Watt" - chart_type: line - dimensions: - - name: "{filename}" - - name: sensors.fans - description: Fans Speed - unit: "Rotations / Minute" - chart_type: line - dimensions: - - name: "{filename}" - - name: sensors.energy - description: Energy - unit: "Joule" - chart_type: area - dimensions: - - name: "{filename}" - - name: sensors.humidity - description: Humidity - unit: "Percent" - chart_type: line - dimensions: - - name: "{filename}" diff --git a/src/collectors/charts.d.plugin/sensors/sensors.chart.sh b/src/collectors/charts.d.plugin/sensors/sensors.chart.sh deleted file mode 100644 index 9576e2ab2..000000000 --- a/src/collectors/charts.d.plugin/sensors/sensors.chart.sh +++ /dev/null @@ -1,250 +0,0 @@ -# shellcheck shell=bash -# no need for shebang - this file is loaded from charts.d.plugin -# SPDX-License-Identifier: GPL-3.0-or-later - -# netdata -# real-time performance and health monitoring, done right! -# (C) 2016 Costa Tsaousis <costa@tsaousis.gr> -# - -# sensors docs -# https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface - -# if this chart is called X.chart.sh, then all functions and global variables -# must start with X_ - -# the directory the kernel keeps sensor data -sensors_sys_dir="${NETDATA_HOST_PREFIX}/sys/devices" - -# how deep in the tree to check for sensor data -sensors_sys_depth=10 - -# if set to 1, the script will overwrite internal -# script functions with code generated ones -# leave to 1, is faster -sensors_source_update=1 - -# how frequently to collect sensor data -# the default is to collect it at every iteration of charts.d -sensors_update_every= - -sensors_priority=90000 - -declare -A sensors_excluded=() - -sensors_find_all_files() { - find "$1" -maxdepth $sensors_sys_depth -name \*_input -o -name temp 2>/dev/null -} - -sensors_find_all_dirs() { - # shellcheck disable=SC2162 - sensors_find_all_files "$1" | while read; do - dirname "$REPLY" - done | sort -u -} - -# _check is called once, to find out if this chart should be enabled or not -sensors_check() { - - # this should return: - # - 0 to enable the chart - # - 1 to disable the chart - - [ -z "$(sensors_find_all_files "$sensors_sys_dir")" ] && error "no sensors found in '$sensors_sys_dir'." && return 1 - return 0 -} - -sensors_check_files() { - # we only need sensors that report a non-zero value - # also remove not needed sensors - - local f v excluded - for f in "$@"; do - [ ! -f "$f" ] && continue - for ex in "${sensors_excluded[@]}"; do - [[ $f =~ .*$ex$ ]] && excluded='1' && break - done - - [ "$excluded" != "1" ] && v="$(cat "$f")" || v=0 - v=$((v + 1 - 1)) - [ $v -ne 0 ] && echo "$f" && continue - excluded= - - error "$f gives zero values" - done -} - -sensors_check_temp_type() { - # valid temp types are 1 to 6 - # disabled sensors have the value 0 - - local f t v - for f in "$@"; do - # shellcheck disable=SC2001 - t=$(echo "$f" | sed "s|_input$|_type|g") - [ "$f" = "$t" ] && echo "$f" && continue - [ ! -f "$t" ] && echo "$f" && continue - - v="$(cat "$t")" - v=$((v + 1 - 1)) - [ $v -ne 0 ] && echo "$f" && continue - - error "$f is disabled" - done -} - -# _create is called once, to create the charts -sensors_create() { - local path dir name x file lfile labelname device subsystem id type mode files multiplier divisor - - # we create a script with the source of the - # sensors_update() function - # - the highest speed we can achieve - - [ $sensors_source_update -eq 1 ] && echo >"$TMP_DIR/sensors.sh" "sensors_update() {" - - for path in $(sensors_find_all_dirs "$sensors_sys_dir" | sort -u); do - dir=$(basename "$path") - device= - subsystem= - id= - type= - name= - - [ -h "$path/device" ] && device=$(readlink -f "$path/device") - [ ! -z "$device" ] && device=$(basename "$device") - [ -z "$device" ] && device="$dir" - - [ -h "$path/subsystem" ] && subsystem=$(readlink -f "$path/subsystem") - [ ! -z "$subsystem" ] && subsystem=$(basename "$subsystem") - [ -z "$subsystem" ] && subsystem="$dir" - - [ -f "$path/name" ] && name=$(cat "$path/name") - [ -z "$name" ] && name="$dir" - - [ -f "$path/type" ] && type=$(cat "$path/type") - [ -z "$type" ] && type="$dir" - - id="$(fixid "$device.$subsystem.$dir")" - - debug "path='$path', dir='$dir', device='$device', subsystem='$subsystem', id='$id', name='$name'" - - for mode in temperature voltage fans power current energy humidity; do - files= - multiplier=1 - divisor=1 - algorithm="absolute" - - case $mode in - temperature) - files="$( - ls "$path"/temp*_input 2>/dev/null - ls "$path/temp" 2>/dev/null - )" - files="$(sensors_check_files "$files")" - files="$(sensors_check_temp_type "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.temp_${id}_${name}' '' 'Temperature' 'Celsius' 'temperature' 'sensors.temp' line $((sensors_priority + 1)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.temp_${id}_${name}' \$1\"" - divisor=1000 - ;; - - voltage) - files="$(ls "$path"/in*_input 2>/dev/null)" - files="$(sensors_check_files "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.volt_${id}_${name}' '' 'Voltage' 'Volts' 'voltage' 'sensors.volt' line $((sensors_priority + 2)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.volt_${id}_${name}' \$1\"" - divisor=1000 - ;; - - current) - files="$(ls "$path"/curr*_input 2>/dev/null)" - files="$(sensors_check_files "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.curr_${id}_${name}' '' 'Current' 'Ampere' 'current' 'sensors.curr' line $((sensors_priority + 3)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.curr_${id}_${name}' \$1\"" - divisor=1000 - ;; - - power) - files="$(ls "$path"/power*_input 2>/dev/null)" - files="$(sensors_check_files "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.power_${id}_${name}' '' 'Power' 'Watt' 'power' 'sensors.power' line $((sensors_priority + 4)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.power_${id}_${name}' \$1\"" - divisor=1000000 - ;; - - fans) - files="$(ls "$path"/fan*_input 2>/dev/null)" - files="$(sensors_check_files "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.fan_${id}_${name}' '' 'Fans Speed' 'Rotations / Minute' 'fans' 'sensors.fans' line $((sensors_priority + 5)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.fan_${id}_${name}' \$1\"" - ;; - - energy) - files="$(ls "$path"/energy*_input 2>/dev/null)" - files="$(sensors_check_files "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.energy_${id}_${name}' '' 'Energy' 'Joule' 'energy' 'sensors.energy' area $((sensors_priority + 6)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.energy_${id}_${name}' \$1\"" - algorithm="incremental" - divisor=1000000 - ;; - - humidity) - files="$(ls "$path"/humidity*_input 2>/dev/null)" - files="$(sensors_check_files "$files")" - [ -z "$files" ] && continue - echo "CHART 'sensors.humidity_${id}_${name}' '' 'Humidity' 'Percent' 'humidity' 'sensors.humidity' line $((sensors_priority + 7)) $sensors_update_every '' '' 'sensors'" - echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN 'sensors.humidity_${id}_${name}' \$1\"" - divisor=1000 - ;; - - *) - continue - ;; - esac - - for x in $files; do - file="$x" - fid="$(fixid "$file")" - lfile="$(basename "$file" | sed "s|_input$|_label|g")" - labelname="$(basename "$file" | sed "s|_input$||g")" - - if [ ! "$path/$lfile" = "$file" ] && [ -f "$path/$lfile" ]; then - labelname="$(cat "$path/$lfile")" - fi - - echo "DIMENSION $fid '$labelname' $algorithm $multiplier $divisor" - echo >>"$TMP_DIR/sensors.sh" "echo \"SET $fid = \"\$(< $file )" - done - - echo >>"$TMP_DIR/sensors.sh" "echo END" - done - done - - [ $sensors_source_update -eq 1 ] && echo >>"$TMP_DIR/sensors.sh" "}" - - # ok, load the function sensors_update() we created - # shellcheck source=/dev/null - [ $sensors_source_update -eq 1 ] && . "$TMP_DIR/sensors.sh" - - return 0 -} - -# _update is called continuously, to collect the values -sensors_update() { - # the first argument to this function is the microseconds since last update - # pass this parameter to the BEGIN statement (see below). - - # do all the work to collect / calculate the values - # for each dimension - # remember: KEEP IT SIMPLE AND SHORT - - # shellcheck source=/dev/null - [ $sensors_source_update -eq 0 ] && . "$TMP_DIR/sensors.sh" "$1" - - return 0 -} diff --git a/src/collectors/charts.d.plugin/sensors/sensors.conf b/src/collectors/charts.d.plugin/sensors/sensors.conf deleted file mode 100644 index bcb28807d..000000000 --- a/src/collectors/charts.d.plugin/sensors/sensors.conf +++ /dev/null @@ -1,32 +0,0 @@ -# no need for shebang - this file is loaded from charts.d.plugin - -# netdata -# real-time performance and health monitoring, done right! -# (C) 2018 Costa Tsaousis <costa@tsaousis.gr> -# GPL v3+ - -# THIS PLUGIN IS DEPRECATED -# USE THE PYTHON.D ONE - -# the directory the kernel keeps sensor data -#sensors_sys_dir="/sys/devices" - -# how deep in the tree to check for sensor data -#sensors_sys_depth=10 - -# if set to 1, the script will overwrite internal -# script functions with code generated ones -# leave to 1, is faster -#sensors_source_update=1 - -# the data collection frequency -# if unset, will inherit the netdata update frequency -#sensors_update_every= - -# the charts priority on the dashboard -#sensors_priority=90000 - -# the number of retries to do in case of failure -# before disabling the module -#sensors_retries=10 - |