summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin')
-rw-r--r--collectors/python.d.plugin/oracledb/README.md15
-rw-r--r--collectors/python.d.plugin/oracledb/oracledb.chart.py57
-rw-r--r--collectors/python.d.plugin/oracledb/oracledb.conf10
-rw-r--r--collectors/python.d.plugin/smartd_log/smartd_log.conf1
-rw-r--r--collectors/python.d.plugin/tor/tor.chart.py4
-rw-r--r--collectors/python.d.plugin/tor/tor.conf2
6 files changed, 54 insertions, 35 deletions
diff --git a/collectors/python.d.plugin/oracledb/README.md b/collectors/python.d.plugin/oracledb/README.md
index 722c77b7..315816de 100644
--- a/collectors/python.d.plugin/oracledb/README.md
+++ b/collectors/python.d.plugin/oracledb/README.md
@@ -13,8 +13,7 @@ Monitors the performance and health metrics of the Oracle database.
## Requirements
-- `cx_Oracle` package.
-- Oracle Client (using `cx_Oracle` requires Oracle Client libraries to be installed).
+- `oracledb` package.
It produces following charts:
@@ -53,18 +52,13 @@ It produces following charts:
To use the Oracle module do the following:
-1. Install `cx_Oracle` package ([link](https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html)).
+1. Install `oracledb` package ([link](https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html)).
-2. Install Oracle Client libraries
- ([link](https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#install-oracle-client)).
-
-3. Create a read-only `netdata` user with proper access to your Oracle Database Server.
+2. Create a read-only `netdata` user with proper access to your Oracle Database Server.
Connect to your Oracle database with an administrative user and execute:
-```
-ALTER SESSION SET "_ORACLE_SCRIPT"=true;
-
+```SQL
CREATE USER netdata IDENTIFIED BY <PASSWORD>;
GRANT CONNECT TO netdata;
@@ -88,6 +82,7 @@ local:
server: 'localhost:1521'
service: 'XE'
+
remote:
user: 'netdata'
password: 'secret'
diff --git a/collectors/python.d.plugin/oracledb/oracledb.chart.py b/collectors/python.d.plugin/oracledb/oracledb.chart.py
index 28ef8db1..455cf270 100644
--- a/collectors/python.d.plugin/oracledb/oracledb.chart.py
+++ b/collectors/python.d.plugin/oracledb/oracledb.chart.py
@@ -8,11 +8,18 @@ from copy import deepcopy
from bases.FrameworkServices.SimpleService import SimpleService
try:
- import cx_Oracle
+ import oracledb as cx_Oracle
- HAS_ORACLE = True
+ HAS_ORACLE_NEW = True
+ HAS_ORACLE_OLD = False
except ImportError:
- HAS_ORACLE = False
+ HAS_ORACLE_NEW = False
+ try:
+ import cx_Oracle
+
+ HAS_ORACLE_OLD = True
+ except ImportError:
+ HAS_ORACLE_OLD = False
ORDER = [
'session_count',
@@ -187,7 +194,7 @@ CHARTS = {
},
}
-CX_CONNECT_STRING = "{0}/{1}@//{2}/{3}"
+CX_CONNECT_STRING_OLD = "{0}/{1}@//{2}/{3}"
QUERY_SYSTEM = '''
SELECT
@@ -322,6 +329,7 @@ class Service(SimpleService):
self.password = configuration.get('password')
self.server = configuration.get('server')
self.service = configuration.get('service')
+ self.protocol = configuration.get('protocol', 'tcps')
self.alive = False
self.conn = None
self.active_tablespaces = set()
@@ -330,18 +338,25 @@ class Service(SimpleService):
if self.conn:
self.conn.close()
self.conn = None
-
- try:
- self.conn = cx_Oracle.connect(
- CX_CONNECT_STRING.format(
- self.user,
- self.password,
- self.server,
- self.service,
- ))
- except cx_Oracle.DatabaseError as error:
- self.error(error)
- return False
+ if HAS_ORACLE_NEW:
+ try:
+ self.conn = cx_Oracle.connect(
+ f'{self.user}/{self.password}@{self.protocol}://{self.server}/{self.service}')
+ except cx_Oracle.DatabaseError as error:
+ self.error(error)
+ return False
+ else:
+ try:
+ self.conn = cx_Oracle.connect(
+ CX_CONNECT_STRING_OLD.format(
+ self.user,
+ self.password,
+ self.server,
+ self.service,
+ ))
+ except cx_Oracle.DatabaseError as error:
+ self.error(error)
+ return False
self.alive = True
return True
@@ -350,15 +365,15 @@ class Service(SimpleService):
return self.connect()
def check(self):
- if not HAS_ORACLE:
- self.error("'cx_Oracle' package is needed to use oracledb module")
+ if not HAS_ORACLE_NEW and not HAS_ORACLE_OLD:
+ self.error("'oracledb' package is needed to use oracledb module")
return False
if not all([
self.user,
self.password,
self.server,
- self.service,
+ self.service
]):
self.error("one of these parameters is not specified: user, password, server, service")
return False
@@ -812,7 +827,7 @@ class Service(SimpleService):
'absolute',
1,
1000,
- ])
+ ])
self.charts['allocated_usage'].add_dimension(
[
'{0}_allocated_used'.format(name),
@@ -820,7 +835,7 @@ class Service(SimpleService):
'absolute',
1,
1000,
- ])
+ ])
self.charts['allocated_usage_in_percent'].add_dimension(
[
'{0}_allocated_used_in_percent'.format(name),
diff --git a/collectors/python.d.plugin/oracledb/oracledb.conf b/collectors/python.d.plugin/oracledb/oracledb.conf
index 62571729..027215da 100644
--- a/collectors/python.d.plugin/oracledb/oracledb.conf
+++ b/collectors/python.d.plugin/oracledb/oracledb.conf
@@ -63,9 +63,11 @@
#
# user: username # the username for the user account. Required.
# password: password # the password for the user account. Required.
-# server: localhost:1521 # the IP address or hostname of the Oracle Database Server. Required.
+# server: localhost:1521 # the IP address or hostname (and port) of the Oracle Database Server. Required.
# service: XE # the Oracle Database service name. Required. To view the services available on your server,
-# run this query: `SELECT value FROM v$parameter WHERE name='service_names'`.
+# run this query: `select SERVICE_NAME from gv$session where sid in (select sid from V$MYSTAT)`.
+# protocol: tcp/tcps # one of the strings "tcp" or "tcps" indicating whether to use unencrypted network traffic
+# or encrypted network traffic
#
# ----------------------------------------------------------------------
# AUTO-DETECTION JOBS
@@ -76,9 +78,11 @@
# password: 'secret'
# server: 'localhost:1521'
# service: 'XE'
+# protocol: 'tcps'
#remote:
# user: 'netdata'
# password: 'secret'
# server: '10.0.0.1:1521'
-# service: 'XE' \ No newline at end of file
+# service: 'XE'
+# protocol: 'tcps'
diff --git a/collectors/python.d.plugin/smartd_log/smartd_log.conf b/collectors/python.d.plugin/smartd_log/smartd_log.conf
index 6c01d953..3e81317f 100644
--- a/collectors/python.d.plugin/smartd_log/smartd_log.conf
+++ b/collectors/python.d.plugin/smartd_log/smartd_log.conf
@@ -63,6 +63,7 @@
#
# log_path: '/path/to/smartd_logs' # path to smartd log files. Default is /var/log/smartd
# exclude_disks: 'PATTERN1 PATTERN2' # space separated patterns. If the pattern is in the drive name, the module will not collect data for it.
+# age: 30 # time in minutes since the last dump to file. If smartd has not dumped data within this time the job exits.
#
# ----------------------------------------------------------------------
diff --git a/collectors/python.d.plugin/tor/tor.chart.py b/collectors/python.d.plugin/tor/tor.chart.py
index 8dc021a6..f7bc2d79 100644
--- a/collectors/python.d.plugin/tor/tor.chart.py
+++ b/collectors/python.d.plugin/tor/tor.chart.py
@@ -17,6 +17,7 @@ except ImportError:
STEM_AVAILABLE = False
DEF_PORT = 'default'
+DEF_ADDR = '127.0.0.1'
ORDER = [
'traffic',
@@ -41,6 +42,7 @@ class Service(SimpleService):
self.order = ORDER
self.definitions = CHARTS
self.port = self.configuration.get('control_port', DEF_PORT)
+ self.addr = self.configuration.get('control_addr', DEF_ADDR)
self.password = self.configuration.get('password')
self.use_socket = isinstance(self.port, str) and self.port != DEF_PORT and not self.port.isdigit()
self.conn = None
@@ -78,7 +80,7 @@ class Service(SimpleService):
def connect_via_port(self):
try:
- self.conn = stem.control.Controller.from_port(port=self.port)
+ self.conn = stem.control.Controller.from_port(address=self.addr, port=self.port)
except (stem.SocketError, ValueError) as error:
self.error(error)
diff --git a/collectors/python.d.plugin/tor/tor.conf b/collectors/python.d.plugin/tor/tor.conf
index bf09b21f..c7c98dc0 100644
--- a/collectors/python.d.plugin/tor/tor.conf
+++ b/collectors/python.d.plugin/tor/tor.conf
@@ -61,6 +61,7 @@
#
# Additionally to the above, tor plugin also supports the following:
#
+# control_addr: 'address' # tor control IP address (defaults to '127.0.0.1')
# control_port: 'port' # tor control port
# password: 'password' # tor control password
#
@@ -71,6 +72,7 @@
# local_tcp:
# name: 'local'
# control_port: 9051
+# control_addr: 127.0.0.1
# password: <password>
#
# local_socket: