remove python implementation of oracledb (#18651)
Fotis Voutsas committed
Oct 3, 2024 at 12:39 UTC
08eba073b47f32eea9d59fa0b5db0b197a83c157
7 files changed
+1
-1507
CMakeLists.txt
-2
@@ -2945,7 +2945,6 @@ if(ENABLE_PLUGIN_PYTHON)
2945
src/collectors/python.d.plugin/am2320/am2320.conf
2946
src/collectors/python.d.plugin/go_expvar/go_expvar.conf
2947
src/collectors/python.d.plugin/haproxy/haproxy.conf
2948
- src/collectors/python.d.plugin/oracledb/oracledb.conf
2948
src/collectors/python.d.plugin/pandas/pandas.conf
2949
src/collectors/python.d.plugin/spigotmc/spigotmc.conf
2950
src/collectors/python.d.plugin/traefik/traefik.conf
@@ -2957,7 +2956,6 @@ if(ENABLE_PLUGIN_PYTHON)
2956
src/collectors/python.d.plugin/am2320/am2320.chart.py
2957
src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
2958
src/collectors/python.d.plugin/haproxy/haproxy.chart.py
2960
- src/collectors/python.d.plugin/oracledb/oracledb.chart.py
2959
src/collectors/python.d.plugin/pandas/pandas.chart.py
2960
src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
2961
src/collectors/python.d.plugin/traefik/traefik.chart.py
src/collectors/python.d.plugin/oracledb/README.md
deleted
-1
@@ -1 +0,0 @@
1
-integrations/oracle_db.md
\ No newline at end of file
src/collectors/python.d.plugin/oracledb/integrations/oracle_db.md
deleted
-260
@@ -1,260 +0,0 @@
1
-<!--startmeta
2
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/oracledb/README.md"
3
-meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/oracledb/metadata.yaml"
4
-sidebar_label: "Oracle DB"
5
-learn_status: "Published"
6
-learn_rel_path: "Collecting Metrics/Databases"
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
-# Oracle DB
12
-
13
-
14
-<img src="https://netdata.cloud/img/oracle.svg" width="150"/>
15
-
16
-
17
-Plugin: python.d.plugin
18
-Module: oracledb
19
-
20
-<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21
-
22
-## Overview
23
-
24
-This collector monitors OracleDB database metrics about sessions, tables, memory and more.
25
-
26
-It collects the metrics via the supported database client library
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
-In order for this collector to work, it needs a read-only user `netdata` in the RDBMS.
33
-
34
-
35
-### Default Behavior
36
-
37
-#### Auto-Detection
38
-
39
-When the requirements are met, databases on the local host on port 1521 will be auto-detected
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
-These metrics refer to the entire monitored application.
57
-
58
-### Per Oracle DB instance
59
-
60
-
61
-
62
-This scope has no labels.
63
-
64
-Metrics:
65
-
66
-| Metric | Dimensions | Unit |
67
-|:------|:----------|:----|
68
-| oracledb.session_count | total, active | sessions |
69
-| oracledb.session_limit_usage | usage | % |
70
-| oracledb.logons | logons | events/s |
71
-| oracledb.physical_disk_read_writes | reads, writes | events/s |
72
-| oracledb.sorts_on_disks | sorts | events/s |
73
-| oracledb.full_table_scans | full table scans | events/s |
74
-| oracledb.database_wait_time_ratio | wait time ratio | % |
75
-| oracledb.shared_pool_free_memory | free memory | % |
76
-| oracledb.in_memory_sorts_ratio | in-memory sorts | % |
77
-| oracledb.sql_service_response_time | time | seconds |
78
-| oracledb.user_rollbacks | rollbacks | events/s |
79
-| oracledb.enqueue_timeouts | enqueue timeouts | events/s |
80
-| oracledb.cache_hit_ration | buffer, cursor, library, row | % |
81
-| oracledb.global_cache_blocks | corrupted, lost | events/s |
82
-| oracledb.activity | parse count, execute count, user commits, user rollbacks | events/s |
83
-| oracledb.wait_time | application, configuration, administrative, concurrency, commit, network, user I/O, system I/O, scheduler, other | ms |
84
-| oracledb.tablespace_size | a dimension per active tablespace | KiB |
85
-| oracledb.tablespace_usage | a dimension per active tablespace | KiB |
86
-| oracledb.tablespace_usage_in_percent | a dimension per active tablespace | % |
87
-| oracledb.allocated_size | a dimension per active tablespace | B |
88
-| oracledb.allocated_usage | a dimension per active tablespace | B |
89
-| oracledb.allocated_usage_in_percent | a dimension per active tablespace | % |
90
-
91
-
92
-
93
-## Alerts
94
-
95
-There are no alerts configured by default for this integration.
96
-
97
-
98
-## Setup
99
-
100
-### Prerequisites
101
-
102
-#### Install the python-oracledb package
103
-
104
-You can follow the official guide below to install the required package:
105
-
106
-Source: https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html
107
-
108
-
109
-#### Create a read only user for netdata
110
-
111
-Follow the official instructions for your oracle RDBMS to create a read-only user for netdata. The operation may follow this approach
112
-
113
-Connect to your Oracle database with an administrative user and execute:
114
-
115
-```bash
116
-CREATE USER netdata IDENTIFIED BY <PASSWORD>;
117
-
118
-GRANT CONNECT TO netdata;
119
-GRANT SELECT_CATALOG_ROLE TO netdata;
120
-```
121
-
122
-
123
-#### Edit the configuration
124
-
125
-Edit the configuration troubleshooting:
126
-
127
-1. Provide a valid user for the netdata collector to access the database
128
-2. Specify the network target this database is listening.
129
-
130
-
131
-
132
-### Configuration
133
-
134
-#### File
135
-
136
-The configuration file name for this integration is `python.d/oracledb.conf`.
137
-
138
-
139
-You can edit the configuration file using the `edit-config` script from the
140
-Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
141
-
142
-```bash
143
-cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
144
-sudo ./edit-config python.d/oracledb.conf
145
-```
146
-#### Options
147
-
148
-There are 2 sections:
149
-
150
-* Global variables
151
-* One or more JOBS that can define multiple different instances to monitor.
152
-
153
-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.
154
-
155
-Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
156
-
157
-Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
158
-
159
-
160
-<details open><summary>Config options</summary>
161
-
162
-| Name | Description | Default | Required |
163
-|:----|:-----------|:-------|:--------:|
164
-| update_every | Sets the default data collection frequency. | 5 | no |
165
-| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
166
-| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
167
-| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
168
-| user | The username for the user account. | no | yes |
169
-| password | The password for the user account. | no | yes |
170
-| server | The IP address or hostname (and port) of the Oracle Database Server. | no | yes |
171
-| service | The Oracle Database service name. To view the services available on your server run this query, `select SERVICE_NAME from gv$session where sid in (select sid from V$MYSTAT)`. | no | yes |
172
-| protocol | one of the strings "tcp" or "tcps" indicating whether to use unencrypted network traffic or encrypted network traffic | no | yes |
173
-
174
-</details>
175
-
176
-#### Examples
177
-
178
-##### Basic
179
-
180
-A basic example configuration, two jobs described for two databases.
181
-
182
-```yaml
183
-local:
184
- user: 'netdata'
185
- password: 'secret'
186
- server: 'localhost:1521'
187
- service: 'XE'
188
- protocol: 'tcps'
189
-
190
-remote:
191
- user: 'netdata'
192
- password: 'secret'
193
- server: '10.0.0.1:1521'
194
- service: 'XE'
195
- protocol: 'tcps'
196
-
197
-```
198
-
199
-
200
-## Troubleshooting
201
-
202
-### Debug Mode
203
-
204
-
205
-To troubleshoot issues with the `oracledb` collector, run the `python.d.plugin` with the debug option enabled. The output
206
-should give you clues as to why the collector isn't working.
207
-
208
-- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
209
- your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
210
-
211
- ```bash
212
- cd /usr/libexec/netdata/plugins.d/
213
- ```
214
-
215
-- Switch to the `netdata` user.
216
-
217
- ```bash
218
- sudo -u netdata -s
219
- ```
220
-
221
-- Run the `python.d.plugin` to debug the collector:
222
-
223
- ```bash
224
- ./python.d.plugin oracledb debug trace
225
- ```
226
-
227
-### Getting Logs
228
-
229
-If you're encountering problems with the `oracledb` collector, follow these steps to retrieve logs and identify potential issues:
230
-
231
-- **Run the command** specific to your system (systemd, non-systemd, or Docker container).
232
-- **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.
233
-
234
-#### System with systemd
235
-
236
-Use the following command to view logs generated since the last Netdata service restart:
237
-
238
-```bash
239
-journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep oracledb
240
-```
241
-
242
-#### System without systemd
243
-
244
-Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name:
245
-
246
-```bash
247
-grep oracledb /var/log/netdata/collector.log
248
-```
249
-
250
-**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues.
251
-
252
-#### Docker Container
253
-
254
-If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
255
-
256
-```bash
257
-docker logs netdata 2>&1 | grep oracledb
258
-```
259
-
260
-
src/collectors/python.d.plugin/oracledb/metadata.yaml
deleted
-309
@@ -1,309 +0,0 @@
1
-plugin_name: python.d.plugin
2
-modules:
3
- - meta:
4
- plugin_name: python.d.plugin
5
- module_name: oracledb
6
- monitored_instance:
7
- name: Oracle DB
8
- link: "https://docs.oracle.com/en/database/oracle/oracle-database/"
9
- categories:
10
- - data-collection.database-servers
11
- icon_filename: "oracle.svg"
12
- related_resources:
13
- integrations:
14
- list: []
15
- info_provided_to_referring_integrations:
16
- description: ""
17
- keywords:
18
- - database
19
- - oracle
20
- - data warehouse
21
- - SQL
22
- most_popular: false
23
- overview:
24
- data_collection:
25
- metrics_description: "This collector monitors OracleDB database metrics about sessions, tables, memory and more."
26
- method_description: "It collects the metrics via the supported database client library"
27
- supported_platforms:
28
- include: []
29
- exclude: []
30
- multi_instance: true
31
- additional_permissions:
32
- description: |
33
- In order for this collector to work, it needs a read-only user `netdata` in the RDBMS.
34
- default_behavior:
35
- auto_detection:
36
- description: "When the requirements are met, databases on the local host on port 1521 will be auto-detected"
37
- limits:
38
- description: ""
39
- performance_impact:
40
- description: ""
41
- setup:
42
- prerequisites:
43
- list:
44
- - title: Install the python-oracledb package
45
- description: |
46
- You can follow the official guide below to install the required package:
47
-
48
- Source: https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html
49
- - title: Create a read only user for netdata
50
- description: |
51
- Follow the official instructions for your oracle RDBMS to create a read-only user for netdata. The operation may follow this approach
52
-
53
- Connect to your Oracle database with an administrative user and execute:
54
-
55
- ```bash
56
- CREATE USER netdata IDENTIFIED BY <PASSWORD>;
57
-
58
- GRANT CONNECT TO netdata;
59
- GRANT SELECT_CATALOG_ROLE TO netdata;
60
- ```
61
- - title: Edit the configuration
62
- description: |
63
- Edit the configuration troubleshooting:
64
-
65
- 1. Provide a valid user for the netdata collector to access the database
66
- 2. Specify the network target this database is listening.
67
- configuration:
68
- file:
69
- name: "python.d/oracledb.conf"
70
- options:
71
- description: |
72
- There are 2 sections:
73
-
74
- * Global variables
75
- * One or more JOBS that can define multiple different instances to monitor.
76
-
77
- 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.
78
-
79
- Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
80
-
81
- Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
82
- folding:
83
- title: "Config options"
84
- enabled: true
85
- list:
86
- - name: update_every
87
- description: Sets the default data collection frequency.
88
- default_value: 5
89
- required: false
90
- - name: priority
91
- description: Controls the order of charts at the netdata dashboard.
92
- default_value: 60000
93
- required: false
94
- - name: autodetection_retry
95
- description: Sets the job re-check interval in seconds.
96
- default_value: 0
97
- required: false
98
- - name: penalty
99
- description: Indicates whether to apply penalty to update_every in case of failures.
100
- default_value: yes
101
- required: false
102
- - name: user
103
- description: The username for the user account.
104
- default_value: no
105
- required: true
106
- - name: password
107
- description: The password for the user account.
108
- default_value: no
109
- required: true
110
- - name: server
111
- description: The IP address or hostname (and port) of the Oracle Database Server.
112
- default_value: no
113
- required: true
114
- - name: service
115
- description: The Oracle Database service name. To view the services available on your server run this query, `select SERVICE_NAME from gv$session where sid in (select sid from V$MYSTAT)`.
116
- default_value: no
117
- required: true
118
- - name: protocol
119
- description: one of the strings "tcp" or "tcps" indicating whether to use unencrypted network traffic or encrypted network traffic
120
- default_value: no
121
- required: true
122
- examples:
123
- folding:
124
- enabled: true
125
- title: "Config"
126
- list:
127
- - name: Basic
128
- folding:
129
- enabled: false
130
- description: A basic example configuration, two jobs described for two databases.
131
- config: |
132
- local:
133
- user: 'netdata'
134
- password: 'secret'
135
- server: 'localhost:1521'
136
- service: 'XE'
137
- protocol: 'tcps'
138
-
139
- remote:
140
- user: 'netdata'
141
- password: 'secret'
142
- server: '10.0.0.1:1521'
143
- service: 'XE'
144
- protocol: 'tcps'
145
- troubleshooting:
146
- problems:
147
- list: []
148
- alerts: []
149
- metrics:
150
- folding:
151
- title: Metrics
152
- enabled: false
153
- description: "These metrics refer to the entire monitored application."
154
- availability: []
155
- scopes:
156
- - name: global
157
- description: ""
158
- labels: []
159
- metrics:
160
- - name: oracledb.session_count
161
- description: Session Count
162
- unit: "sessions"
163
- chart_type: line
164
- dimensions:
165
- - name: total
166
- - name: active
167
- - name: oracledb.session_limit_usage
168
- description: Session Limit Usage
169
- unit: "%"
170
- chart_type: area
171
- dimensions:
172
- - name: usage
173
- - name: oracledb.logons
174
- description: Logons
175
- unit: "events/s"
176
- chart_type: area
177
- dimensions:
178
- - name: logons
179
- - name: oracledb.physical_disk_read_writes
180
- description: Physical Disk Reads/Writes
181
- unit: "events/s"
182
- chart_type: area
183
- dimensions:
184
- - name: reads
185
- - name: writes
186
- - name: oracledb.sorts_on_disks
187
- description: Sorts On Disk
188
- unit: "events/s"
189
- chart_type: line
190
- dimensions:
191
- - name: sorts
192
- - name: oracledb.full_table_scans
193
- description: Full Table Scans
194
- unit: "events/s"
195
- chart_type: line
196
- dimensions:
197
- - name: full table scans
198
- - name: oracledb.database_wait_time_ratio
199
- description: Database Wait Time Ratio
200
- unit: "%"
201
- chart_type: line
202
- dimensions:
203
- - name: wait time ratio
204
- - name: oracledb.shared_pool_free_memory
205
- description: Shared Pool Free Memory
206
- unit: "%"
207
- chart_type: line
208
- dimensions:
209
- - name: free memory
210
- - name: oracledb.in_memory_sorts_ratio
211
- description: In-Memory Sorts Ratio
212
- unit: "%"
213
- chart_type: line
214
- dimensions:
215
- - name: in-memory sorts
216
- - name: oracledb.sql_service_response_time
217
- description: SQL Service Response Time
218
- unit: "seconds"
219
- chart_type: line
220
- dimensions:
221
- - name: time
222
- - name: oracledb.user_rollbacks
223
- description: User Rollbacks
224
- unit: "events/s"
225
- chart_type: line
226
- dimensions:
227
- - name: rollbacks
228
- - name: oracledb.enqueue_timeouts
229
- description: Enqueue Timeouts
230
- unit: "events/s"
231
- chart_type: line
232
- dimensions:
233
- - name: enqueue timeouts
234
- - name: oracledb.cache_hit_ration
235
- description: Cache Hit Ratio
236
- unit: "%"
237
- chart_type: stacked
238
- dimensions:
239
- - name: buffer
240
- - name: cursor
241
- - name: library
242
- - name: row
243
- - name: oracledb.global_cache_blocks
244
- description: Global Cache Blocks Events
245
- unit: "events/s"
246
- chart_type: area
247
- dimensions:
248
- - name: corrupted
249
- - name: lost
250
- - name: oracledb.activity
251
- description: Activities
252
- unit: "events/s"
253
- chart_type: stacked
254
- dimensions:
255
- - name: parse count
256
- - name: execute count
257
- - name: user commits
258
- - name: user rollbacks
259
- - name: oracledb.wait_time
260
- description: Wait Time
261
- unit: "ms"
262
- chart_type: stacked
263
- dimensions:
264
- - name: application
265
- - name: configuration
266
- - name: administrative
267
- - name: concurrency
268
- - name: commit
269
- - name: network
270
- - name: user I/O
271
- - name: system I/O
272
- - name: scheduler
273
- - name: other
274
- - name: oracledb.tablespace_size
275
- description: Size
276
- unit: "KiB"
277
- chart_type: line
278
- dimensions:
279
- - name: a dimension per active tablespace
280
- - name: oracledb.tablespace_usage
281
- description: Usage
282
- unit: "KiB"
283
- chart_type: line
284
- dimensions:
285
- - name: a dimension per active tablespace
286
- - name: oracledb.tablespace_usage_in_percent
287
- description: Usage
288
- unit: "%"
289
- chart_type: line
290
- dimensions:
291
- - name: a dimension per active tablespace
292
- - name: oracledb.allocated_size
293
- description: Size
294
- unit: "B"
295
- chart_type: line
296
- dimensions:
297
- - name: a dimension per active tablespace
298
- - name: oracledb.allocated_usage
299
- description: Usage
300
- unit: "B"
301
- chart_type: line
302
- dimensions:
303
- - name: a dimension per active tablespace
304
- - name: oracledb.allocated_usage_in_percent
305
- description: Usage
306
- unit: "%"
307
- chart_type: line
308
- dimensions:
309
- - name: a dimension per active tablespace
src/collectors/python.d.plugin/oracledb/oracledb.chart.py
deleted
-846
@@ -1,846 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Description: oracledb netdata python.d module
3
-# Author: ilyam8 (Ilya Mashchenko)
4
-# SPDX-License-Identifier: GPL-3.0-or-later
5
-
6
-from copy import deepcopy
7
-
8
-from bases.FrameworkServices.SimpleService import SimpleService
9
-
10
-try:
11
- import oracledb as cx_Oracle
12
-
13
- HAS_ORACLE_NEW = True
14
- HAS_ORACLE_OLD = False
15
-except ImportError:
16
- HAS_ORACLE_NEW = False
17
- try:
18
- import cx_Oracle
19
-
20
- HAS_ORACLE_OLD = True
21
- except ImportError:
22
- HAS_ORACLE_OLD = False
23
-
24
-ORDER = [
25
- 'session_count',
26
- 'session_limit_usage',
27
- 'logons',
28
- 'physical_disk_read_write',
29
- 'sorts_on_disk',
30
- 'full_table_scans',
31
- 'database_wait_time_ratio',
32
- 'shared_pool_free_memory',
33
- 'in_memory_sorts_ratio',
34
- 'sql_service_response_time',
35
- 'user_rollbacks',
36
- 'enqueue_timeouts',
37
- 'cache_hit_ratio',
38
- 'global_cache_blocks',
39
- 'activity',
40
- 'wait_time',
41
- 'tablespace_size',
42
- 'tablespace_usage',
43
- 'tablespace_usage_in_percent',
44
- 'allocated_size',
45
- 'allocated_usage',
46
- 'allocated_usage_in_percent',
47
-]
48
-
49
-CHARTS = {
50
- 'session_count': {
51
- 'options': [None, 'Session Count', 'sessions', 'session activity', 'oracledb.session_count', 'line'],
52
- 'lines': [
53
- ['session_count', 'total', 'absolute', 1, 1000],
54
- ['average_active_sessions', 'active', 'absolute', 1, 1000],
55
- ]
56
- },
57
- 'session_limit_usage': {
58
- 'options': [None, 'Session Limit Usage', '%', 'session activity', 'oracledb.session_limit_usage', 'area'],
59
- 'lines': [
60
- ['session_limit_percent', 'usage', 'absolute', 1, 1000],
61
- ]
62
- },
63
- 'logons': {
64
- 'options': [None, 'Logons', 'events/s', 'session activity', 'oracledb.logons', 'area'],
65
- 'lines': [
66
- ['logons_per_sec', 'logons', 'absolute', 1, 1000],
67
- ]
68
- },
69
- 'physical_disk_read_write': {
70
- 'options': [None, 'Physical Disk Reads/Writes', 'events/s', 'disk activity',
71
- 'oracledb.physical_disk_read_writes', 'area'],
72
- 'lines': [
73
- ['physical_reads_per_sec', 'reads', 'absolute', 1, 1000],
74
- ['physical_writes_per_sec', 'writes', 'absolute', -1, 1000],
75
- ]
76
- },
77
- 'sorts_on_disk': {
78
- 'options': [None, 'Sorts On Disk', 'events/s', 'disk activity', 'oracledb.sorts_on_disks', 'line'],
79
- 'lines': [
80
- ['disk_sort_per_sec', 'sorts', 'absolute', 1, 1000],
81
- ]
82
- },
83
- 'full_table_scans': {
84
- 'options': [None, 'Full Table Scans', 'events/s', 'disk activity', 'oracledb.full_table_scans', 'line'],
85
- 'lines': [
86
- ['long_table_scans_per_sec', 'full table scans', 'absolute', 1, 1000],
87
- ]
88
- },
89
- 'database_wait_time_ratio': {
90
- 'options': [None, 'Database Wait Time Ratio', '%', 'database and buffer activity',
91
- 'oracledb.database_wait_time_ratio', 'line'],
92
- 'lines': [
93
- ['database_wait_time_ratio', 'wait time ratio', 'absolute', 1, 1000],
94
- ]
95
- },
96
- 'shared_pool_free_memory': {
97
- 'options': [None, 'Shared Pool Free Memory', '%', 'database and buffer activity',
98
- 'oracledb.shared_pool_free_memory', 'line'],
99
- 'lines': [
100
- ['shared_pool_free_percent', 'free memory', 'absolute', 1, 1000],
101
- ]
102
- },
103
- 'in_memory_sorts_ratio': {
104
- 'options': [None, 'In-Memory Sorts Ratio', '%', 'database and buffer activity',
105
- 'oracledb.in_memory_sorts_ratio', 'line'],
106
- 'lines': [
107
- ['memory_sorts_ratio', 'in-memory sorts', 'absolute', 1, 1000],
108
- ]
109
- },
110
- 'sql_service_response_time': {
111
- 'options': [None, 'SQL Service Response Time', 'seconds', 'database and buffer activity',
112
- 'oracledb.sql_service_response_time', 'line'],
113
- 'lines': [
114
- ['sql_service_response_time', 'time', 'absolute', 1, 1000],
115
- ]
116
- },
117
- 'user_rollbacks': {
118
- 'options': [None, 'User Rollbacks', 'events/s', 'database and buffer activity',
119
- 'oracledb.user_rollbacks', 'line'],
120
- 'lines': [
121
- ['user_rollbacks_per_sec', 'rollbacks', 'absolute', 1, 1000],
122
- ]
123
- },
124
- 'enqueue_timeouts': {
125
- 'options': [None, 'Enqueue Timeouts', 'events/s', 'database and buffer activity',
126
- 'oracledb.enqueue_timeouts', 'line'],
127
- 'lines': [
128
- ['enqueue_timeouts_per_sec', 'enqueue timeouts', 'absolute', 1, 1000],
129
- ]
130
- },
131
- 'cache_hit_ratio': {
132
- 'options': [None, 'Cache Hit Ratio', '%', 'cache', 'oracledb.cache_hit_ration', 'stacked'],
133
- 'lines': [
134
- ['buffer_cache_hit_ratio', 'buffer', 'absolute', 1, 1000],
135
- ['cursor_cache_hit_ratio', 'cursor', 'absolute', 1, 1000],
136
- ['library_cache_hit_ratio', 'library', 'absolute', 1, 1000],
137
- ['row_cache_hit_ratio', 'row', 'absolute', 1, 1000],
138
- ]
139
- },
140
- 'global_cache_blocks': {
141
- 'options': [None, 'Global Cache Blocks Events', 'events/s', 'cache', 'oracledb.global_cache_blocks', 'area'],
142
- 'lines': [
143
- ['global_cache_blocks_corrupted', 'corrupted', 'incremental', 1, 1000],
144
- ['global_cache_blocks_lost', 'lost', 'incremental', 1, 1000],
145
- ]
146
- },
147
- 'activity': {
148
- 'options': [None, 'Activities', 'events/s', 'activities', 'oracledb.activity', 'stacked'],
149
- 'lines': [
150
- ['activity_parse_count_total', 'parse count', 'incremental', 1, 1000],
151
- ['activity_execute_count', 'execute count', 'incremental', 1, 1000],
152
- ['activity_user_commits', 'user commits', 'incremental', 1, 1000],
153
- ['activity_user_rollbacks', 'user rollbacks', 'incremental', 1, 1000],
154
- ]
155
- },
156
- 'wait_time': {
157
- 'options': [None, 'Wait Time', 'ms', 'wait time', 'oracledb.wait_time', 'stacked'],
158
- 'lines': [
159
- ['wait_time_application', 'application', 'absolute', 1, 1000],
160
- ['wait_time_configuration', 'configuration', 'absolute', 1, 1000],
161
- ['wait_time_administrative', 'administrative', 'absolute', 1, 1000],
162
- ['wait_time_concurrency', 'concurrency', 'absolute', 1, 1000],
163
- ['wait_time_commit', 'commit', 'absolute', 1, 1000],
164
- ['wait_time_network', 'network', 'absolute', 1, 1000],
165
- ['wait_time_user_io', 'user I/O', 'absolute', 1, 1000],
166
- ['wait_time_system_io', 'system I/O', 'absolute', 1, 1000],
167
- ['wait_time_scheduler', 'scheduler', 'absolute', 1, 1000],
168
- ['wait_time_other', 'other', 'absolute', 1, 1000],
169
- ]
170
- },
171
- 'tablespace_size': {
172
- 'options': [None, 'Size', 'KiB', 'tablespace', 'oracledb.tablespace_size', 'line'],
173
- 'lines': [],
174
- },
175
- 'tablespace_usage': {
176
- 'options': [None, 'Usage', 'KiB', 'tablespace', 'oracledb.tablespace_usage', 'line'],
177
- 'lines': [],
178
- },
179
- 'tablespace_usage_in_percent': {
180
- 'options': [None, 'Usage', '%', 'tablespace', 'oracledb.tablespace_usage_in_percent', 'line'],
181
- 'lines': [],
182
- },
183
- 'allocated_size': {
184
- 'options': [None, 'Size', 'B', 'tablespace', 'oracledb.allocated_size', 'line'],
185
- 'lines': [],
186
- },
187
- 'allocated_usage': {
188
- 'options': [None, 'Usage', 'B', 'tablespace', 'oracledb.allocated_usage', 'line'],
189
- 'lines': [],
190
- },
191
- 'allocated_usage_in_percent': {
192
- 'options': [None, 'Usage', '%', 'tablespace', 'oracledb.allocated_usage_in_percent', 'line'],
193
- 'lines': [],
194
- },
195
-}
196
-
197
-CX_CONNECT_STRING_OLD = "{0}/{1}@//{2}/{3}"
198
-
199
-QUERY_SYSTEM = '''
200
-SELECT
201
- metric_name,
202
- value
203
-FROM
204
- gv$sysmetric
205
-ORDER BY
206
- begin_time
207
-'''
208
-QUERY_TABLESPACE = '''
209
-SELECT
210
- m.tablespace_name,
211
- m.used_space * t.block_size AS used_bytes,
212
- m.tablespace_size * t.block_size AS max_bytes,
213
- m.used_percent
214
-FROM
215
- dba_tablespace_usage_metrics m
216
- JOIN dba_tablespaces t ON m.tablespace_name = t.tablespace_name
217
-'''
218
-QUERY_ALLOCATED = '''
219
-SELECT
220
- nvl(b.tablespace_name,nvl(a.tablespace_name,'UNKNOWN')) tablespace_name,
221
- bytes_alloc used_bytes,
222
- bytes_alloc-nvl(bytes_free,0) max_bytes,
223
- ((bytes_alloc-nvl(bytes_free,0))/ bytes_alloc)*100 used_percent
224
-FROM
225
- (SELECT
226
- sum(bytes) bytes_free,
227
- tablespace_name
228
- FROM sys.dba_free_space
229
- GROUP BY tablespace_name
230
- ) a,
231
- (SELECT
232
- sum(bytes) bytes_alloc,
233
- tablespace_name
234
- FROM sys.dba_data_files
235
- GROUP BY tablespace_name
236
- ) b
237
-WHERE a.tablespace_name (+) = b.tablespace_name
238
-'''
239
-QUERY_ACTIVITIES_COUNT = '''
240
-SELECT
241
- name,
242
- value
243
-FROM
244
- v$sysstat
245
-WHERE
246
- name IN (
247
- 'parse count (total)',
248
- 'execute count',
249
- 'user commits',
250
- 'user rollbacks'
251
- )
252
-'''
253
-QUERY_WAIT_TIME = '''
254
-SELECT
255
- n.wait_class,
256
- round(m.time_waited / m.INTSIZE_CSEC, 3)
257
-FROM
258
- v$waitclassmetric m,
259
- v$system_wait_class n
260
-WHERE
261
- m.wait_class_id = n.wait_class_id
262
- AND n.wait_class != 'Idle'
263
-'''
264
-# QUERY_SESSION_COUNT = '''
265
-# SELECT
266
-# status,
267
-# type
268
-# FROM
269
-# v$session
270
-# GROUP BY
271
-# status,
272
-# type
273
-# '''
274
-# QUERY_PROCESSES_COUNT = '''
275
-# SELECT
276
-# COUNT(*)
277
-# FROM
278
-# v$process
279
-# '''
280
-# QUERY_PROCESS = '''
281
-# SELECT
282
-# program,
283
-# pga_used_mem,
284
-# pga_alloc_mem,
285
-# pga_freeable_mem,
286
-# pga_max_mem
287
-# FROM
288
-# gv$process
289
-# '''
290
-
291
-# PROCESS_METRICS = [
292
-# 'pga_used_memory',
293
-# 'pga_allocated_memory',
294
-# 'pga_freeable_memory',
295
-# 'pga_maximum_memory',
296
-# ]
297
-
298
-
299
-SYS_METRICS = {
300
- 'Average Active Sessions': 'average_active_sessions',
301
- 'Session Count': 'session_count',
302
- 'Session Limit %': 'session_limit_percent',
303
- 'Logons Per Sec': 'logons_per_sec',
304
- 'Physical Reads Per Sec': 'physical_reads_per_sec',
305
- 'Physical Writes Per Sec': 'physical_writes_per_sec',
306
- 'Disk Sort Per Sec': 'disk_sort_per_sec',
307
- 'Long Table Scans Per Sec': 'long_table_scans_per_sec',
308
- 'Database Wait Time Ratio': 'database_wait_time_ratio',
309
- 'Shared Pool Free %': 'shared_pool_free_percent',
310
- 'Memory Sorts Ratio': 'memory_sorts_ratio',
311
- 'SQL Service Response Time': 'sql_service_response_time',
312
- 'User Rollbacks Per Sec': 'user_rollbacks_per_sec',
313
- 'Enqueue Timeouts Per Sec': 'enqueue_timeouts_per_sec',
314
- 'Buffer Cache Hit Ratio': 'buffer_cache_hit_ratio',
315
- 'Cursor Cache Hit Ratio': 'cursor_cache_hit_ratio',
316
- 'Library Cache Hit Ratio': 'library_cache_hit_ratio',
317
- 'Row Cache Hit Ratio': 'row_cache_hit_ratio',
318
- 'Global Cache Blocks Corrupted': 'global_cache_blocks_corrupted',
319
- 'Global Cache Blocks Lost': 'global_cache_blocks_lost',
320
-}
321
-
322
-
323
-class Service(SimpleService):
324
- def __init__(self, configuration=None, name=None):
325
- SimpleService.__init__(self, configuration=configuration, name=name)
326
- self.order = ORDER
327
- self.definitions = deepcopy(CHARTS)
328
- self.user = configuration.get('user')
329
- self.password = configuration.get('password')
330
- self.server = configuration.get('server')
331
- self.service = configuration.get('service')
332
- self.protocol = configuration.get('protocol', 'tcps')
333
- self.alive = False
334
- self.conn = None
335
- self.active_tablespaces = set()
336
-
337
- def connect(self):
338
- if self.conn:
339
- self.conn.close()
340
- self.conn = None
341
- if HAS_ORACLE_NEW:
342
- try:
343
- self.conn = cx_Oracle.connect(
344
- f'{self.user}/{self.password}@{self.protocol}://{self.server}/{self.service}')
345
- except cx_Oracle.DatabaseError as error:
346
- self.error(error)
347
- return False
348
- else:
349
- try:
350
- self.conn = cx_Oracle.connect(
351
- CX_CONNECT_STRING_OLD.format(
352
- self.user,
353
- self.password,
354
- self.server,
355
- self.service,
356
- ))
357
- except cx_Oracle.DatabaseError as error:
358
- self.error(error)
359
- return False
360
-
361
- self.alive = True
362
- return True
363
-
364
- def reconnect(self):
365
- return self.connect()
366
-
367
- def check(self):
368
- if not HAS_ORACLE_NEW and not HAS_ORACLE_OLD:
369
- self.error("'oracledb' package is needed to use oracledb module")
370
- return False
371
-
372
- if not all([
373
- self.user,
374
- self.password,
375
- self.server,
376
- self.service
377
- ]):
378
- self.error("one of these parameters is not specified: user, password, server, service")
379
- return False
380
-
381
- if not self.connect():
382
- return False
383
-
384
- return bool(self.get_data())
385
-
386
- def get_data(self):
387
- if not self.alive and not self.reconnect():
388
- return None
389
-
390
- data = dict()
391
-
392
- # SYSTEM
393
- try:
394
- rv = self.gather_system_metrics()
395
- except cx_Oracle.Error as error:
396
- self.error(error)
397
- self.alive = False
398
- return None
399
- else:
400
- for name, value in rv:
401
- if name not in SYS_METRICS:
402
- continue
403
- data[SYS_METRICS[name]] = int(float(value) * 1000)
404
-
405
- # ACTIVITIES COUNT
406
- try:
407
- rv = self.gather_activities_count()
408
- except cx_Oracle.Error as error:
409
- self.error(error)
410
- self.alive = False
411
- return None
412
- else:
413
- for name, amount in rv:
414
- cleaned = name.replace(' ', '_').replace('(', '').replace(')', '')
415
- new_name = 'activity_{0}'.format(cleaned)
416
- data[new_name] = int(float(amount) * 1000)
417
-
418
- # WAIT TIME
419
- try:
420
- rv = self.gather_wait_time_metrics()
421
- except cx_Oracle.Error as error:
422
- self.error(error)
423
- self.alive = False
424
- return None
425
- else:
426
- for name, amount in rv:
427
- cleaned = name.replace(' ', '_').replace('/', '').lower()
428
- new_name = 'wait_time_{0}'.format(cleaned)
429
- data[new_name] = amount
430
-
431
- # TABLESPACE
432
- try:
433
- rv = self.gather_tablespace_metrics()
434
- except cx_Oracle.Error as error:
435
- self.error(error)
436
- self.alive = False
437
- return None
438
- else:
439
- for name, offline, size, used, used_in_percent in rv:
440
- # TODO: skip offline?
441
- if not (not offline and self.charts):
442
- continue
443
- # TODO: remove inactive?
444
- if name not in self.active_tablespaces:
445
- self.active_tablespaces.add(name)
446
- self.add_tablespace_to_charts(name)
447
- data['{0}_tablespace_size'.format(name)] = int(size * 1000)
448
- data['{0}_tablespace_used'.format(name)] = int(used * 1000)
449
- data['{0}_tablespace_used_in_percent'.format(name)] = int(used_in_percent * 1000)
450
-
451
- # ALLOCATED SPACE
452
- try:
453
- rv = self.gather_allocated_metrics()
454
- except cx_Oracle.Error as error:
455
- self.error(error)
456
- self.alive = False
457
- return None
458
- else:
459
- for name, offline, size, used, used_in_percent in rv:
460
- # TODO: skip offline?
461
- if not (not offline and self.charts):
462
- continue
463
- # TODO: remove inactive?
464
- if name not in self.active_tablespaces:
465
- self.active_tablespaces.add(name)
466
- self.add_tablespace_to_charts(name)
467
- data['{0}_allocated_size'.format(name)] = int(size * 1000)
468
- data['{0}_allocated_used'.format(name)] = int(used * 1000)
469
- data['{0}_allocated_used_in_percent'.format(name)] = int(used_in_percent * 1000)
470
-
471
- return data or None
472
-
473
- def gather_system_metrics(self):
474
-
475
- """
476
- :return:
477
-
478
- [['Buffer Cache Hit Ratio', 100],
479
- ['Memory Sorts Ratio', 100],
480
- ['Redo Allocation Hit Ratio', 100],
481
- ['User Transaction Per Sec', 0],
482
- ['Physical Reads Per Sec', 0],
483
- ['Physical Reads Per Txn', 0],
484
- ['Physical Writes Per Sec', 0],
485
- ['Physical Writes Per Txn', 0],
486
- ['Physical Reads Direct Per Sec', 0],
487
- ['Physical Reads Direct Per Txn', 0],
488
- ['Physical Writes Direct Per Sec', 0],
489
- ['Physical Writes Direct Per Txn', 0],
490
- ['Physical Reads Direct Lobs Per Sec', 0],
491
- ['Physical Reads Direct Lobs Per Txn', 0],
492
- ['Physical Writes Direct Lobs Per Sec', 0],
493
- ['Physical Writes Direct Lobs Per Txn', 0],
494
- ['Redo Generated Per Sec', Decimal('4.66666666666667')],
495
- ['Redo Generated Per Txn', 280],
496
- ['Logons Per Sec', Decimal('0.0166666666666667')],
497
- ['Logons Per Txn', 1],
498
- ['Open Cursors Per Sec', 0.35],
499
- ['Open Cursors Per Txn', 21],
500
- ['User Commits Per Sec', 0],
501
- ['User Commits Percentage', 0],
502
- ['User Rollbacks Per Sec', 0],
503
- ['User Rollbacks Percentage', 0],
504
- ['User Calls Per Sec', Decimal('0.0333333333333333')],
505
- ['User Calls Per Txn', 2],
506
- ['Recursive Calls Per Sec', 14.15],
507
- ['Recursive Calls Per Txn', 849],
508
- ['Logical Reads Per Sec', Decimal('0.683333333333333')],
509
- ['Logical Reads Per Txn', 41],
510
- ['DBWR Checkpoints Per Sec', 0],
511
- ['Background Checkpoints Per Sec', 0],
512
- ['Redo Writes Per Sec', Decimal('0.0333333333333333')],
513
- ['Redo Writes Per Txn', 2],
514
- ['Long Table Scans Per Sec', 0],
515
- ['Long Table Scans Per Txn', 0],
516
- ['Total Table Scans Per Sec', Decimal('0.0166666666666667')],
517
- ['Total Table Scans Per Txn', 1],
518
- ['Full Index Scans Per Sec', 0],
519
- ['Full Index Scans Per Txn', 0],
520
- ['Total Index Scans Per Sec', Decimal('0.216666666666667')],
521
- ['Total Index Scans Per Txn', 13],
522
- ['Total Parse Count Per Sec', 0.35],
523
- ['Total Parse Count Per Txn', 21],
524
- ['Hard Parse Count Per Sec', 0],
525
- ['Hard Parse Count Per Txn', 0],
526
- ['Parse Failure Count Per Sec', 0],
527
- ['Parse Failure Count Per Txn', 0],
528
- ['Cursor Cache Hit Ratio', Decimal('52.3809523809524')],
529
- ['Disk Sort Per Sec', 0],
530
- ['Disk Sort Per Txn', 0],
531
- ['Rows Per Sort', 8.6],
532
- ['Execute Without Parse Ratio', Decimal('27.5862068965517')],
533
- ['Soft Parse Ratio', 100],
534
- ['User Calls Ratio', Decimal('0.235017626321974')],
535
- ['Host CPU Utilization (%)', Decimal('0.124311845142959')],
536
- ['Network Traffic Volume Per Sec', 0],
537
- ['Enqueue Timeouts Per Sec', 0],
538
- ['Enqueue Timeouts Per Txn', 0],
539
- ['Enqueue Waits Per Sec', 0],
540
- ['Enqueue Waits Per Txn', 0],
541
- ['Enqueue Deadlocks Per Sec', 0],
542
- ['Enqueue Deadlocks Per Txn', 0],
543
- ['Enqueue Requests Per Sec', Decimal('216.683333333333')],
544
- ['Enqueue Requests Per Txn', 13001],
545
- ['DB Block Gets Per Sec', 0],
546
- ['DB Block Gets Per Txn', 0],
547
- ['Consistent Read Gets Per Sec', Decimal('0.683333333333333')],
548
- ['Consistent Read Gets Per Txn', 41],
549
- ['DB Block Changes Per Sec', 0],
550
- ['DB Block Changes Per Txn', 0],
551
- ['Consistent Read Changes Per Sec', 0],
552
- ['Consistent Read Changes Per Txn', 0],
553
- ['CPU Usage Per Sec', 0],
554
- ['CPU Usage Per Txn', 0],
555
- ['CR Blocks Created Per Sec', 0],
556
- ['CR Blocks Created Per Txn', 0],
557
- ['CR Undo Records Applied Per Sec', 0],
558
- ['CR Undo Records Applied Per Txn', 0],
559
- ['User Rollback UndoRec Applied Per Sec', 0],
560
- ['User Rollback Undo Records Applied Per Txn', 0],
561
- ['Leaf Node Splits Per Sec', 0],
562
- ['Leaf Node Splits Per Txn', 0],
563
- ['Branch Node Splits Per Sec', 0],
564
- ['Branch Node Splits Per Txn', 0],
565
- ['PX downgraded 1 to 25% Per Sec', 0],
566
- ['PX downgraded 25 to 50% Per Sec', 0],
567
- ['PX downgraded 50 to 75% Per Sec', 0],
568
- ['PX downgraded 75 to 99% Per Sec', 0],
569
- ['PX downgraded to serial Per Sec', 0],
570
- ['Physical Read Total IO Requests Per Sec', Decimal('2.16666666666667')],
571
- ['Physical Read Total Bytes Per Sec', Decimal('35498.6666666667')],
572
- ['GC CR Block Received Per Second', 0],
573
- ['GC CR Block Received Per Txn', 0],
574
- ['GC Current Block Received Per Second', 0],
575
- ['GC Current Block Received Per Txn', 0],
576
- ['Global Cache Average CR Get Time', 0],
577
- ['Global Cache Average Current Get Time', 0],
578
- ['Physical Write Total IO Requests Per Sec', Decimal('0.966666666666667')],
579
- ['Global Cache Blocks Corrupted', 0],
580
- ['Global Cache Blocks Lost', 0],
581
- ['Current Logons Count', 49],
582
- ['Current Open Cursors Count', 64],
583
- ['User Limit %', Decimal('0.00000114087015416959')],
584
- ['SQL Service Response Time', 0],
585
- ['Database Wait Time Ratio', 0],
586
- ['Database CPU Time Ratio', 0],
587
- ['Response Time Per Txn', 0],
588
- ['Row Cache Hit Ratio', 100],
589
- ['Row Cache Miss Ratio', 0],
590
- ['Library Cache Hit Ratio', 100],
591
- ['Library Cache Miss Ratio', 0],
592
- ['Shared Pool Free %', Decimal('7.82380268491548')],
593
- ['PGA Cache Hit %', Decimal('98.0399767109115')],
594
- ['Process Limit %', Decimal('17.6666666666667')],
595
- ['Session Limit %', Decimal('15.2542372881356')],
596
- ['Executions Per Txn', 29],
597
- ['Executions Per Sec', Decimal('0.483333333333333')],
598
- ['Txns Per Logon', 0],
599
- ['Database Time Per Sec', 0],
600
- ['Physical Write Total Bytes Per Sec', 15308.8],
601
- ['Physical Read IO Requests Per Sec', 0],
602
- ['Physical Read Bytes Per Sec', 0],
603
- ['Physical Write IO Requests Per Sec', 0],
604
- ['Physical Write Bytes Per Sec', 0],
605
- ['DB Block Changes Per User Call', 0],
606
- ['DB Block Gets Per User Call', 0],
607
- ['Executions Per User Call', 14.5],
608
- ['Logical Reads Per User Call', 20.5],
609
- ['Total Sorts Per User Call', 2.5],
610
- ['Total Table Scans Per User Call', 0.5],
611
- ['Current OS Load', 0.0390625],
612
- ['Streams Pool Usage Percentage', 0],
613
- ['PQ QC Session Count', 0],
614
- ['PQ Slave Session Count', 0],
615
- ['Queries parallelized Per Sec', 0],
616
- ['DML statements parallelized Per Sec', 0],
617
- ['DDL statements parallelized Per Sec', 0],
618
- ['PX operations not downgraded Per Sec', 0],
619
- ['Session Count', 72],
620
- ['Average Synchronous Single-Block Read Latency', 0],
621
- ['I/O Megabytes per Second', 0.05],
622
- ['I/O Requests per Second', Decimal('3.13333333333333')],
623
- ['Average Active Sessions', 0],
624
- ['Active Serial Sessions', 1],
625
- ['Active Parallel Sessions', 0],
626
- ['Captured user calls', 0],
627
- ['Replayed user calls', 0],
628
- ['Workload Capture and Replay status', 0],
629
- ['Background CPU Usage Per Sec', Decimal('1.22578833333333')],
630
- ['Background Time Per Sec', 0.0147551],
631
- ['Host CPU Usage Per Sec', Decimal('0.116666666666667')],
632
- ['Cell Physical IO Interconnect Bytes', 3048448],
633
- ['Temp Space Used', 0],
634
- ['Total PGA Allocated', 200657920],
635
- ['Total PGA Used by SQL Workareas', 0],
636
- ['Run Queue Per Sec', 0],
637
- ['VM in bytes Per Sec', 0],
638
- ['VM out bytes Per Sec', 0]]
639
- """
640
-
641
- metrics = list()
642
- with self.conn.cursor() as cursor:
643
- cursor.execute(QUERY_SYSTEM)
644
- for metric_name, value in cursor.fetchall():
645
- metrics.append([metric_name, value])
646
- return metrics
647
-
648
- def gather_tablespace_metrics(self):
649
- """
650
- :return:
651
-
652
- [['SYSTEM', 874250240.0, 3233169408.0, 27.040038107400033, 0],
653
- ['SYSAUX', 498860032.0, 3233169408.0, 15.429443033997678, 0],
654
- ['TEMP', 0.0, 3233177600.0, 0.0, 0],
655
- ['USERS', 1048576.0, 3233169408.0, 0.03243182981397305, 0]]
656
- """
657
- metrics = list()
658
- with self.conn.cursor() as cursor:
659
- cursor.execute(QUERY_TABLESPACE)
660
- for tablespace_name, used_bytes, max_bytes, used_percent in cursor.fetchall():
661
- if used_bytes is None:
662
- offline = True
663
- used = 0
664
- else:
665
- offline = False
666
- used = float(used_bytes)
667
- if max_bytes is None:
668
- size = 0
669
- else:
670
- size = float(max_bytes)
671
- if used_percent is None:
672
- used_percent = 0
673
- else:
674
- used_percent = float(used_percent)
675
- metrics.append(
676
- [
677
- tablespace_name,
678
- offline,
679
- size,
680
- used,
681
- used_percent,
682
- ]
683
- )
684
- return metrics
685
-
686
- def gather_allocated_metrics(self):
687
- """
688
- :return:
689
-
690
- [['SYSTEM', 874250240.0, 3233169408.0, 27.040038107400033, 0],
691
- ['SYSAUX', 498860032.0, 3233169408.0, 15.429443033997678, 0],
692
- ['TEMP', 0.0, 3233177600.0, 0.0, 0],
693
- ['USERS', 1048576.0, 3233169408.0, 0.03243182981397305, 0]]
694
- """
695
- metrics = list()
696
- with self.conn.cursor() as cursor:
697
- cursor.execute(QUERY_ALLOCATED)
698
- for tablespace_name, used_bytes, max_bytes, used_percent in cursor.fetchall():
699
- if used_bytes is None:
700
- offline = True
701
- used = 0
702
- else:
703
- offline = False
704
- used = float(used_bytes)
705
- if max_bytes is None:
706
- size = 0
707
- else:
708
- size = float(max_bytes)
709
- if used_percent is None:
710
- used_percent = 0
711
- else:
712
- used_percent = float(used_percent)
713
- metrics.append(
714
- [
715
- tablespace_name,
716
- offline,
717
- size,
718
- used,
719
- used_percent,
720
- ]
721
- )
722
- return metrics
723
-
724
- def gather_wait_time_metrics(self):
725
- """
726
- :return:
727
-
728
- [['Other', 0],
729
- ['Application', 0],
730
- ['Configuration', 0],
731
- ['Administrative', 0],
732
- ['Concurrency', 0],
733
- ['Commit', 0],
734
- ['Network', 0],
735
- ['User I/O', 0],
736
- ['System I/O', 0.002],
737
- ['Scheduler', 0]]
738
- """
739
- metrics = list()
740
- with self.conn.cursor() as cursor:
741
- cursor.execute(QUERY_WAIT_TIME)
742
- for wait_class_name, value in cursor.fetchall():
743
- metrics.append([wait_class_name, value])
744
- return metrics
745
-
746
- def gather_activities_count(self):
747
- """
748
- :return:
749
-
750
- [('user commits', 9104),
751
- ('user rollbacks', 17),
752
- ('parse count (total)', 483695),
753
- ('execute count', 2020356)]
754
- """
755
- with self.conn.cursor() as cursor:
756
- cursor.execute(QUERY_ACTIVITIES_COUNT)
757
- return cursor.fetchall()
758
-
759
- # def gather_process_metrics(self):
760
- # """
761
- # :return:
762
- #
763
- # [['PSEUDO', 'pga_used_memory', 0],
764
- # ['PSEUDO', 'pga_allocated_memory', 0],
765
- # ['PSEUDO', 'pga_freeable_memory', 0],
766
- # ['PSEUDO', 'pga_maximum_memory', 0],
767
- # ['oracle@localhost.localdomain (PMON)', 'pga_used_memory', 1793827],
768
- # ['oracle@localhost.localdomain (PMON)', 'pga_allocated_memory', 1888651],
769
- # ['oracle@localhost.localdomain (PMON)', 'pga_freeable_memory', 0],
770
- # ['oracle@localhost.localdomain (PMON)', 'pga_maximum_memory', 1888651],
771
- # ...
772
- # ...
773
- # """
774
- #
775
- # metrics = list()
776
- # with self.conn.cursor() as cursor:
777
- # cursor.execute(QUERY_PROCESS)
778
- # for row in cursor.fetchall():
779
- # for i, name in enumerate(PROCESS_METRICS, 1):
780
- # metrics.append([row[0], name, row[i]])
781
- # return metrics
782
-
783
- # def gather_processes_count(self):
784
- # with self.conn.cursor() as cursor:
785
- # cursor.execute(QUERY_PROCESSES_COUNT)
786
- # return cursor.fetchone()[0] # 53
787
-
788
- # def gather_sessions_count(self):
789
- # with self.conn.cursor() as cursor:
790
- # cursor.execute(QUERY_SESSION_COUNT)
791
- # total, active, inactive = 0, 0, 0
792
- # for status, _ in cursor.fetchall():
793
- # total += 1
794
- # active += status == 'ACTIVE'
795
- # inactive += status == 'INACTIVE'
796
- # return [total, active, inactive]
797
-
798
- def add_tablespace_to_charts(self, name):
799
- self.charts['tablespace_size'].add_dimension(
800
- [
801
- '{0}_tablespace_size'.format(name),
802
- name,
803
- 'absolute',
804
- 1,
805
- 1024 * 1000,
806
- ])
807
- self.charts['tablespace_usage'].add_dimension(
808
- [
809
- '{0}_tablespace_used'.format(name),
810
- name,
811
- 'absolute',
812
- 1,
813
- 1024 * 1000,
814
- ])
815
- self.charts['tablespace_usage_in_percent'].add_dimension(
816
- [
817
- '{0}_tablespace_used_in_percent'.format(name),
818
- name,
819
- 'absolute',
820
- 1,
821
- 1000,
822
- ])
823
- self.charts['allocated_size'].add_dimension(
824
- [
825
- '{0}_allocated_size'.format(name),
826
- name,
827
- 'absolute',
828
- 1,
829
- 1000,
830
- ])
831
- self.charts['allocated_usage'].add_dimension(
832
- [
833
- '{0}_allocated_used'.format(name),
834
- name,
835
- 'absolute',
836
- 1,
837
- 1000,
838
- ])
839
- self.charts['allocated_usage_in_percent'].add_dimension(
840
- [
841
- '{0}_allocated_used_in_percent'.format(name),
842
- name,
843
- 'absolute',
844
- 1,
845
- 1000,
846
- ])
src/collectors/python.d.plugin/oracledb/oracledb.conf
deleted
-88
@@ -1,88 +0,0 @@
1
-# netdata python.d.plugin configuration for oracledb
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, oracledb also supports the following:
63
-#
64
-# user: username # the username for the user account. Required.
65
-# password: password # the password for the user account. Required.
66
-# server: localhost:1521 # the IP address or hostname (and port) of the Oracle Database Server. Required.
67
-# service: XE # the Oracle Database service name. Required. To view the services available on your server,
68
-# run this query: `select SERVICE_NAME from gv$session where sid in (select sid from V$MYSTAT)`.
69
-# protocol: tcp/tcps # one of the strings "tcp" or "tcps" indicating whether to use unencrypted network traffic
70
-# or encrypted network traffic
71
-#
72
-# ----------------------------------------------------------------------
73
-# AUTO-DETECTION JOBS
74
-# only one of them will run (they have the same name)
75
-
76
-#local:
77
-# user: 'netdata'
78
-# password: 'secret'
79
-# server: 'localhost:1521'
80
-# service: 'XE'
81
-# protocol: 'tcps'
82
-
83
-#remote:
84
-# user: 'netdata'
85
-# password: 'secret'
86
-# server: '10.0.0.1:1521'
87
-# service: 'XE'
88
-# protocol: 'tcps'
src/collectors/python.d.plugin/python.d.conf
+1
-1
@@ -29,7 +29,6 @@ gc_interval: 300
29
# this is just an example
30
go_expvar: no
31
# haproxy: yes
32
-# oracledb: yes
32
# pandas: yes
33
# retroshare: yes
34
# smartd_log: yes
@@ -65,6 +64,7 @@ nginx: no # Removed (replaced with go.d/nginx).
64
nsd: no # Removed (replaced with go.d/nsd).
65
nvidia_smi: no # Removed (replaced with go.d/nvidia_smi).
66
openldap: no # Removed (replaced with go.d/openldap).
67
+oracledb: no # Removed (replaced with go.d/oracledb).
68
postfix: no # Removed (replaced with go.d/postfix).
69
postgres: no # Removed (replaced with go.d/postgres).
70
proxysql: no # Removed (replaced with go.d/proxysql).