-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MSSQLServer Monitoring Doc (#707)
Signed-off-by: Neaj Morshad <[email protected]>
- Loading branch information
1 parent
fb27d6b
commit 6d900f1
Showing
5 changed files
with
601 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
docs/examples/mssqlserver/monitoring/mssql-monitoring.yaml
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,48 @@ | ||
apiVersion: kubedb.com/v1alpha2 | ||
kind: MSSQLServer | ||
metadata: | ||
name: mssql-monitoring | ||
namespace: demo | ||
spec: | ||
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: | ||
exporter: | ||
port: 9399 | ||
resources: | ||
limits: | ||
memory: 512Mi | ||
requests: | ||
cpu: 200m | ||
memory: 256Mi | ||
securityContext: | ||
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 |
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,10 @@ | ||
--- | ||
title: Monitoring Microsoft SQL Server | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: ms-monitoring | ||
name: Monitoring | ||
parent: guides-mssqlserver | ||
weight: 50 | ||
menu_name: docs_{{ .version }} | ||
--- |
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,104 @@ | ||
--- | ||
title: MSSQLServer Monitoring Overview | ||
description: MSSQLServer Monitoring Overview | ||
menu: | ||
docs_{{ .version }}: | ||
identifier: ms-monitoring-overview | ||
name: Overview | ||
parent: ms-monitoring | ||
weight: 10 | ||
menu_name: docs_{{ .version }} | ||
section_menu_id: guides | ||
--- | ||
|
||
> New to KubeDB? Please start [here](/docs/README.md). | ||
# 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 CR to enable monitoring. | ||
|
||
## Overview | ||
|
||
KubeDB uses Prometheus [exporter](https://prometheus.io/docs/instrumenting/exporters/#databases) images to export Prometheus metrics for respective databases. Following diagram shows the logical flow of database monitoring with KubeDB. | ||
|
||
<p align="center"> | ||
<img alt="Database Monitoring Flow" src="/docs/images/concepts/monitoring/database-monitoring-overview.svg"> | ||
</p> | ||
|
||
When a user creates a database CR 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 | ||
|
||
In order to enable monitoring for a database, you have to configure `spec.monitor` section. KubeDB provides following options to configure `spec.monitor` section: | ||
|
||
| Field | Type | Uses | | ||
| -------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `spec.monitor.agent` | `Required` | Type of the monitoring agent that will be used to monitor this database. It can be `prometheus.io/builtin` or `prometheus.io/operator`. | | ||
| `spec.monitor.prometheus.exporter.port` | `Optional` | Port number where the exporter side car will serve metrics. | | ||
| `spec.monitor.prometheus.exporter.args` | `Optional` | Arguments to pass to the exporter sidecar. | | ||
| `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` CR. | | ||
| `spec.monitor.prometheus.serviceMonitor.interval` | `Optional` | Interval at which metrics should be scraped. | | ||
|
||
## Sample Configuration | ||
|
||
A sample YAML for MSSQLServer CR 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/v1alpha2 | ||
kind: MSSQLServer | ||
metadata: | ||
name: mssql-monitoring | ||
namespace: demo | ||
spec: | ||
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: | ||
exporter: | ||
port: 9399 | ||
resources: | ||
limits: | ||
memory: 512Mi | ||
requests: | ||
cpu: 200m | ||
memory: 256Mi | ||
securityContext: | ||
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 | ||
``` | ||
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` CR in `monitoring` namespace and this `ServiceMonitor` will have `release: prometheus` label. | ||
|
||
## Next Steps | ||
|
||
- Learn how to monitor Microsoft SQL Server with KubeDB using [Prometheus operator](/docs/guides/mssqlserver/monitoring/using-prometheus-operator.md). |
Oops, something went wrong.