Skip to content

Commit

Permalink
Fix overview
Browse files Browse the repository at this point in the history
Signed-off-by: Neaj Morshad <[email protected]>
  • Loading branch information
Neaj-Morshad-101 committed Nov 1, 2024
1 parent 554699a commit 9da9786
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 50 deletions.
8 changes: 4 additions & 4 deletions docs/guides/mssqlserver/monitoring/_index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: Monitoring MSSQLServer
title: Monitoring Microsoft SQL Server
menu:
docs_{{ .version }}:
identifier: ms-monitoring-mssqlserver
identifier: ms-monitoring
name: Monitoring
parent: ms-mssqlserver-guides
weight: 40
parent: guides-mssqlserver
weight: 50
menu_name: docs_{{ .version }}
---
90 changes: 44 additions & 46 deletions docs/guides/mssqlserver/monitoring/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ menu:
docs_{{ .version }}:
identifier: ms-monitoring-overview
name: Overview
parent: ms-monitoring-mssqlserver
parent: ms-monitoring
weight: 10
menu_name: docs_{{ .version }}
section_menu_id: guides
Expand All @@ -15,7 +15,7 @@ section_menu_id: guides
# Monitoring MSSQLServer with KubeDB

KubeDB has native support for monitoring via [Prometheus](https://prometheus.io/). You can use builtin [Prometheus](https://github.com/prometheus/prometheus) scraper or [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator) to monitor KubeDB managed databases. This tutorial will show you how database monitoring works with KubeDB and how to configure Database crd to enable monitoring.
KubeDB has native support for monitoring via [Prometheus](https://prometheus.io/). You can use builtin [Prometheus](https://github.com/prometheus/prometheus) scraper or [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator) to monitor KubeDB managed databases. This tutorial will show you how database monitoring works with KubeDB and how to configure Database CRD to enable monitoring.

## Overview

Expand All @@ -25,7 +25,7 @@ KubeDB uses Prometheus [exporter](https://prometheus.io/docs/instrumenting/expor
  <img alt="Database Monitoring Flow" src="/docs/images/concepts/monitoring/database-monitoring-overview.svg">
</p>

When a user creates a database crd with `spec.monitor` section configured, KubeDB operator provisions the respective database and injects an exporter image as sidecar to the database pod. It also creates a dedicated stats service with name `{database-crd-name}-stats` for monitoring. Prometheus server can scrape metrics using this stats service.
When a user creates a database CRD with `spec.monitor` section configured, KubeDB operator provisions the respective database and injects an exporter image as sidecar to the database pod. It also creates a dedicated stats service with name `{database-crd-name}-stats` for monitoring. Prometheus server can scrape metrics using this stats service.

## Configure Monitoring

Expand All @@ -39,68 +39,66 @@ In order to enable monitoring for a database, you have to configure `spec.monito
| `spec.monitor.prometheus.exporter.env` | `Optional` | List of environment variables to set in the exporter sidecar container. |
| `spec.monitor.prometheus.exporter.resources` | `Optional` | Resources required by exporter sidecar container. |
| `spec.monitor.prometheus.exporter.securityContext` | `Optional` | Security options the exporter should run with. |
| `spec.monitor.prometheus.serviceMonitor.labels` | `Optional` | Labels for `ServiceMonitor` crd. |
| `spec.monitor.prometheus.serviceMonitor.labels` | `Optional` | Labels for `ServiceMonitor` CRD. |
| `spec.monitor.prometheus.serviceMonitor.interval` | `Optional` | Interval at which metrics should be scraped. |

## Sample Configuration

A sample YAML for Redis crd with `spec.monitor` section configured to enable monitoring with [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator) is shown below.
A sample YAML for MSSQLServer CRD with `spec.monitor` section configured to enable monitoring with [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator) is shown below.

```yaml
apiVersion: kubedb.com/v1
kind: Redis
apiVersion: kubedb.com/v1alpha2
kind: MSSQLServer
metadata:
name: sample-redis
namespace: databases
name: mssql-monitoring
namespace: demo
spec:
version: 6.0.20
deletionPolicy: WipeOut
configSecret: # configure Redis to use password for authentication
name: redis-config
storageType: Durable
storage:
storageClassName: default
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
version: "2022-cu12"
replicas: 1
tls:
issuerRef:
name: mssqlserver-ca-issuer
kind: Issuer
apiGroup: "cert-manager.io"
clientTLS: false
monitor:
agent: prometheus.io/operator
prometheus:
serviceMonitor:
labels:
release: prometheus
exporter:
args:
- --redis.password=$(REDIS_PASSWORD)
env:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: _name_of_secret_with_redis_password
key: password # key with the password
port: 9399
resources:
requests:
memory: 512Mi
cpu: 200m
limits:
memory: 512Mi
cpu: 250m
requests:
cpu: 200m
memory: 256Mi
securityContext:
runAsUser: 2000
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsGroup: 10001
runAsNonRoot: true
runAsUser: 10001
seccompProfile:
type: RuntimeDefault
serviceMonitor:
interval: 10s
labels:
release: prometheus
storageType: Durable
storage:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
deletionPolicy: WipeOut
```
Assume that above Redis is configured to use basic authentication. So, exporter image also need to provide password to collect metrics. We have provided it through `spec.monitor.args` field.

Here, we have specified that we are going to monitor this server using Prometheus operator through `spec.monitor.agent: prometheus.io/operator`. KubeDB will create a `ServiceMonitor` crd in `monitoring` namespace and this `ServiceMonitor` will have `release: prometheus` label.
Here, we have specified that we are going to monitor this server using Prometheus operator through `spec.monitor.agent: prometheus.io/operator`. KubeDB will create a `ServiceMonitor` CRD in `monitoring` namespace and this `ServiceMonitor` will have `release: prometheus` label.

## Next Steps

- Learn how to monitor Elasticsearch database with KubeDB using [builtin-Prometheus](/docs/guides/elasticsearch/monitoring/using-builtin-prometheus.md) and using [Prometheus operator](/docs/guides/elasticsearch/monitoring/using-prometheus-operator.md).
- Learn how to monitor MSSQLServer database with KubeDB using [builtin-Prometheus](/docs/guides/mssqlserver/monitoring/using-builtin-prometheus.md) and using [Prometheus operator](/docs/guides/mssqlserver/monitoring/using-prometheus-operator.md).
- Learn how to monitor MySQL database with KubeDB using [builtin-Prometheus](/docs/guides/mysql/monitoring/builtin-prometheus/index.md) and using [Prometheus operator](/docs/guides/mysql/monitoring/prometheus-operator/index.md).
- Learn how to monitor MongoDB database with KubeDB using [builtin-Prometheus](/docs/guides/mongodb/monitoring/using-builtin-prometheus.md) and using [Prometheus operator](/docs/guides/mongodb/monitoring/using-prometheus-operator.md).
- Learn how to monitor Redis server with KubeDB using [builtin-Prometheus](/docs/guides/redis/monitoring/using-builtin-prometheus.md) and using [Prometheus operator](/docs/guides/redis/monitoring/using-prometheus-operator.md).
- Learn how to monitor Memcached server with KubeDB using [builtin-Prometheus](/docs/guides/memcached/monitoring/using-builtin-prometheus.md) and using [Prometheus operator](/docs/guides/memcached/monitoring/using-prometheus-operator.md).
- Learn how to monitor Microsoft SQL Server with KubeDB using [Prometheus operator](/docs/guides/mssqlserver/monitoring/using-prometheus-operator.md).

0 comments on commit 9da9786

Please sign in to comment.