remove python.d/monit (#18343)
Ilya Mashchenko committed
Aug 16, 2024 at 16:29 UTC
355febff639a4941cf6f61d21afe5efb92f75d38
6 files changed
-913
CMakeLists.txt
-2
@@ -2783,7 +2783,6 @@ install(FILES
2783
src/collectors/python.d.plugin/example/example.conf
2784
src/collectors/python.d.plugin/go_expvar/go_expvar.conf
2785
src/collectors/python.d.plugin/haproxy/haproxy.conf
2786
- src/collectors/python.d.plugin/monit/monit.conf
2786
src/collectors/python.d.plugin/openldap/openldap.conf
2787
src/collectors/python.d.plugin/oracledb/oracledb.conf
2788
src/collectors/python.d.plugin/pandas/pandas.conf
@@ -2807,7 +2806,6 @@ install(FILES
2806
src/collectors/python.d.plugin/example/example.chart.py
2807
src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
2808
src/collectors/python.d.plugin/haproxy/haproxy.chart.py
2810
- src/collectors/python.d.plugin/monit/monit.chart.py
2809
src/collectors/python.d.plugin/openldap/openldap.chart.py
2810
src/collectors/python.d.plugin/oracledb/oracledb.chart.py
2811
src/collectors/python.d.plugin/pandas/pandas.chart.py
src/collectors/python.d.plugin/monit/README.md
deleted
-1
@@ -1 +0,0 @@
1
-integrations/monit.md
\ No newline at end of file
src/collectors/python.d.plugin/monit/integrations/monit.md
deleted
-247
@@ -1,247 +0,0 @@
1
-<!--startmeta
2
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/monit/README.md"
3
-meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/monit/metadata.yaml"
4
-sidebar_label: "Monit"
5
-learn_status: "Published"
6
-learn_rel_path: "Collecting Metrics/Synthetic Checks"
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
-# Monit
12
-
13
-
14
-<img src="https://netdata.cloud/img/monit.png" width="150"/>
15
-
16
-
17
-Plugin: python.d.plugin
18
-Module: monit
19
-
20
-<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21
-
22
-## Overview
23
-
24
-This collector monitors Monit targets such as filesystems, directories, files, FIFO pipes and more.
25
-
26
-
27
-It gathers data from Monit's XML interface.
28
-
29
-
30
-This collector is supported on all platforms.
31
-
32
-This collector supports collecting metrics from multiple instances of this integration, including remote instances.
33
-
34
-
35
-### Default Behavior
36
-
37
-#### Auto-Detection
38
-
39
-By default, this collector will attempt to connect to Monit at `http://localhost:2812`
40
-
41
-#### Limits
42
-
43
-The default configuration for this integration does not impose any limits on data collection.
44
-
45
-#### Performance Impact
46
-
47
-The default configuration for this integration is not expected to impose a significant performance impact on the system.
48
-
49
-
50
-## Metrics
51
-
52
-Metrics grouped by *scope*.
53
-
54
-The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
55
-
56
-
57
-
58
-### Per Monit instance
59
-
60
-These metrics refer to the entire monitored application.
61
-
62
-This scope has no labels.
63
-
64
-Metrics:
65
-
66
-| Metric | Dimensions | Unit |
67
-|:------|:----------|:----|
68
-| monit.filesystems | a dimension per target | filesystems |
69
-| monit.directories | a dimension per target | directories |
70
-| monit.files | a dimension per target | files |
71
-| monit.fifos | a dimension per target | pipes |
72
-| monit.programs | a dimension per target | programs |
73
-| monit.services | a dimension per target | processes |
74
-| monit.process_uptime | a dimension per target | seconds |
75
-| monit.process_threads | a dimension per target | threads |
76
-| monit.process_childrens | a dimension per target | children |
77
-| monit.hosts | a dimension per target | hosts |
78
-| monit.host_latency | a dimension per target | milliseconds |
79
-| monit.networks | a dimension per target | interfaces |
80
-
81
-
82
-
83
-## Alerts
84
-
85
-There are no alerts configured by default for this integration.
86
-
87
-
88
-## Setup
89
-
90
-### Prerequisites
91
-
92
-No action required.
93
-
94
-### Configuration
95
-
96
-#### File
97
-
98
-The configuration file name for this integration is `python.d/monit.conf`.
99
-
100
-
101
-You can edit the configuration file using the `edit-config` script from the
102
-Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
103
-
104
-```bash
105
-cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
106
-sudo ./edit-config python.d/monit.conf
107
-```
108
-#### Options
109
-
110
-There are 2 sections:
111
-
112
-* Global variables
113
-* One or more JOBS that can define multiple different instances to monitor.
114
-
115
-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.
116
-
117
-Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
118
-
119
-Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
120
-
121
-
122
-<details open><summary>Config options</summary>
123
-
124
-| Name | Description | Default | Required |
125
-|:----|:-----------|:-------|:--------:|
126
-| update_every | Sets the default data collection frequency. | 1 | no |
127
-| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
128
-| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
129
-| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
130
-| 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. | local | no |
131
-| url | The URL to fetch Monit's metrics. | http://localhost:2812 | yes |
132
-| user | Username in case the URL is password protected. | | no |
133
-| pass | Password in case the URL is password protected. | | no |
134
-
135
-</details>
136
-
137
-#### Examples
138
-
139
-##### Basic
140
-
141
-A basic configuration example.
142
-
143
-```yaml
144
-localhost:
145
- name : 'local'
146
- url : 'http://localhost:2812'
147
-
148
-```
149
-##### Basic Authentication
150
-
151
-Example using basic username and password in order to authenticate.
152
-
153
-<details open><summary>Config</summary>
154
-
155
-```yaml
156
-localhost:
157
- name : 'local'
158
- url : 'http://localhost:2812'
159
- user: 'foo'
160
- pass: 'bar'
161
-
162
-```
163
-</details>
164
-
165
-##### Multi-instance
166
-
167
-> **Note**: When you define multiple jobs, their names must be unique.
168
-
169
-Collecting metrics from local and remote instances.
170
-
171
-
172
-<details open><summary>Config</summary>
173
-
174
-```yaml
175
-localhost:
176
- name: 'local'
177
- url: 'http://localhost:2812'
178
-
179
-remote_job:
180
- name: 'remote'
181
- url: 'http://192.0.2.1:2812'
182
-
183
-```
184
-</details>
185
-
186
-
187
-
188
-## Troubleshooting
189
-
190
-### Debug Mode
191
-
192
-To troubleshoot issues with the `monit` collector, run the `python.d.plugin` with the debug option enabled. The output
193
-should give you clues as to why the collector isn't working.
194
-
195
-- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
196
- your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
197
-
198
- ```bash
199
- cd /usr/libexec/netdata/plugins.d/
200
- ```
201
-
202
-- Switch to the `netdata` user.
203
-
204
- ```bash
205
- sudo -u netdata -s
206
- ```
207
-
208
-- Run the `python.d.plugin` to debug the collector:
209
-
210
- ```bash
211
- ./python.d.plugin monit debug trace
212
- ```
213
-
214
-### Getting Logs
215
-
216
-If you're encountering problems with the `monit` collector, follow these steps to retrieve logs and identify potential issues:
217
-
218
-- **Run the command** specific to your system (systemd, non-systemd, or Docker container).
219
-- **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.
220
-
221
-#### System with systemd
222
-
223
-Use the following command to view logs generated since the last Netdata service restart:
224
-
225
-```bash
226
-journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep monit
227
-```
228
-
229
-#### System without systemd
230
-
231
-Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name:
232
-
233
-```bash
234
-grep monit /var/log/netdata/collector.log
235
-```
236
-
237
-**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues.
238
-
239
-#### Docker Container
240
-
241
-If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
242
-
243
-```bash
244
-docker logs netdata 2>&1 | grep monit
245
-```
246
-
247
-
src/collectors/python.d.plugin/monit/metadata.yaml
deleted
-217
@@ -1,217 +0,0 @@
1
-plugin_name: python.d.plugin
2
-modules:
3
- - meta:
4
- plugin_name: python.d.plugin
5
- module_name: monit
6
- monitored_instance:
7
- name: Monit
8
- link: https://mmonit.com/monit/
9
- categories:
10
- - data-collection.synthetic-checks
11
- icon_filename: "monit.png"
12
- related_resources:
13
- integrations:
14
- list: []
15
- info_provided_to_referring_integrations:
16
- description: ""
17
- keywords:
18
- - monit
19
- - mmonit
20
- - supervision tool
21
- - monitrc
22
- most_popular: false
23
- overview:
24
- data_collection:
25
- metrics_description: |
26
- This collector monitors Monit targets such as filesystems, directories, files, FIFO pipes and more.
27
- method_description: |
28
- It gathers data from Monit's XML interface.
29
- supported_platforms:
30
- include: []
31
- exclude: []
32
- multi_instance: true
33
- additional_permissions:
34
- description: ""
35
- default_behavior:
36
- auto_detection:
37
- description: By default, this collector will attempt to connect to Monit at `http://localhost:2812`
38
- limits:
39
- description: ""
40
- performance_impact:
41
- description: ""
42
- setup:
43
- prerequisites:
44
- list: []
45
- configuration:
46
- file:
47
- name: "python.d/monit.conf"
48
- options:
49
- description: |
50
- There are 2 sections:
51
-
52
- * Global variables
53
- * One or more JOBS that can define multiple different instances to monitor.
54
-
55
- 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.
56
-
57
- Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
58
-
59
- Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
60
- folding:
61
- title: "Config options"
62
- enabled: true
63
- list:
64
- - name: update_every
65
- description: Sets the default data collection frequency.
66
- default_value: 1
67
- required: false
68
- - name: priority
69
- description: Controls the order of charts at the netdata dashboard.
70
- default_value: 60000
71
- required: false
72
- - name: autodetection_retry
73
- description: Sets the job re-check interval in seconds.
74
- default_value: 0
75
- required: false
76
- - name: penalty
77
- description: Indicates whether to apply penalty to update_every in case of failures.
78
- default_value: yes
79
- required: false
80
- - name: name
81
- description: >
82
- 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.
83
- default_value: "local"
84
- required: false
85
- - name: url
86
- description: The URL to fetch Monit's metrics.
87
- default_value: http://localhost:2812
88
- required: true
89
- - name: user
90
- description: Username in case the URL is password protected.
91
- default_value: ""
92
- required: false
93
- - name: pass
94
- description: Password in case the URL is password protected.
95
- default_value: ""
96
- required: false
97
- examples:
98
- folding:
99
- enabled: true
100
- title: "Config"
101
- list:
102
- - name: Basic
103
- description: A basic configuration example.
104
- folding:
105
- enabled: false
106
- config: |
107
- localhost:
108
- name : 'local'
109
- url : 'http://localhost:2812'
110
- - name: Basic Authentication
111
- description: Example using basic username and password in order to authenticate.
112
- config: |
113
- localhost:
114
- name : 'local'
115
- url : 'http://localhost:2812'
116
- user: 'foo'
117
- pass: 'bar'
118
- - name: Multi-instance
119
- description: |
120
- > **Note**: When you define multiple jobs, their names must be unique.
121
-
122
- Collecting metrics from local and remote instances.
123
- config: |
124
- localhost:
125
- name: 'local'
126
- url: 'http://localhost:2812'
127
-
128
- remote_job:
129
- name: 'remote'
130
- url: 'http://192.0.2.1:2812'
131
- troubleshooting:
132
- problems:
133
- list: []
134
- alerts: []
135
- metrics:
136
- folding:
137
- title: Metrics
138
- enabled: false
139
- description: ""
140
- availability: []
141
- scopes:
142
- - name: global
143
- description: "These metrics refer to the entire monitored application."
144
- labels: []
145
- metrics:
146
- - name: monit.filesystems
147
- description: Filesystems
148
- unit: "filesystems"
149
- chart_type: line
150
- dimensions:
151
- - name: a dimension per target
152
- - name: monit.directories
153
- description: Directories
154
- unit: "directories"
155
- chart_type: line
156
- dimensions:
157
- - name: a dimension per target
158
- - name: monit.files
159
- description: Files
160
- unit: "files"
161
- chart_type: line
162
- dimensions:
163
- - name: a dimension per target
164
- - name: monit.fifos
165
- description: Pipes (fifo)
166
- unit: "pipes"
167
- chart_type: line
168
- dimensions:
169
- - name: a dimension per target
170
- - name: monit.programs
171
- description: Programs statuses
172
- unit: "programs"
173
- chart_type: line
174
- dimensions:
175
- - name: a dimension per target
176
- - name: monit.services
177
- description: Processes statuses
178
- unit: "processes"
179
- chart_type: line
180
- dimensions:
181
- - name: a dimension per target
182
- - name: monit.process_uptime
183
- description: Processes uptime
184
- unit: "seconds"
185
- chart_type: line
186
- dimensions:
187
- - name: a dimension per target
188
- - name: monit.process_threads
189
- description: Processes threads
190
- unit: "threads"
191
- chart_type: line
192
- dimensions:
193
- - name: a dimension per target
194
- - name: monit.process_childrens
195
- description: Child processes
196
- unit: "children"
197
- chart_type: line
198
- dimensions:
199
- - name: a dimension per target
200
- - name: monit.hosts
201
- description: Hosts
202
- unit: "hosts"
203
- chart_type: line
204
- dimensions:
205
- - name: a dimension per target
206
- - name: monit.host_latency
207
- description: Hosts latency
208
- unit: "milliseconds"
209
- chart_type: line
210
- dimensions:
211
- - name: a dimension per target
212
- - name: monit.networks
213
- description: Network interfaces and addresses
214
- unit: "interfaces"
215
- chart_type: line
216
- dimensions:
217
- - name: a dimension per target
src/collectors/python.d.plugin/monit/monit.chart.py
deleted
-360
@@ -1,360 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Description: monit netdata python.d module
3
-# Author: Evgeniy K. (n0guest)
4
-# SPDX-License-Identifier: GPL-3.0-or-later
5
-
6
-import xml.etree.ElementTree as ET
7
-from collections import namedtuple
8
-
9
-from bases.FrameworkServices.UrlService import UrlService
10
-
11
-MonitType = namedtuple('MonitType', ('index', 'name'))
12
-
13
-# see enum Service_Type from monit.h (https://bitbucket.org/tildeslash/monit/src/master/src/monit.h)
14
-# typedef enum {
15
-# Service_Filesystem = 0,
16
-# Service_Directory,
17
-# Service_File,
18
-# Service_Process,
19
-# Service_Host,
20
-# Service_System,
21
-# Service_Fifo,
22
-# Service_Program,
23
-# Service_Net,
24
-# Service_Last = Service_Net
25
-# } __attribute__((__packed__)) Service_Type;
26
-
27
-TYPE_FILESYSTEM = MonitType(0, 'filesystem')
28
-TYPE_DIRECTORY = MonitType(1, 'directory')
29
-TYPE_FILE = MonitType(2, 'file')
30
-TYPE_PROCESS = MonitType(3, 'process')
31
-TYPE_HOST = MonitType(4, 'host')
32
-TYPE_SYSTEM = MonitType(5, 'system')
33
-TYPE_FIFO = MonitType(6, 'fifo')
34
-TYPE_PROGRAM = MonitType(7, 'program')
35
-TYPE_NET = MonitType(8, 'net')
36
-
37
-TYPES = (
38
- TYPE_FILESYSTEM,
39
- TYPE_DIRECTORY,
40
- TYPE_FILE,
41
- TYPE_PROCESS,
42
- TYPE_HOST,
43
- TYPE_SYSTEM,
44
- TYPE_FIFO,
45
- TYPE_PROGRAM,
46
- TYPE_NET,
47
-)
48
-
49
-# charts order (can be overridden if you want less charts, or different order)
50
-ORDER = [
51
- 'filesystem',
52
- 'directory',
53
- 'file',
54
- 'process',
55
- 'process_uptime',
56
- 'process_threads',
57
- 'process_children',
58
- 'host',
59
- 'host_latency',
60
- 'system',
61
- 'fifo',
62
- 'program',
63
- 'net'
64
-]
65
-
66
-CHARTS = {
67
- 'filesystem': {
68
- 'options': ['filesystems', 'Filesystems', 'filesystems', 'filesystem', 'monit.filesystems', 'line'],
69
- 'lines': []
70
- },
71
- 'directory': {
72
- 'options': ['directories', 'Directories', 'directories', 'filesystem', 'monit.directories', 'line'],
73
- 'lines': []
74
- },
75
- 'file': {
76
- 'options': ['files', 'Files', 'files', 'filesystem', 'monit.files', 'line'],
77
- 'lines': []
78
- },
79
- 'fifo': {
80
- 'options': ['fifos', 'Pipes (fifo)', 'pipes', 'filesystem', 'monit.fifos', 'line'],
81
- 'lines': []
82
- },
83
- 'program': {
84
- 'options': ['programs', 'Programs statuses', 'programs', 'applications', 'monit.programs', 'line'],
85
- 'lines': []
86
- },
87
- 'process': {
88
- 'options': ['processes', 'Processes statuses', 'processes', 'applications', 'monit.services', 'line'],
89
- 'lines': []
90
- },
91
- 'process_uptime': {
92
- 'options': ['processes uptime', 'Processes uptime', 'seconds', 'applications',
93
- 'monit.process_uptime', 'line', 'hidden'],
94
- 'lines': []
95
- },
96
- 'process_threads': {
97
- 'options': ['processes threads', 'Processes threads', 'threads', 'applications',
98
- 'monit.process_threads', 'line'],
99
- 'lines': []
100
- },
101
- 'process_children': {
102
- 'options': ['processes childrens', 'Child processes', 'children', 'applications',
103
- 'monit.process_childrens', 'line'],
104
- 'lines': []
105
- },
106
- 'host': {
107
- 'options': ['hosts', 'Hosts', 'hosts', 'network', 'monit.hosts', 'line'],
108
- 'lines': []
109
- },
110
- 'host_latency': {
111
- 'options': ['hosts latency', 'Hosts latency', 'milliseconds', 'network', 'monit.host_latency', 'line'],
112
- 'lines': []
113
- },
114
- 'net': {
115
- 'options': ['interfaces', 'Network interfaces and addresses', 'interfaces', 'network',
116
- 'monit.networks', 'line'],
117
- 'lines': []
118
- },
119
-}
120
-
121
-
122
-class BaseMonitService(object):
123
- def __init__(self, typ, name, status, monitor):
124
- self.type = typ
125
- self.name = name
126
- self.status = status
127
- self.monitor = monitor
128
-
129
- def __repr__(self):
130
- return 'MonitService({0}:{1})'.format(self.type.name, self.name)
131
-
132
- def __eq__(self, other):
133
- if not isinstance(other, BaseMonitService):
134
- return False
135
- return self.type == other.type and self.name == other.name
136
-
137
- def __ne__(self, other):
138
- return not self == other
139
-
140
- def __hash__(self):
141
- return hash(repr(self))
142
-
143
- def is_running(self):
144
- return self.status == '0' and self.monitor == '1'
145
-
146
- def key(self):
147
- return '{0}_{1}'.format(self.type.name, self.name)
148
-
149
- def data(self):
150
- return {self.key(): int(self.is_running())}
151
-
152
-
153
-class ProcessMonitService(BaseMonitService):
154
- def __init__(self, typ, name, status, monitor):
155
- super(ProcessMonitService, self).__init__(typ, name, status, monitor)
156
- self.uptime = None
157
- self.threads = None
158
- self.children = None
159
-
160
- def __eq__(self, other):
161
- return super(ProcessMonitService, self).__eq__(other)
162
-
163
- def __ne__(self, other):
164
- return super(ProcessMonitService, self).__ne__(other)
165
-
166
- def __hash__(self):
167
- return super(ProcessMonitService, self).__hash__()
168
-
169
- def uptime_key(self):
170
- return 'process_uptime_{0}'.format(self.name)
171
-
172
- def threads_key(self):
173
- return 'process_threads_{0}'.format(self.name)
174
-
175
- def children_key(self):
176
- return 'process_children_{0}'.format(self.name)
177
-
178
- def data(self):
179
- base_data = super(ProcessMonitService, self).data()
180
- # skipping bugged metrics with negative uptime (monit before v5.16)
181
- uptime = self.uptime if self.uptime and int(self.uptime) >= 0 else None
182
- data = {
183
- self.uptime_key(): uptime,
184
- self.threads_key(): self.threads,
185
- self.children_key(): self.children,
186
- }
187
- data.update(base_data)
188
-
189
- return data
190
-
191
-
192
-class HostMonitService(BaseMonitService):
193
- def __init__(self, typ, name, status, monitor):
194
- super(HostMonitService, self).__init__(typ, name, status, monitor)
195
- self.latency = None
196
-
197
- def __eq__(self, other):
198
- return super(HostMonitService, self).__eq__(other)
199
-
200
- def __ne__(self, other):
201
- return super(HostMonitService, self).__ne__(other)
202
-
203
- def __hash__(self):
204
- return super(HostMonitService, self).__hash__()
205
-
206
- def latency_key(self):
207
- return 'host_latency_{0}'.format(self.name)
208
-
209
- def data(self):
210
- base_data = super(HostMonitService, self).data()
211
- latency = float(self.latency) * 1000000 if self.latency else None
212
- data = {self.latency_key(): latency}
213
- data.update(base_data)
214
-
215
- return data
216
-
217
-
218
-class Service(UrlService):
219
- def __init__(self, configuration=None, name=None):
220
- UrlService.__init__(self, configuration=configuration, name=name)
221
- self.order = ORDER
222
- self.definitions = CHARTS
223
- base_url = self.configuration.get('url', "http://localhost:2812")
224
- self.url = '{0}/_status?format=xml&level=full'.format(base_url)
225
- self.active_services = list()
226
-
227
- def parse(self, raw):
228
- try:
229
- root = ET.fromstring(raw)
230
- except ET.ParseError:
231
- self.error("URL {0} didn't return a valid XML page. Please check your settings.".format(self.url))
232
- return None
233
- return root
234
-
235
- def _get_data(self):
236
- raw = self._get_raw_data()
237
- if not raw:
238
- return None
239
-
240
- root = self.parse(raw)
241
- if root is None:
242
- return None
243
-
244
- services = self.get_services(root)
245
- if not services:
246
- return None
247
-
248
- if len(self.charts) > 0:
249
- self.update_charts(services)
250
-
251
- data = dict()
252
-
253
- for svc in services:
254
- data.update(svc.data())
255
-
256
- return data
257
-
258
- def get_services(self, root):
259
- services = list()
260
-
261
- for typ in TYPES:
262
- if typ == TYPE_SYSTEM:
263
- self.debug("skipping service from '{0}' category, it's useless in graphs".format(TYPE_SYSTEM.name))
264
- continue
265
-
266
- xpath_query = "./service[@type='{0}']".format(typ.index)
267
- self.debug('Searching for {0} as {1}'.format(typ.name, xpath_query))
268
-
269
- for svc_root in root.findall(xpath_query):
270
- svc = create_service(svc_root, typ)
271
- self.debug('=> found {0} with type={1}, status={2}, monitoring={3}'.format(
272
- svc.name, svc.type.name, svc.status, svc.monitor))
273
-
274
- services.append(svc)
275
-
276
- return services
277
-
278
- def update_charts(self, services):
279
- remove = [svc for svc in self.active_services if svc not in services]
280
- add = [svc for svc in services if svc not in self.active_services]
281
-
282
- self.remove_services_from_charts(remove)
283
- self.add_services_to_charts(add)
284
-
285
- self.active_services = services
286
-
287
- def add_services_to_charts(self, services):
288
- for svc in services:
289
- if svc.type == TYPE_HOST:
290
- self.charts['host_latency'].add_dimension([svc.latency_key(), svc.name, 'absolute', 1000, 1000000])
291
- if svc.type == TYPE_PROCESS:
292
- self.charts['process_uptime'].add_dimension([svc.uptime_key(), svc.name])
293
- self.charts['process_threads'].add_dimension([svc.threads_key(), svc.name])
294
- self.charts['process_children'].add_dimension([svc.children_key(), svc.name])
295
- self.charts[svc.type.name].add_dimension([svc.key(), svc.name])
296
-
297
- def remove_services_from_charts(self, services):
298
- for svc in services:
299
- if svc.type == TYPE_HOST:
300
- self.charts['host_latency'].del_dimension(svc.latency_key(), False)
301
- if svc.type == TYPE_PROCESS:
302
- self.charts['process_uptime'].del_dimension(svc.uptime_key(), False)
303
- self.charts['process_threads'].del_dimension(svc.threads_key(), False)
304
- self.charts['process_children'].del_dimension(svc.children_key(), False)
305
- self.charts[svc.type.name].del_dimension(svc.key(), False)
306
-
307
-
308
-def create_service(root, typ):
309
- if typ == TYPE_HOST:
310
- return create_host_service(root)
311
- elif typ == TYPE_PROCESS:
312
- return create_process_service(root)
313
- return create_base_service(root, typ)
314
-
315
-
316
-def create_host_service(root):
317
- svc = HostMonitService(
318
- TYPE_HOST,
319
- root.find('name').text,
320
- root.find('status').text,
321
- root.find('monitor').text,
322
- )
323
-
324
- latency = root.find('./icmp/responsetime')
325
- if latency is not None:
326
- svc.latency = latency.text
327
-
328
- return svc
329
-
330
-
331
-def create_process_service(root):
332
- svc = ProcessMonitService(
333
- TYPE_PROCESS,
334
- root.find('name').text,
335
- root.find('status').text,
336
- root.find('monitor').text,
337
- )
338
-
339
- uptime = root.find('uptime')
340
- if uptime is not None:
341
- svc.uptime = uptime.text
342
-
343
- threads = root.find('threads')
344
- if threads is not None:
345
- svc.threads = threads.text
346
-
347
- children = root.find('children')
348
- if children is not None:
349
- svc.children = children.text
350
-
351
- return svc
352
-
353
-
354
-def create_base_service(root, typ):
355
- return BaseMonitService(
356
- typ,
357
- root.find('name').text,
358
- root.find('status').text,
359
- root.find('monitor').text,
360
- )
src/collectors/python.d.plugin/monit/monit.conf
deleted
-86
@@ -1,86 +0,0 @@
1
-# netdata python.d.plugin configuration for monit
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 at the
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, this plugin also supports the following:
63
-#
64
-# url: 'URL' # the URL to fetch monit's status stats
65
-#
66
-# if the URL is password protected, the following are supported:
67
-#
68
-# user: 'username'
69
-# pass: 'password'
70
-#
71
-# Example
72
-#
73
-# local:
74
-# name : 'Local Monit'
75
-# url : 'http://localhost:2812'
76
-#
77
-# "local" will show up in Netdata logs. "Reverse Proxy" will show up in the menu
78
-# in the monit section.
79
-
80
-# ----------------------------------------------------------------------
81
-# AUTO-DETECTION JOBS
82
-# only one of them will run (they have the same name)
83
-
84
-localhost:
85
- name : 'local'
86
- url : 'http://localhost:2812'