This repository has been archived by the owner on Feb 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to Readme; System D examples (#173)
* Update README.md Added additional comments for DATA_SOURCE_NAME; Added mandatory environment variables for systemd integration Fixed /etc path; Add ASM instance connection example Linux System D configuration example Few ASM instance metric template: diskgroup size & usage; asm disks i/o stats (can be summarized by diskgroup using Prometheus GraphQL) Co-authored-by: Голиков Сергей Николаевич <[email protected]> Co-authored-by: Yannig <[email protected]>
- Loading branch information
1 parent
406f5d9
commit 94b8778
Showing
4 changed files
with
199 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
[[metric]] | ||
context = "diskgroup_size" | ||
labels = [ "inst_id", "node_name" , "instance_name", "diskgroup_name" ] | ||
metricsdesc = { total = "Total size of ASM disk group in MB.", free = "Free space available on ASM disk group in MB." } | ||
request = ''' | ||
SELECT instance_number AS inst_id, | ||
host_name AS node_name, | ||
instance_name, | ||
name AS diskgroup_name, | ||
total_mb * 1024 * 1024 AS total, | ||
free_mb * 1024 * 1024 AS free | ||
FROM v$asm_diskgroup_stat, v$instance | ||
''' | ||
ignorezeroresult = true | ||
|
||
[[metric]] | ||
context = "asmuptime" | ||
labels = [ "inst_id", "node_name", "instance_name"] | ||
metricsdesc = { uptime = "ASM uptime" } | ||
request = ''' | ||
SELECT instance_number AS inst_id, | ||
host_name AS node_name, | ||
instance_name, | ||
(SYSDATE - startup_time) * 86400 AS uptime | ||
FROM v$instance | ||
''' | ||
|
||
#[[metric]] | ||
#context = "asm_dg_stat" | ||
#labels = [ "inst_id", "diskgroup_name", "node_name", "instance_name" ] | ||
#metricsdesc = { reads = "Total number of I/O read requests for the DG.", writes = "Total number of I/O write requests for the DG.", bytes_read = "Total number of bytes read from the DG", bytes_written = "Total number of bytes written from the DG", iops = "Total number of I/O requests for the DG" } | ||
#metricstype = { reads = "counter", writes = "counter", bytes_read = "counter", bytes_written = "counter", iops = "counter" } | ||
#request = ''' | ||
# SELECT i.instance_number AS inst_id, | ||
# i.host_name AS node_name, | ||
# i.instance_name, | ||
# g.name AS diskgroup_name, | ||
# SUM (ds.reads) AS reads, | ||
# SUM (ds.writes) AS writes, | ||
# SUM (ds.bytes_read) AS bytes_read, | ||
# SUM (ds.bytes_written) AS bytes_written, | ||
# SUM (ds.reads + ds.writes) AS iops | ||
# FROM v$asm_disk_stat ds, v$asm_diskgroup_stat g, v$instance i | ||
# WHERE ds.mount_status = 'CACHED' AND ds.group_number = g.group_number | ||
#GROUP BY i.instance_number, | ||
# i.host_name, | ||
# i.instance_name, | ||
# g.name | ||
#''' | ||
|
||
[[metric]] | ||
context = "asm_disk_stat" | ||
labels = [ "inst_id", "node_name", "instance_name", "diskgroup_name", "disk_number", "failgroup", "path" ] | ||
metricsdesc = { reads = "Total number of I/O read requests for the DG.", writes = "Total number of I/O write requests for the DG.", read_time = "Total I/O time (in hundreths of a second) for read requests for the disk", write_time = "Total I/O time (in hundreths of a second) for write requests for the disk", bytes_read = "Total number of bytes read from the DG", bytes_written = "Total number of bytes written from the DG", iops = "Total number of I/O requests for the DG" } | ||
metricstype = { reads = "counter", writes = "counter", bytes_read = "counter", read_time = "counter", write_time = "counter", bytes_written = "counter", iops = "counter" } | ||
request = ''' | ||
SELECT i.instance_number AS inst_id, | ||
i.host_name AS node_name, | ||
i.instance_name, | ||
g.name AS diskgroup_name, | ||
ds.disk_number AS disk_number, | ||
ds.failgroup AS failgroup, | ||
ds.reads AS reads, | ||
ds.writes AS writes, | ||
ds.read_time * 1000 AS read_time, | ||
ds.write_time * 1000 AS write_time, | ||
ds.bytes_read AS bytes_read, | ||
ds.bytes_written AS bytes_written, | ||
REGEXP_REPLACE (ds.PATH, '.*/\', '\') AS PATH, | ||
ds.reads + ds.writes AS iops | ||
FROM v$asm_disk_stat ds, v$asm_diskgroup_stat g, v$instance i | ||
WHERE ds.mount_status = 'CACHED' AND ds.group_number = g.group_number | ||
''' | ||
|
||
[[metric]] | ||
context = "asm_space_consumers" | ||
labels = [ "inst_id", "diskgroup_name", "node_name", "instance_name", "sid", "file_type" ] | ||
metricsdesc = { size_mb = "Total space usage by db by file_type" , files = "Number of files by db by type" } | ||
request = ''' | ||
SELECT i.instance_number AS inst_id, | ||
i.host_name AS node_name, | ||
i.instance_name, | ||
gname AS diskgroup_name, | ||
dbname AS sid, | ||
file_type, | ||
ROUND (SUM (space) / 1024 / 1024) size_mb, | ||
COUNT (*) AS files | ||
FROM v$instance i, | ||
(SELECT gname, | ||
REGEXP_SUBSTR (full_alias_path, | ||
'[[:alnum:]_]*', | ||
1, | ||
4) dbname, | ||
file_type, | ||
space, | ||
aname, | ||
system_created, | ||
alias_directory | ||
FROM ( SELECT CONCAT ('+' || gname, | ||
SYS_CONNECT_BY_PATH (aname, '/')) | ||
full_alias_path, | ||
system_created, | ||
alias_directory, | ||
file_type, | ||
space, | ||
LEVEL, | ||
gname, | ||
aname | ||
FROM (SELECT b.name gname, | ||
a.parent_index pindex, | ||
a.name aname, | ||
a.reference_index rindex, | ||
a.system_created, | ||
a.alias_directory, | ||
c.TYPE file_type, | ||
c.space | ||
FROM v$asm_alias a, v$asm_diskgroup b, v$asm_file c | ||
WHERE a.group_number = b.group_number | ||
AND a.group_number = c.group_number(+) | ||
AND a.file_number = c.file_number(+) | ||
AND a.file_incarnation = c.incarnation(+)) | ||
START WITH (MOD (pindex, POWER (2, 24))) = 0 | ||
AND rindex IN | ||
(SELECT a.reference_index | ||
FROM v$asm_alias a, v$asm_diskgroup b | ||
WHERE a.group_number = | ||
b.group_number | ||
AND (MOD (a.parent_index, | ||
POWER (2, 24))) = | ||
0) | ||
CONNECT BY PRIOR rindex = pindex) | ||
WHERE NOT file_type IS NULL AND system_created = 'Y') | ||
GROUP BY i.instance_number, | ||
i.host_name, | ||
i.instance_name, | ||
gname, | ||
dbname, | ||
file_type | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[Unit] | ||
Description=Service for oracle asm telemetry client | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=simple | ||
Environment="DATA_SOURCE_NAME=asmsnmp/password@//host:1521/+ASM?as=sysdba" | ||
Environment="LD_LIBRARY_PATH=/u01/app/oracle/product/19.0.0/dbhome_1/lib" | ||
Environment="ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1" | ||
User=oracledb_exporter | ||
Group=oracledb_exporter | ||
ExecStart=/usr/local/bin/oracledb_exporter \ | ||
--default.metrics "/etc/oracledb_exporter/default-asm-metrics.toml" \ | ||
--log.level "error" \ | ||
--web.listen-address 0.0.0.0:9163 \ | ||
--log.format "logger:syslog?appname=oracleasm_exporter&local=7" | ||
|
||
KillMode=process | ||
RemainAfterExit=no | ||
Restart=on-failure | ||
RestartSec=5s | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Ansible managed | ||
# | ||
|
||
[Unit] | ||
Description=Service for oracle telemetry client | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=simple | ||
Environment="DATA_SOURCE_NAME=dbsnmp/password@//host:1521/service?transport_connect_timeout=5&retry_count=3" | ||
Environment="LD_LIBRARY_PATH=/u01/app/oracle/product/19.0.0/dbhome_1/lib" | ||
Environment="ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1" | ||
#Environment="PATH=$PATH:/u01/app/oracle/product/19.0.0/dbhome_1/bin" | ||
#Environment="TNS_ADMIN=/u01/app/oracle/product/19.0.0/dbhome_1/network/admin" | ||
User=oracledb_exporter | ||
Group=oracledb_exporter | ||
ExecStart=/usr/local/bin/oracledb_exporter \ | ||
--default.metrics "/etc/oracledb_exporter/default-metrics.toml" \ | ||
--log.level "error" \ | ||
--web.listen-address 0.0.0.0:9161 \ | ||
--log.format "logger:syslog?appname=oracledb_exporter&local=7" | ||
|
||
KillMode=process | ||
RemainAfterExit=no | ||
Restart=on-failure | ||
RestartSec=5s | ||
|
||
[Install] | ||
WantedBy=multi-user.target |