oracledb_exporter连接信息怎么配置
时间: 2023-12-05 12:04:27 浏览: 94
oracle配置连接数据库
要配置oracledb_exporter连接信息,您需要在orledb_exporter的配置文件中指定以下参数:
1. `data_source_name`:这是连接数据库的字符串,格式为`username/password@hostname:port/service_name`。
2. `query:这是要执行的SQL查询语句。
以下是一个示例配置文件:
```
global:
scrape_interval: 1m
scrape_configs:
- job_name: 'oracle'
scrape_interval: 1m
metrics_path: /metrics
static_configs:
- targets: ['localhost:9161']
params:
module: [prometheus_oracledb_exporter]
relabel_configs:
- source_labels: [__address__]
regex: '(.*):.*'
target_label: __param_instance
replacement: '${1}:1521/orclpdb1'
action: replace
- source_labels: [__param_instance]
regex: '(.*)'
target_label: instance
replacement: '${1}'
action: replace
- source_labels: []
regex: '.*'
target_label: __address__
replacement: 'localhost:9161'
action: replace
oracle:
data_source_name: 'system/[password]@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclpdb1)))'
query: |
SELECT owner, table_name, column_name, data_type
FROM all_tab_columns
WHERE owner NOT IN ('SYS', 'SYSTEM')
ORDER BY owner, table_name, column_name
```
请注意,您需要将`data_source_name`和`query`参数替换为您的数据库连接信息和查询语句。
阅读全文