Browse Source

remove python.d/sensors (#17473)

Ilya Mashchenko 10 months ago
parent
commit
3b1c4fa438

+ 0 - 2
CMakeLists.txt

@@ -2572,7 +2572,6 @@ install(FILES
         src/collectors/python.d.plugin/retroshare/retroshare.conf
         src/collectors/python.d.plugin/riakkv/riakkv.conf
         src/collectors/python.d.plugin/samba/samba.conf
-        src/collectors/python.d.plugin/sensors/sensors.conf
         src/collectors/python.d.plugin/smartd_log/smartd_log.conf
         src/collectors/python.d.plugin/spigotmc/spigotmc.conf
         src/collectors/python.d.plugin/squid/squid.conf
@@ -2620,7 +2619,6 @@ install(FILES
         src/collectors/python.d.plugin/retroshare/retroshare.chart.py
         src/collectors/python.d.plugin/riakkv/riakkv.chart.py
         src/collectors/python.d.plugin/samba/samba.chart.py
-        src/collectors/python.d.plugin/sensors/sensors.chart.py
         src/collectors/python.d.plugin/smartd_log/smartd_log.chart.py
         src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
         src/collectors/python.d.plugin/squid/squid.chart.py

+ 1 - 1
src/collectors/python.d.plugin/python.d.conf

@@ -63,7 +63,7 @@ hpssa: no
 # retroshare: yes
 # riakkv: yes
 # samba: yes
-# sensors: yes
+sensors: no  # replaced with go.d/sensors. Disabled for existing installations.
 # smartd_log: yes
 # spigotmc: yes
 # squid: yes

+ 0 - 1
src/collectors/python.d.plugin/sensors/README.md

@@ -1 +0,0 @@
-integrations/linux_sensors_lm-sensors.md

+ 0 - 187
src/collectors/python.d.plugin/sensors/integrations/linux_sensors_lm-sensors.md

@@ -1,187 +0,0 @@
-<!--startmeta
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/sensors/README.md"
-meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/sensors/metadata.yaml"
-sidebar_label: "Linux Sensors (lm-sensors)"
-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 (lm-sensors)
-
-
-<img src="https://netdata.cloud/img/microchip.svg" width="150"/>
-
-
-Plugin: python.d.plugin
-Module: sensors
-
-<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
-
-## Overview
-
-Examine Linux Sensors metrics with Netdata for insights into hardware health and performance.
-
-Enhance your system's reliability with real-time hardware health insights.
-
-
-Reads system sensors information (temperature, voltage, electric current, power, etc.) via [lm-sensors](https://hwmon.wiki.kernel.org/lm_sensors).
-
-
-This collector is supported on all platforms.
-
-This collector supports collecting metrics from multiple instances of this integration, including remote instances.
-
-
-### Default Behavior
-
-#### Auto-Detection
-
-The following type of sensors are auto-detected:
-- temperature - fan - voltage - current - power - energy - humidity
-
-
-#### 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 chip
-
-Metrics related to chips. Each chip provides a set of the following metrics, each having the chip name in the metric name as reported by `sensors -u`.
-
-
-This scope has no labels.
-
-Metrics:
-
-| Metric | Dimensions | Unit |
-|:------|:----------|:----|
-| sensors.temperature | a dimension per sensor | Celsius |
-| sensors.voltage | a dimension per sensor | Volts |
-| sensors.current | a dimension per sensor | Ampere |
-| sensors.power | a dimension per sensor | Watt |
-| sensors.fan | a dimension per sensor | Rotations/min |
-| sensors.energy | a dimension per sensor | Joule |
-| sensors.humidity | a dimension per sensor | Percent |
-
-
-
-## Alerts
-
-There are no alerts configured by default for this integration.
-
-
-## Setup
-
-### Prerequisites
-
-No action required.
-
-### Configuration
-
-#### File
-
-The configuration file name for this integration is `python.d/sensors.conf`.
-
-
-You can edit the configuration file using the `edit-config` script from the
-Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory).
-
-```bash
-cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
-sudo ./edit-config python.d/sensors.conf
-```
-#### Options
-
-There are 2 sections:
-
-* Global variables
-* One or more JOBS that can define multiple different instances to monitor.
-
-The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
-
-Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
-
-Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
-
-
-<details><summary>Config options</summary>
-
-| Name | Description | Default | Required |
-|:----|:-----------|:-------|:--------:|
-| types | The types of sensors to collect. | temperature, fan, voltage, current, power, energy, humidity | yes |
-| update_every | Sets the default data collection frequency. | 1 | no |
-| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
-| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
-| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
-
-</details>
-
-#### Examples
-
-##### Default
-
-Default configuration.
-
-```yaml
-types:
-  - temperature
-  - fan
-  - voltage
-  - current
-  - power
-  - energy
-  - humidity
-
-```
-
-
-## Troubleshooting
-
-### Debug Mode
-
-To troubleshoot issues with the `sensors` collector, run the `python.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 `python.d.plugin` to debug the collector:
-
-  ```bash
-  ./python.d.plugin sensors debug trace
-  ```
-
-### lm-sensors doesn't work on your device
-
-
-
-### ACPI ring buffer errors are printed
-
-
-
-

+ 0 - 184
src/collectors/python.d.plugin/sensors/metadata.yaml

@@ -1,184 +0,0 @@
-plugin_name: python.d.plugin
-modules:
-  - meta:
-      plugin_name: python.d.plugin
-      module_name: sensors
-      monitored_instance:
-        name: Linux Sensors (lm-sensors)
-        link: https://hwmon.wiki.kernel.org/lm_sensors
-        categories:
-          - data-collection.hardware-devices-and-sensors
-        icon_filename: "microchip.svg"
-      related_resources:
-        integrations:
-          list: []
-      info_provided_to_referring_integrations:
-        description: ""
-      keywords:
-        - sensors
-        - temperature
-        - voltage
-        - current
-        - power
-        - fan
-        - energy
-        - humidity
-      most_popular: false
-    overview:
-      data_collection:
-        metrics_description: |
-          Examine Linux Sensors metrics with Netdata for insights into hardware health and performance.
-          
-          Enhance your system's reliability with real-time hardware health insights.
-        method_description: >
-          Reads system sensors information (temperature, voltage, electric current, power, etc.) via [lm-sensors](https://hwmon.wiki.kernel.org/lm_sensors).
-      supported_platforms:
-        include: []
-        exclude: []
-      multi_instance: true
-      additional_permissions:
-        description: ""
-      default_behavior:
-        auto_detection:
-          description: >
-            The following type of sensors are auto-detected:
-            
-            - temperature
-            - fan
-            - voltage
-            - current
-            - power
-            - energy
-            - humidity
-        limits:
-          description: ""
-        performance_impact:
-          description: ""
-    setup:
-      prerequisites:
-        list: []
-      configuration:
-        file:
-          name: python.d/sensors.conf
-          description: ""
-        options:
-          description: |
-            There are 2 sections:
-            
-            * Global variables
-            * One or more JOBS that can define multiple different instances to monitor.
-            
-            The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
-            
-            Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
-            
-            Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
-          folding:
-            title: Config options
-            enabled: true
-          list:
-            - name: types
-              description: The types of sensors to collect.
-              default_value: "temperature, fan, voltage, current, power, energy, humidity"
-              required: true
-            - name: update_every
-              description: Sets the default data collection frequency.
-              default_value: 1
-              required: false
-            - name: priority
-              description: Controls the order of charts at the netdata dashboard.
-              default_value: 60000
-              required: false
-            - name: autodetection_retry
-              description: Sets the job re-check interval in seconds.
-              default_value: 0
-              required: false
-            - name: penalty
-              description: Indicates whether to apply penalty to update_every in case of failures.
-              default_value: yes
-              required: false
-        examples:
-          folding:
-            enabled: true
-            title: Config
-          list:
-            - name: Default
-              folding:
-                enabled: false
-              description: Default configuration.
-              config: |
-                types:
-                  - temperature
-                  - fan
-                  - voltage
-                  - current
-                  - power
-                  - energy
-                  - humidity
-    troubleshooting:
-      problems:
-        list:
-          - name: lm-sensors doesn't work on your device
-            description: |
-              When `lm-sensors` doesn't work on your device (e.g. for RPi temperatures),
-              use [the legacy bash collector](https://github.com/netdata/netdata/blob/master/src/collectors/charts.d.plugin/sensors/README.md)
-          - name: ACPI ring buffer errors are printed
-            description: |
-              There have been reports from users that on certain servers, ACPI ring buffer errors are printed by the kernel (`dmesg`)
-              when ACPI sensors are being accessed. We are tracking such cases in issue [#827](https://github.com/netdata/netdata/issues/827).
-              Please join this discussion for help.
-    alerts: []
-    metrics:
-      folding:
-        title: Metrics
-        enabled: false
-      description: ""
-      availability: []
-      scopes:
-        - name: chip
-          description: >
-            Metrics related to chips. Each chip provides a set of the following metrics, each having the chip name in the metric name as reported by `sensors -u`.
-          labels: []
-          metrics:
-            - name: sensors.temperature
-              description: Temperature
-              unit: "Celsius"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor
-            - name: sensors.voltage
-              description: Voltage
-              unit: "Volts"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor
-            - name: sensors.current
-              description: Current
-              unit: "Ampere"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor
-            - name: sensors.power
-              description: Power
-              unit: "Watt"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor
-            - name: sensors.fan
-              description: Fans speed
-              unit: "Rotations/min"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor
-            - name: sensors.energy
-              description: Energy
-              unit: "Joule"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor
-            - name: sensors.humidity
-              description: Humidity
-              unit: "Percent"
-              chart_type: line
-              dimensions:
-                - name: a dimension per sensor

+ 0 - 179
src/collectors/python.d.plugin/sensors/sensors.chart.py

@@ -1,179 +0,0 @@
-# -*- coding: utf-8 -*-
-# Description: sensors netdata python.d plugin
-# Author: Pawel Krupa (paulfantom)
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-from collections import defaultdict
-
-from bases.FrameworkServices.SimpleService import SimpleService
-from third_party import lm_sensors as sensors
-
-ORDER = [
-    'temperature',
-    'fan',
-    'voltage',
-    'current',
-    'power',
-    'energy',
-    'humidity',
-]
-
-# This is a prototype of chart definition which is used to dynamically create self.definitions
-CHARTS = {
-    'temperature': {
-        'options': [None, 'Temperature', 'Celsius', 'temperature', 'sensors.temperature', 'line'],
-        'lines': [
-            [None, None, 'absolute', 1, 1000]
-        ]
-    },
-    'voltage': {
-        'options': [None, 'Voltage', 'Volts', 'voltage', 'sensors.voltage', 'line'],
-        'lines': [
-            [None, None, 'absolute', 1, 1000]
-        ]
-    },
-    'current': {
-        'options': [None, 'Current', 'Ampere', 'current', 'sensors.current', 'line'],
-        'lines': [
-            [None, None, 'absolute', 1, 1000]
-        ]
-    },
-    'power': {
-        'options': [None, 'Power', 'Watt', 'power', 'sensors.power', 'line'],
-        'lines': [
-            [None, None, 'absolute', 1, 1000]
-        ]
-    },
-    'fan': {
-        'options': [None, 'Fans speed', 'Rotations/min', 'fans', 'sensors.fan', 'line'],
-        'lines': [
-            [None, None, 'absolute', 1, 1000]
-        ]
-    },
-    'energy': {
-        'options': [None, 'Energy', 'Joule', 'energy', 'sensors.energy', 'line'],
-        'lines': [
-            [None, None, 'incremental', 1, 1000]
-        ]
-    },
-    'humidity': {
-        'options': [None, 'Humidity', 'Percent', 'humidity', 'sensors.humidity', 'line'],
-        'lines': [
-            [None, None, 'absolute', 1, 1000]
-        ]
-    }
-}
-
-LIMITS = {
-    'temperature': [-127, 1000],
-    'voltage': [-400, 400],
-    'current': [-127, 127],
-    'fan': [0, 65535]
-}
-
-TYPE_MAP = {
-    0: 'voltage',
-    1: 'fan',
-    2: 'temperature',
-    3: 'power',
-    4: 'energy',
-    5: 'current',
-    6: 'humidity',
-    # 7: 'max_main',
-    # 16: 'vid',
-    # 17: 'intrusion',
-    # 18: 'max_other',
-    # 24: 'beep_enable'
-}
-
-
-class Service(SimpleService):
-    def __init__(self, configuration=None, name=None):
-        SimpleService.__init__(self, configuration=configuration, name=name)
-        self.order = list()
-        self.definitions = dict()
-        self.chips = configuration.get('chips')
-        self.priority = 60000
-
-    def get_data(self):
-        seen, data = dict(), dict()
-        try:
-            for chip in sensors.ChipIterator():
-                chip_name = sensors.chip_snprintf_name(chip)
-                seen[chip_name] = defaultdict(list)
-
-                for feat in sensors.FeatureIterator(chip):
-                    if feat.type not in TYPE_MAP:
-                        continue
-
-                    feat_type = TYPE_MAP[feat.type]
-                    feat_name = str(feat.name.decode())
-                    feat_label = sensors.get_label(chip, feat)
-                    feat_limits = LIMITS.get(feat_type)
-                    sub_feat = next(sensors.SubFeatureIterator(chip, feat))  # current value
-
-                    if not sub_feat:
-                        continue
-
-                    try:
-                        v = sensors.get_value(chip, sub_feat.number)
-                    except sensors.SensorsError:
-                        continue
-
-                    if v is None:
-                        continue
-
-                    seen[chip_name][feat_type].append((feat_name, feat_label))
-
-                    if feat_limits and (v < feat_limits[0] or v > feat_limits[1]):
-                        continue
-
-                    data[chip_name + '_' + feat_name] = int(v * 1000)
-
-        except sensors.SensorsError as error:
-            self.error(error)
-            return None
-
-        self.update_sensors_charts(seen)
-
-        return data or None
-
-    def update_sensors_charts(self, seen):
-        for chip_name, feat in seen.items():
-            if self.chips and not any([chip_name.startswith(ex) for ex in self.chips]):
-                continue
-
-            for feat_type, sub_feat in feat.items():
-                if feat_type not in ORDER or feat_type not in CHARTS:
-                    continue
-
-                chart_id = '{}_{}'.format(chip_name, feat_type)
-                if chart_id in self.charts:
-                    continue
-
-                params = [chart_id] + list(CHARTS[feat_type]['options'])
-                new_chart = self.charts.add_chart(params)
-                new_chart.params['priority'] = self.get_chart_priority(feat_type)
-
-                for name, label in sub_feat:
-                    lines = list(CHARTS[feat_type]['lines'][0])
-                    lines[0] = chip_name + '_' + name
-                    lines[1] = label
-                    new_chart.add_dimension(lines)
-
-    def check(self):
-        try:
-            sensors.init()
-        except sensors.SensorsError as error:
-            self.error(error)
-            return False
-
-        self.priority = self.charts.priority
-
-        return bool(self.get_data() and self.charts)
-
-    def get_chart_priority(self, feat_type):
-        for i, v in enumerate(ORDER):
-            if v == feat_type:
-                return self.priority + i
-        return self.priority

+ 0 - 61
src/collectors/python.d.plugin/sensors/sensors.conf

@@ -1,61 +0,0 @@
-# netdata python.d.plugin configuration for sensors
-#
-# This file is in YaML format. Generally the format is:
-#
-# name: value
-#
-
-# ----------------------------------------------------------------------
-# Global Variables
-# These variables set the defaults for all JOBs, however each JOB
-# may define its own, overriding the defaults.
-
-# update_every sets the default data collection frequency.
-# If unset, the python.d.plugin default is used.
-# update_every: 1
-
-# priority controls the order of charts at the netdata dashboard.
-# Lower numbers move the charts towards the top of the page.
-# If unset, the default for python.d.plugin is used.
-# priority: 60000
-
-# penalty indicates whether to apply penalty to update_every in case of failures.
-# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes.
-# penalty: yes
-
-# autodetection_retry sets the job re-check interval in seconds.
-# The job is not deleted if check fails.
-# Attempts to start the job are made once every autodetection_retry.
-# This feature is disabled by default.
-# autodetection_retry: 0
-
-# ----------------------------------------------------------------------
-# Limit the number of sensors types.
-# Comment the ones you want to disable.
-# Also, re-arranging this list controls the order of the charts at the
-# netdata dashboard.
-
-types:
-  - temperature
-  - fan
-  - voltage
-  - current
-  - power
-  - energy
-  - humidity
-
-# ----------------------------------------------------------------------
-# Limit the number of sensors chips.
-# Uncomment the first line (chips:) and add chip names below it.
-# The chip names that start with like that will be matched.
-# You can find the chip names using the sensors command.
-
-#chips:
-#  - i8k
-#  - coretemp
-#
-# chip names can be found using the sensors shell command
-# the prefix is matched (anything that starts like that)
-#
-#----------------------------------------------------------------------
-