Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,21 @@

Please refer to the Unified Observability in Grafana with converged Oracle Database Workshop at http://bit.ly/unifiedobservability and it's corresponding repos https://github.com/oracle/microservices-datadriven/tree/main/grabdish/observability/db-metrics-exporter for complete examples.

A simple setup in Kubernetes involves the following steps (with the assumption that Prometheus is already installed)

1. Change the %EXPORTER_NAME% value in all yaml files in this directory. This can be any value such as "helloworld".

2. Change the database connection information in the unified-observability-exporter-deployment.yaml file.
- The only value required is the DATA_SOURCE_NAME which takes the format `USER/PASSWORD@DB_SERVICE_URL`
- In the example the connection information is obtained from a mount created from the wallet obtained from a Kubernetes secret named `%db-wallet-secret%`
- In the example the password is obtained from a Kubernetes secret named `dbuser`

3. Copy a config file to unified-observability-%EXPORTER_NAME%-exporter-metrics.toml in currently directly
- Eg, `cp ../metrics/aq-metrics.toml unified-observability-helloworld-exporter-metrics.toml`
- This will be used to create a configmap that is referenced in the deployment.

4. Run `./update-and-redeploy-unified-observabiity-exporter.sh`

5. You should see metrics being exported from within the container at http://localhost:9161/metrics and likewise from the Kubnernetes service at http://unified-observability-exporter-service-%EXPORTER_NAME%:9161/metrics

More examples will be provided here in the near future.
49 changes: 49 additions & 0 deletions examples/unified-observability-exporter-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Copyright (c) 2021 Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
apiVersion: apps/v1
kind: Deployment
metadata:
name: unified-observability-exporter-%EXPORTER_NAME%
spec:
replicas: 1
selector:
matchLabels:
app: unified-observability-exporter-%EXPORTER_NAME%
template:
metadata:
labels:
app: unified-observability-exporter-%EXPORTER_NAME%
spec:
containers:
- name: unified-observability-exporter-%EXPORTER_NAME%
image: container-registry.oracle.com/database/observability-exporter:0.1.0
imagePullPolicy: Always
env:
- name: DEFAULT_METRICS
value: /observability/unified-observability-%EXPORTER_NAME%-exporter-metrics.toml
- name: TNS_ADMIN
value: "/creds"
- name: dbpassword
valueFrom:
secretKeyRef:
name: dbuser
key: dbpassword
optional: true
- name: DATA_SOURCE_NAME
value: "%USER%/$(dbpassword)@%PDB_NAME%_tp"
volumeMounts:
- name: creds
mountPath: /creds
- name: config-volume
mountPath: /observability/unified-observability-%EXPORTER_NAME%-exporter-metrics.toml
subPath: unified-observability-%EXPORTER_NAME%-exporter-metrics.toml
ports:
- containerPort: 8080
restartPolicy: Always
volumes:
- name: creds
secret:
secretName: %db-wallet-secret%
- name: config-volume
configMap:
name: unified-observability-%EXPORTER_NAME%-exporter-config
14 changes: 14 additions & 0 deletions examples/unified-observability-exporter-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: unified-observability-exporter-service-%EXPORTER_NAME%
labels:
app: unified-observability-exporter-%EXPORTER_NAME%
release: stable
spec:
type: NodePort
ports:
- port: 9161
name: metrics
selector:
app: unified-observability-exporter-%EXPORTER_NAME%
14 changes: 14 additions & 0 deletions examples/unified-observability-exporter-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: prometheus-unified-observability-exporter-%EXPORTER_NAME%
labels:
app: unified-observability-exporter-%EXPORTER_NAME%
release: stable
spec:
endpoints:
- interval: 20s
port: metrics
selector:
matchLabels:
app: unified-observability-exporter-%EXPORTER_NAME%
17 changes: 17 additions & 0 deletions examples/update-and-redeploy-unified-observabiity-exporter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
## Copyright (c) 2021 Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# add namespace if/as appropriate, eg `kubectl apply -f unified-observability-exporter-deployment.yaml-n mynamespace`

echo delete previous deployment so that deployment is reapplied/deployed after configmap changes for exporter are made...
kubectl delete deployment db-metrics-exporter-orderpdb

echo create configmap for unified-observability-exporter...
kubectl delete configmap unified-observability-exporter-config
kubectl create configmap unified-observability-exporter-config --from-file=unified-observability-%EXPORTER_NAME%-exporter-metrics.toml

kubectl apply -f unified-observability-exporter-deployment.yaml
# the following are unnecessary after initial deploy but in order to keep to a single bash script...
kubectl apply -f unified-observability-exporter-service.yaml
kubectl apply -f unified-observability-exporter-servicemonitor.yaml