remove python.d/example (#18369)
Ilya Mashchenko committed
Aug 19, 2024 at 13:05 UTC
f1bf03ec668f8614690e42ed1b00276c577096d4
7 files changed
-484
CMakeLists.txt
-2
@@ -2780,7 +2780,6 @@ install(FILES
2780
src/collectors/python.d.plugin/boinc/boinc.conf
2781
src/collectors/python.d.plugin/ceph/ceph.conf
2782
src/collectors/python.d.plugin/changefinder/changefinder.conf
2783
- src/collectors/python.d.plugin/example/example.conf
2783
src/collectors/python.d.plugin/go_expvar/go_expvar.conf
2784
src/collectors/python.d.plugin/haproxy/haproxy.conf
2785
src/collectors/python.d.plugin/openldap/openldap.conf
@@ -2801,7 +2800,6 @@ install(FILES
2800
src/collectors/python.d.plugin/boinc/boinc.chart.py
2801
src/collectors/python.d.plugin/ceph/ceph.chart.py
2802
src/collectors/python.d.plugin/changefinder/changefinder.chart.py
2804
- src/collectors/python.d.plugin/example/example.chart.py
2803
src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
2804
src/collectors/python.d.plugin/haproxy/haproxy.chart.py
2805
src/collectors/python.d.plugin/openldap/openldap.chart.py
src/collectors/python.d.plugin/example/README.md
deleted
-1
@@ -1 +0,0 @@
1
-integrations/example_collector.md
\ No newline at end of file
src/collectors/python.d.plugin/example/example.chart.py
deleted
-51
@@ -1,51 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Description: example netdata python.d module
3
-# Author: Put your name here (your github login)
4
-# SPDX-License-Identifier: GPL-3.0-or-later
5
-
6
-from random import SystemRandom
7
-
8
-from bases.FrameworkServices.SimpleService import SimpleService
9
-
10
-priority = 90000
11
-
12
-ORDER = [
13
- 'random',
14
-]
15
-
16
-CHARTS = {
17
- 'random': {
18
- 'options': [None, 'A random number', 'random number', 'random', 'random', 'line'],
19
- 'lines': [
20
- ['random1']
21
- ]
22
- }
23
-}
24
-
25
-
26
-class Service(SimpleService):
27
- def __init__(self, configuration=None, name=None):
28
- SimpleService.__init__(self, configuration=configuration, name=name)
29
- self.order = ORDER
30
- self.definitions = CHARTS
31
- self.random = SystemRandom()
32
- self.num_lines = self.configuration.get('num_lines', 4)
33
- self.lower = self.configuration.get('lower', 0)
34
- self.upper = self.configuration.get('upper', 100)
35
-
36
- @staticmethod
37
- def check():
38
- return True
39
-
40
- def get_data(self):
41
- data = dict()
42
-
43
- for i in range(0, self.num_lines):
44
- dimension_id = ''.join(['random', str(i)])
45
-
46
- if dimension_id not in self.charts['random']:
47
- self.charts['random'].add_dimension([dimension_id])
48
-
49
- data[dimension_id] = self.random.randint(self.lower, self.upper)
50
-
51
- return data
src/collectors/python.d.plugin/example/example.conf
deleted
-87
@@ -1,87 +0,0 @@
1
-# netdata python.d.plugin configuration for example
2
-#
3
-# This file is in YaML format. Generally the format is:
4
-#
5
-# name: value
6
-#
7
-# There are 2 sections:
8
-# - global variables
9
-# - one or more JOBS
10
-#
11
-# JOBS allow you to collect values from multiple sources.
12
-# Each source will have its own set of charts.
13
-#
14
-# JOB parameters have to be indented (using spaces only, example below).
15
-
16
-# ----------------------------------------------------------------------
17
-# Global Variables
18
-# These variables set the defaults for all JOBs, however each JOB
19
-# may define its own, overriding the defaults.
20
-
21
-# update_every sets the default data collection frequency.
22
-# If unset, the python.d.plugin default is used.
23
-# update_every: 1
24
-
25
-# priority controls the order of charts at the netdata dashboard.
26
-# Lower numbers move the charts towards the top of the page.
27
-# If unset, the default for python.d.plugin is used.
28
-# priority: 60000
29
-
30
-# penalty indicates whether to apply penalty to update_every in case of failures.
31
-# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes.
32
-# penalty: yes
33
-
34
-# autodetection_retry sets the job re-check interval in seconds.
35
-# The job is not deleted if check fails.
36
-# Attempts to start the job are made once every autodetection_retry.
37
-# This feature is disabled by default.
38
-# autodetection_retry: 0
39
-
40
-# ----------------------------------------------------------------------
41
-# JOBS (data collection sources)
42
-#
43
-# The default JOBS share the same *name*. JOBS with the same name
44
-# are mutually exclusive. Only one of them will be allowed running at
45
-# any time. This allows autodetection to try several alternatives and
46
-# pick the one that works.
47
-#
48
-# Any number of jobs is supported.
49
-#
50
-# All python.d.plugin JOBS (for all its modules) support a set of
51
-# predefined parameters. These are:
52
-#
53
-# job_name:
54
-# name: myname # the JOB's name as it will appear on the dashboard
55
-# # dashboard (by default is the job_name)
56
-# # JOBs sharing a name are mutually exclusive
57
-# update_every: 1 # the JOB's data collection frequency
58
-# priority: 60000 # the JOB's order on the dashboard
59
-# penalty: yes # the JOB's penalty
60
-# autodetection_retry: 0 # the JOB's re-check interval in seconds
61
-#
62
-# Additionally to the above, example also supports the following:
63
-#
64
-# num_lines: 4 # the number of lines to create
65
-# lower: 0 # the lower bound of numbers to randomly sample from
66
-# upper: 100 # the upper bound of numbers to randomly sample from
67
-#
68
-# ----------------------------------------------------------------------
69
-# AUTO-DETECTION JOBS
70
-
71
-four_lines:
72
- name: "Four Lines" # the JOB's name as it will appear on the dashboard
73
- update_every: 1 # the JOB's data collection frequency
74
- priority: 60000 # the JOB's order on the dashboard
75
- penalty: yes # the JOB's penalty
76
- autodetection_retry: 0 # the JOB's re-check interval in seconds
77
- num_lines: 4 # the number of lines to create
78
- lower: 0 # the lower bound of numbers to randomly sample from
79
- upper: 100 # the upper bound of numbers to randomly sample from
80
-
81
-# if you wanted to make another job to run in addition to the one above then
82
-# you would just uncomment the job configuration below.
83
-# two_lines:
84
-# name: "Two Lines" # the JOB's name as it will appear on the dashboard
85
-# num_lines: 2 # the number of lines to create
86
-# lower: 50 # the lower bound of numbers to randomly sample from
87
-# upper: 75 # the upper bound of numbers to randomly sample from
src/collectors/python.d.plugin/example/integrations/example_collector.md
deleted
-204
@@ -1,204 +0,0 @@
1
-<!--startmeta
2
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/example/README.md"
3
-meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/example/metadata.yaml"
4
-sidebar_label: "Example collector"
5
-learn_status: "Published"
6
-learn_rel_path: "Collecting Metrics/Other"
7
-most_popular: False
8
-message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
9
-endmeta-->
10
-
11
-# Example collector
12
-
13
-Plugin: python.d.plugin
14
-Module: example
15
-
16
-<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
17
-
18
-## Overview
19
-
20
-Example collector that generates some random numbers as metrics.
21
-
22
-If you want to write your own collector, read our [writing a new Python module](/src/collectors/python.d.plugin/README.md#how-to-write-a-new-module) tutorial.
23
-
24
-
25
-The `get_data()` function uses `random.randint()` to generate a random number which will be collected as a metric.
26
-
27
-
28
-This collector is supported on all platforms.
29
-
30
-This collector supports collecting metrics from multiple instances of this integration, including remote instances.
31
-
32
-
33
-### Default Behavior
34
-
35
-#### Auto-Detection
36
-
37
-This integration doesn't support auto-detection.
38
-
39
-#### Limits
40
-
41
-The default configuration for this integration does not impose any limits on data collection.
42
-
43
-#### Performance Impact
44
-
45
-The default configuration for this integration is not expected to impose a significant performance impact on the system.
46
-
47
-
48
-## Metrics
49
-
50
-Metrics grouped by *scope*.
51
-
52
-The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
53
-
54
-
55
-
56
-### Per Example collector instance
57
-
58
-These metrics refer to the entire monitored application.
59
-
60
-
61
-This scope has no labels.
62
-
63
-Metrics:
64
-
65
-| Metric | Dimensions | Unit |
66
-|:------|:----------|:----|
67
-| example.random | random | number |
68
-
69
-
70
-
71
-## Alerts
72
-
73
-There are no alerts configured by default for this integration.
74
-
75
-
76
-## Setup
77
-
78
-### Prerequisites
79
-
80
-No action required.
81
-
82
-### Configuration
83
-
84
-#### File
85
-
86
-The configuration file name for this integration is `python.d/example.conf`.
87
-
88
-
89
-You can edit the configuration file using the `edit-config` script from the
90
-Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
91
-
92
-```bash
93
-cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
94
-sudo ./edit-config python.d/example.conf
95
-```
96
-#### Options
97
-
98
-There are 2 sections:
99
-
100
-* Global variables
101
-* One or more JOBS that can define multiple different instances to monitor.
102
-
103
-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.
104
-
105
-Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
106
-
107
-Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
108
-
109
-
110
-<details open><summary>Config options</summary>
111
-
112
-| Name | Description | Default | Required |
113
-|:----|:-----------|:-------|:--------:|
114
-| num_lines | The number of lines to create. | 4 | no |
115
-| lower | The lower bound of numbers to randomly sample from. | 0 | no |
116
-| upper | The upper bound of numbers to randomly sample from. | 100 | no |
117
-| update_every | Sets the default data collection frequency. | 1 | no |
118
-| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
119
-| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
120
-| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
121
-| name | Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works. | | no |
122
-
123
-</details>
124
-
125
-#### Examples
126
-
127
-##### Basic
128
-
129
-A basic example configuration.
130
-
131
-```yaml
132
-four_lines:
133
- name: "Four Lines"
134
- update_every: 1
135
- priority: 60000
136
- penalty: yes
137
- autodetection_retry: 0
138
- num_lines: 4
139
- lower: 0
140
- upper: 100
141
-
142
-```
143
-
144
-
145
-## Troubleshooting
146
-
147
-### Debug Mode
148
-
149
-To troubleshoot issues with the `example` collector, run the `python.d.plugin` with the debug option enabled. The output
150
-should give you clues as to why the collector isn't working.
151
-
152
-- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
153
- your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
154
-
155
- ```bash
156
- cd /usr/libexec/netdata/plugins.d/
157
- ```
158
-
159
-- Switch to the `netdata` user.
160
-
161
- ```bash
162
- sudo -u netdata -s
163
- ```
164
-
165
-- Run the `python.d.plugin` to debug the collector:
166
-
167
- ```bash
168
- ./python.d.plugin example debug trace
169
- ```
170
-
171
-### Getting Logs
172
-
173
-If you're encountering problems with the `example` collector, follow these steps to retrieve logs and identify potential issues:
174
-
175
-- **Run the command** specific to your system (systemd, non-systemd, or Docker container).
176
-- **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.
177
-
178
-#### System with systemd
179
-
180
-Use the following command to view logs generated since the last Netdata service restart:
181
-
182
-```bash
183
-journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep example
184
-```
185
-
186
-#### System without systemd
187
-
188
-Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name:
189
-
190
-```bash
191
-grep example /var/log/netdata/collector.log
192
-```
193
-
194
-**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues.
195
-
196
-#### Docker Container
197
-
198
-If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
199
-
200
-```bash
201
-docker logs netdata 2>&1 | grep example
202
-```
203
-
204
-
src/collectors/python.d.plugin/example/metadata.yaml
deleted
-138
@@ -1,138 +0,0 @@
1
-plugin_name: python.d.plugin
2
-modules:
3
- - meta:
4
- plugin_name: python.d.plugin
5
- module_name: example
6
- monitored_instance:
7
- name: Example collector
8
- link: /src/collectors/python.d.plugin/example/README.md
9
- categories:
10
- - data-collection.other
11
- icon_filename: ""
12
- related_resources:
13
- integrations:
14
- list: []
15
- info_provided_to_referring_integrations:
16
- description: ""
17
- keywords:
18
- - example
19
- - netdata
20
- - python
21
- most_popular: false
22
- overview:
23
- data_collection:
24
- metrics_description: |
25
- Example collector that generates some random numbers as metrics.
26
-
27
- If you want to write your own collector, read our [writing a new Python module](/src/collectors/python.d.plugin/README.md#how-to-write-a-new-module) tutorial.
28
- method_description: |
29
- The `get_data()` function uses `random.randint()` to generate a random number which will be collected as a metric.
30
- supported_platforms:
31
- include: []
32
- exclude: []
33
- multi_instance: true
34
- additional_permissions:
35
- description: ""
36
- default_behavior:
37
- auto_detection:
38
- description: ""
39
- limits:
40
- description: ""
41
- performance_impact:
42
- description: ""
43
- setup:
44
- prerequisites:
45
- list: []
46
- configuration:
47
- file:
48
- name: python.d/example.conf
49
- description: ""
50
- options:
51
- description: |
52
- There are 2 sections:
53
-
54
- * Global variables
55
- * One or more JOBS that can define multiple different instances to monitor.
56
-
57
- 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.
58
-
59
- Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
60
-
61
- Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
62
- folding:
63
- title: Config options
64
- enabled: true
65
- list:
66
- - name: num_lines
67
- description: The number of lines to create.
68
- default_value: 4
69
- required: false
70
- - name: lower
71
- description: The lower bound of numbers to randomly sample from.
72
- default_value: 0
73
- required: false
74
- - name: upper
75
- description: The upper bound of numbers to randomly sample from.
76
- default_value: 100
77
- required: false
78
- - name: update_every
79
- description: Sets the default data collection frequency.
80
- default_value: 1
81
- required: false
82
- - name: priority
83
- description: Controls the order of charts at the netdata dashboard.
84
- default_value: 60000
85
- required: false
86
- - name: autodetection_retry
87
- description: Sets the job re-check interval in seconds.
88
- default_value: 0
89
- required: false
90
- - name: penalty
91
- description: Indicates whether to apply penalty to update_every in case of failures.
92
- default_value: yes
93
- required: false
94
- - name: name
95
- description: Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works.
96
- default_value: ""
97
- required: false
98
- examples:
99
- folding:
100
- enabled: true
101
- title: Config
102
- list:
103
- - name: Basic
104
- folding:
105
- enabled: false
106
- description: A basic example configuration.
107
- config: |
108
- four_lines:
109
- name: "Four Lines"
110
- update_every: 1
111
- priority: 60000
112
- penalty: yes
113
- autodetection_retry: 0
114
- num_lines: 4
115
- lower: 0
116
- upper: 100
117
- troubleshooting:
118
- problems:
119
- list: []
120
- alerts: []
121
- metrics:
122
- folding:
123
- title: Metrics
124
- enabled: false
125
- description: ""
126
- availability: []
127
- scopes:
128
- - name: global
129
- description: |
130
- These metrics refer to the entire monitored application.
131
- labels: []
132
- metrics:
133
- - name: example.random
134
- description: A random number
135
- unit: number
136
- chart_type: line
137
- dimensions:
138
- - name: random
src/collectors/python.d.plugin/python.d.conf
-1
@@ -31,7 +31,6 @@ gc_interval: 300
31
# ceph: yes
32
# changefinder: no
33
# this is just an example
34
-example: no
34
go_expvar: no
35
# haproxy: yes
36
# openldap: yes