You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+134-4Lines changed: 134 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -603,12 +603,15 @@ You may provide the connection details using these variables:
603
603
604
604
The following example puts the logfile in the current location with the filename `alert.log` and loads the default matrics file (`default-metrics,toml`) from the current location.
605
605
606
-
If you prefer to provide configuration via a [config file](./example-config.yaml), you may do so with the `--config.file` argument. The use of a config file over command line arguments is preferred. If a config file is not provided, the default database connection is managed by command line arguments.
606
+
If you prefer to provide configuration via a [config file](./example-config.yaml), you may do so with the `--config.file` argument. The use of a config file over command line arguments is preferred. If a config file is not provided, the "default" database connection is managed by command line arguments.
607
607
608
608
```yaml
609
609
# Example Oracle Database Metrics Exporter Configuration file.
610
610
# Environment variables of the form ${VAR_NAME} will be expanded.
611
611
612
+
# Example Oracle Database Metrics Exporter Configuration file.
613
+
# Environment variables of the form ${VAR_NAME} will be expanded.
614
+
612
615
databases:
613
616
## Path on which metrics will be served
614
617
# metricsPath: /metrics
@@ -620,8 +623,7 @@ databases:
620
623
password: ${DB_PASSWORD}
621
624
## Database connection url
622
625
url: localhost:1521/freepdb1
623
-
## Metrics scrape interval for this database
624
-
scrapeInterval: 15s
626
+
625
627
## Metrics query timeout for this database, in seconds
626
628
queryTimeout: 5
627
629
@@ -652,8 +654,11 @@ databases:
652
654
# poolMinConnections: 15
653
655
654
656
metrics:
657
+
## How often to scrape metrics. If not provided, metrics will be scraped on request.
658
+
# scrapeInterval: 15s
659
+
## Path to default metrics file.
655
660
default: default-metrics.toml
656
-
#
661
+
## Paths to any custom metrics files
657
662
custom:
658
663
- custom-metrics-example/custom-metrics.toml
659
664
@@ -666,10 +671,135 @@ log:
666
671
# disable: 0
667
672
```
668
673
674
+
### Scraping multiple databases
675
+
676
+
You may scrape as many databases as needed by defining named database configurations in the config file. The following configuration defines two databases, "db1", and "db2"for the metrics exporter.
677
+
678
+
```yaml
679
+
# Example Oracle Database Metrics Exporter Configuration file.
680
+
# Environment variables of the form ${VAR_NAME} will be expanded.
681
+
682
+
databases:
683
+
## Path on which metrics will be served
684
+
# metricsPath: /metrics
685
+
686
+
## As many named database configurations may be defined as needed.
687
+
## It is recommended to define your database config in the config file, rather than using CLI arguments.
688
+
689
+
## Database connection information for the "db1" database.
690
+
db1:
691
+
## Database username
692
+
username: ${DB1_USERNAME}
693
+
## Database password
694
+
password: ${DB1_PASSWORD}
695
+
## Database connection url
696
+
url: localhost:1521/freepdb1
697
+
698
+
## Metrics query timeout for this database, in seconds
699
+
queryTimeout: 5
700
+
701
+
## Rely on Oracle Database External Authentication by network or OS
702
+
# externalAuth: false
703
+
## Database role
704
+
# role: SYSDBA
705
+
## Path to Oracle Database wallet, if using wallet
706
+
# tnsAdmin: /path/to/database/wallet
707
+
708
+
### Connection settings:
709
+
### Either the go-sql or Oracle Database connection pool may be used.
710
+
### To use the Oracle Database connection pool over the go-sql connection pool,
711
+
### set maxIdleConns to zero and configure the pool* settings.
712
+
713
+
### Connection pooling settings for the go-sql connection pool
714
+
## Max open connections for this database using go-sql connection pool
715
+
maxOpenConns: 10
716
+
## Max idle connections for this database using go-sql connection pool
717
+
maxIdleConns: 10
718
+
719
+
### Connection pooling settings for the Oracle Database connection pool
720
+
## Oracle Database connection pool increment.
721
+
# poolIncrement: 1
722
+
## Oracle Database Connection pool maximum size
723
+
# poolMaxConnections: 15
724
+
## Oracle Database Connection pool minimum size
725
+
# poolMinConnections: 15
726
+
db2:
727
+
## Database username
728
+
username: ${DB2_USERNAME}
729
+
## Database password
730
+
password: ${DB2_PASSWORD}
731
+
## Database connection url
732
+
url: localhost:1522/freepdb1
733
+
734
+
## Metrics query timeout for this database, in seconds
735
+
queryTimeout: 5
736
+
737
+
## Rely on Oracle Database External Authentication by network or OS
738
+
# externalAuth: false
739
+
## Database role
740
+
# role: SYSDBA
741
+
## Path to Oracle Database wallet, if using wallet
742
+
# tnsAdmin: /path/to/database/wallet
743
+
744
+
### Connection settings:
745
+
### Either the go-sql or Oracle Database connection pool may be used.
746
+
### To use the Oracle Database connection pool over the go-sql connection pool,
747
+
### set maxIdleConns to zero and configure the pool* settings.
748
+
749
+
### Connection pooling settings for the go-sql connection pool
750
+
## Max open connections for this database using go-sql connection pool
751
+
maxOpenConns: 10
752
+
## Max idle connections for this database using go-sql connection pool
753
+
maxIdleConns: 10
754
+
755
+
### Connection pooling settings for the Oracle Database connection pool
756
+
## Oracle Database connection pool increment.
757
+
# poolIncrement: 1
758
+
## Oracle Database Connection pool maximum size
759
+
# poolMaxConnections: 15
760
+
## Oracle Database Connection pool minimum size
761
+
# poolMinConnections: 15
762
+
763
+
metrics:
764
+
## How often to scrape metrics. If not provided, metrics will be scraped on request.
By default, metrics are scraped from every connected database. To expose only certain metrics on specific databases, configure the `databases` property of a metric. The following metric definition will only be scraped from databases "db2" and "db3":
789
+
790
+
```toml
791
+
[[metric]]
792
+
context = "db_platform"
793
+
labels = [ "platform_name" ]
794
+
metricsdesc = { value = "Database platform" }
795
+
request = '''
796
+
SELECT platform_name, 1 as value FROM v$database
797
+
'''
798
+
databases = [ "db2", "db3" ]
799
+
```
800
+
801
+
If the `databases` array is empty or not provided for a metric, that metric will be scraped from all connected databases.
802
+
673
803
### Using OCI Vault
674
804
675
805
The exporter will read the password from a secret stored in OCI Vault if you set these two environment variables:
0 commit comments