DBSExporter is an add-on designed for monitoring PostgreSQL, MongoDB, RabbitMQ, Redis, and S3 storage databases.
The installation of the add-on consists of the following steps:
- Download the Helm chart and configuration file.
- Create a configuration token to use MinIO metrics for Prometheus.
- Fill in the configuration file.
- Install Node Exporter on the database servers.
- Install the DBSExporter chart using Helm in the Kubernetes cluster.
Step 1: Download the Helm chart and configuration file
To install via the internet, obtain the values-dbsexporter.yaml configuration file by executing the following command:
helm repo add hummix https://charts.hummix.co
helm repo update
helm show values hummix/dbsexporter > values-dbsexporter.yaml
For offline installation without internet access
- On a computer with internet access, download the archive of the latest version of the DBSExporter chart from the HUMMIX repository using the command:
helm repo add hummix https://charts.hummix.co
helm repo update
helm pull hummix/dbsexporter
- Copy the obtained chart archive
dbsexporter-X.Y.Z.tgz to the server where the installation will take place.
- Unpack the chart, and copy the default configuration file
values.yaml to values-dbsexporter.yaml.
tar -xf dbsexporter-X.Y.Z.tgz
cp dbsexporter/values.yaml values-dbsexporter.yaml
|
Step 2: Create a configuration token to use MinIO metrics for Prometheus
Create alias and send the command to generate a token by executing the following:
mc alias set my_alias http://minio.local accessKey secretKey
mc admin prometheus generate my_alias
Step 3: Fill in the configuration file
Fill in the configuration file to install DBSExporter
Use the generated token when configuring the MinIO connection in the values-dbsexporter.yaml file.
dbsexporter:
# Enable chart imports
grafana-dashboards:
dashboards:
enabled: true
grafanaFolder: dbs
# MinIO connection settings
prometheus-minio-exporter:
nameOverride: minio
instances:
- name: minio-job
token: generated_token
path: /minio/v2/metrics/cluster
host: 'minio.local'
port: 80
scheme: http
# MongoDB connection settings
prometheus-mongodb-exporter:
nameOverride: mongo
instances:
- name: mongodb
uri: "mongodb://mongodb:27017"
# Postgres connection settings
prometheus-postgres-exporter:
nameOverride: postgres
config:
instances:
- name: postgres
# Specify a data source amd a data source secret.
host: 'example.ru'
user: postgres
userSecret: {}
# Secret name
# name:
# User key inside the secret
# key:
password: postgres_password
# Specify passwordFile if the database password is stored in a file.
passwordFile: ''
# Specify passwordSecret if the database password is stored in a secret.
passwordSecret: {}
# Secret name
# name:
# Password key inside the secret
# key:
pgpassfile: ''
# If pgpassfile is set, it is used to initialize the environment variable PGPASSFILE.
port: "5432"
database: ''
sslmode: disable
extraParams: ''
# rabbitMQ connection settings
prometheus-rabbitmq-exporter:
nameOverride: rabbitmq
rabbitmq:
instances:
- name: rabbitmq
url: 'http://rabbitmq:15672'
user: rabbitmq_user
password: rabbitmq_password
# The specified password will be placed in Secret:
existingPasswordSecret: rabbitmq-secret
existingPasswordSecretKey: password
capabilities: bert,no_sort
include_queues: ".*"
include_vhost: ".*"
skip_queues: "^$"
skip_verify: "false"
skip_vhost: "^$"
exporters: "exchange,node,overview,queue"
output_format: "TTY"
timeout: 60
max_queues: 0
excludeMetrics: ""
# Allows overriding environment variables using an external ConfigMap.
configMapOverrideReference: ""
# Redis connection setting
prometheus-redis-exporter:
nameOverride: redis
instances:
- name: redis1
redisAddress: 'redis://redis:6379/0'
|
Configuring connection parameters to a private registry for installation in a closed environment without internet access
To connect to the private registry:
- Download HUMMIX images and upload them to a local image registry. Refer to Download HUMMIX images for more details.
- Specify the address and path for the parameter
image.repository.
- Provide the name of the secret with access rights to the private registry in the parameter
image.pullSecrets. The secret must be manually created and encrypted in Base64.
prometheus-minio-exporter:
# Connection parameters to the private registry
image:
# Address and path for the private registry
repository: registry.example.com/minio_exporter
# tag: "1.0.15"
imagePullSecrets:
- myRegistryKeySecretName
prometheus-mongodb-exporter:
# Connection parameters to the private registry
image:
# Address and path for the private registry
repository: registry.example.com/mongodb_exporter
# tag: "0.31.0"
imagePullSecrets:
- myRegistryKeySecretName
prometheus-postgres-exporter:
# Connection parameters to the private registry
image:
# Address and path for the private registry
repository: registry.example.com/postgres-exporter
# tag: "v0.13.2"
imagePullSecrets:
- myRegistryKeySecretName
# rabbitMQ connection settings
prometheus-rabbitmq-exporter:
# Connection parameters to the private registry
image:
# Address and path for the private registry
repository: registry.example.com/rabbitmq-exporter
# tag: "v0.29.0"
imagePullSecrets:
- myRegistryKeySecretName
prometheus-redis-exporter:
# Connection parameters to the private registry
# image:
# Address and path for the private registry
repository: registry.example.com/redis_exporter
# tag: "v1.44.0"
imagePullSecrets:
- myRegistryKeySecretName
Where repository format is: address — registry.example.com.
|
You can add the following additional settings in the values-dbsexporter.yaml configuration file:
- Connect several databases both internal and external to DBSExporter. To do this, duplicate the parameters of the
instances block and configure the connection parameters for each replica. For example:
instances:
- name: mongodb-1
uri: "mongodb://mongodb-1:27017"
- name: mongodb-2
uri: "mongodb://mongodb-2:27017"
- Connect Deckhouse with DBSExporter. For example:
global:
provisioner: "deckhouse"
Step 4: Install Node Exporter on the database servers
To monitor database servers, install Node Exporter. For this:
- Download Node Exporter on the database server:
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
- Unpack the archive downloaded on the previous step:
tar xvf node_exporter-1.8.2.linux-amd64.tar.gz && cd node_exporter-1.8.2.linux-amd64
- Copy the
node_exporter file:
sudo cp node_exporter /usr/local/bin/
- Create a user for Node Exporter:
sudo useradd --no-create-home --shell /bin/false nodeusr
- Define the owner for the
node_exporter executable file:
sudo chown -R nodeusr:nodeusr /usr/local/bin/node_exporter;
- Create the
node_exporter.service file to launch Node Exporter as a service:
cat <<EOF | sudo tee /etc/systemd/system/node_exporter.service;
[Unit]
Description=NodeExporter
[Service]
TimeoutStartSec=0
User=nodeusr
ExecStart=/usr/local/bin/node_exporter \
--web.listen-address=:9100
[Install]
WantedBy=multi-user.target
EOF
- Reload
systemd configuration:
sudo systemctl daemon-reload
- Launch the
node_exporter.service service:
sudo systemctl enable --now node_exporter.service
After installing Node Exporter, fill in the parameters in the values-dbsexporter.yaml configuration file to monitor the database servers. In this case, host addresses will be extracted from the instances points of the configuration file. Example of how to set the parameters:
# Settings of node exporter
nodeExporter:
enabled: true
port: 9100
relabelings: {}
Step 5: Install the DBSExporter chart using Helm in the Kubernetes cluster
Execute the installation of the DBSExporter chart in namespace monitoring.
For online installation:
helm upgrade --install -n monitoring dbsexporter hummix/dbsexporter -f values-dbsexporter.yaml
For offline installation without internet access, navigate to the directory with the downloaded chart and execute the command:
helm upgrade --install dbsexporter ./dbsexporter -f values-dbsexporter.yaml -n monitoring