Project: KubeDB by AppsCode (App Definition and Development / Database)
File: overview.md

title: Monitoring KubeDB Operator menu: docs_{{ .version }}: identifier: operator-monitoring-overview name: Overview parent: operator-monitoring weight: 10 menuname: docs{{ .version }} sectionmenuid: setup aliases: /docs/{{ .version }}/setup/operator-monitoring/ KubeDB has native support for monitoring via . You can use builtin scraper or to monitor KubeDB supported databases as well as KubeDB operator itself. This tutorial will show you what metrics KubeDB operator exports and how to enable monitoring for the operator itself. KubeDB operator pod runs an which self hosts such as and . The extension API server exports some metrics in `/metrics` path of TLS secured `8443` port. KubeDB installation process creates a service with same name as KubeDB operator (i.e. `kubedb`) in same namespace as the operator pod. Prometheus server can use `api` endpoint of this service to scrape those metrics. KubeDB operator exports following metrics. API Server Metrics: | Metric Name | Uses | | | | | apiserverauditevent_total | Counter of audit events generated and sent to the audit backend. | | apiserverclientcertificateexpirationseconds | Distribution of the remaining lifetime on the certificate used to authenticate a request. | | apiservercurrentinflight_requests | Maximal number of currently used inflight request limit of this apiserver per request kind in last second. | | apiserverrequestcount | Counter of apiserver requests broken out for each verb, API resource, client, and HTTP response contentType and code. | | apiserverrequestlatencies | Response latency distribution in microseconds for each verb, resource and subresource. | | apiserverrequestlatencies_summary | Response latency summary in microseconds for each verb, resource and subresource. | | authenticateduserrequests | Counter of authenticated requests broken out by username. | Go Metrics: | Metric Name | Uses | | - | | | gogcduration_seconds | A summary of the GC invocation durations. | | go_goroutines | Number of goroutines that currently exist. | | gomemstatsalloc_bytes | Number of bytes allocated and still in use. | | gomemstatsallocbytestotal | Total number of bytes allocated, even if freed. | | gomemstatsbuckhashsys_bytes | Number of bytes used by the profiling bucket hash table. | | gomemstatsfrees_total | Total number of frees. | | gomemstatsgcsysbytes | Number of bytes used for garbage collection system metadata. | | gomemstatsheapallocbytes | Number of heap bytes allocated and still in use. | | gomemstatsheapidlebytes | Number of heap bytes waiting to be used. | | gomemstatsheapinusebytes | Number of heap bytes that are in use. | | gomemstatsheap_objects | Number of allocated objects. | | gomemstatsheapreleasedbytes_total | Total number of heap bytes released to OS. | | gomemstatsheapsysbytes | Number of heap bytes obtained from system. | | gomemstatslastgctime_seconds | Number of seconds since 1970 of last garbage collection. | | gomemstatslookups_total | Total number of pointer lookups. | | gomemstatsmallocs_total | Total number of mallocs. | | gomemstatsmcacheinusebytes | Number of bytes in use by mcache structures. | | gomemstatsmcachesysbytes | Number of bytes used for mcache structures obtained from system. | | gomemstatsmspaninusebytes | Number of bytes in use by mspan

| | gomemstatsmspansysbytes | Number of bytes used for mspan structures obtained from system. | | gomemstatsnextgcbytes | Number of heap bytes when next garbage collection will take place. | | gomemstatsothersysbytes | Number of bytes used for other system allocations. | | gomemstatsstackinusebytes | Number of bytes in use by the stack allocator. | | gomemstatsstacksysbytes | Number of bytes obtained from system for stack allocator. | | gomemstatssys_bytes | Number of bytes obtained by system. Sum of all system allocations. | HTTP Metrics: | Metrics | Uses | | - | - | | httprequestduration_microseconds | The HTTP request latencies in microseconds. | | httprequestsize_bytes | The HTTP request sizes in bytes. | | httprequeststotal | Total number of HTTP requests made. | | httpresponsesize_bytes | The HTTP response sizes in bytes. | Process Metrics: | Metric Name | Uses | | -- | | | processcpuseconds_total | Total user and system CPU time spent in seconds. | | processmaxfds | Maximum number of open file descriptors. | | processopenfds | Number of open file descriptors. | | processresidentmemory_bytes | Resident memory size in bytes. | | processstarttime_seconds | Start time of the process since unix epoch in seconds. | | processvirtualmemory_bytes | Virtual memory size in bytes. | You can enable operator monitoring through some flags while installing or upgrading or updating KubeDB via both and . You can also choose which monitoring agent to use for monitoring. KubeDB will configure respective resources accordingly. Here, are the list of available flags and their uses, | Helm Values | Acceptable Values | Default | Uses | | - | | | - | | `monitoring.enabled` | `true` or `false` | `false` | Specify whether to monitor KubeDB operator. | | `monitoring.agent` | `prometheus.io/builtin` or `prometheus.io/operator` | `none` | Specify which monitoring agent to use for monitoring KubeDB operator. | | `monitoring.prometheus.namespace` | any namespace | same namespace as KubeDB operator | Specify the namespace where Prometheus server is running or will be deployed | | `monitoring.serviceMonitor.labels` | any label | For Helm installation, `app: <generated app name>` and `release: <release name>`. For script installation, `app: kubedb` | Specify the labels for ServiceMonitor. Prometheus crd will select ServiceMonitor using these labels. Only usable when monitoring agent is `prometheus.io/operator`. | You have to provides these flags while installing or upgrading or updating KubeDB operator. Here, are examples for both script and Helm installation process are given which enable monitoring with `prometheus.io/operator` Prometheuse server for `operator` metrics. Helm 3: ```bash $ helm install kubedb oci://ghcr.io/appscode-charts/kubedb \ --version {{< param "info.version" >}} \ --namespace kubedb --create-namespace \ --set monitoring.enabled=true \ --set monitoring.agent=prometheus.io/operator \ --set monitoring.prometheus.namespace=monitoring \ --set monitoring.serviceMonitor.labels.release=prometheus ``` YAML (with Helm 3): ```bash $ helm template kubedb oci://ghcr.io/appscode-charts/kubedb \ --version {{< param "info.version" >}} \ --namespace kubedb --create-namespace \ --set monitoring.enabled=true \ --set monitoring.agent=prometheus.io/operator \ --set monitoring.prometheus.namespace=monitoring \ --set monitoring.serviceMonitor.labels.release=prometheus | kubectl apply -f - ``` Learn how to monitor KubeDB operator using built-in Prometheus from . Learn how to monitor KubeDB operator using Prometheus operator from .