summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Lambert <joshua@gitlab.com>2017-07-14 23:52:21 -0400
committerJoshua Lambert <joshua@gitlab.com>2017-07-14 23:52:21 -0400
commita40fd9e9f33ad1ee94174b5ce743b71e5ea823f4 (patch)
tree63d674ea7e36c7a1a7fd1ed1d15a2f045678fc88
parent566454c6114031f3859e15449cfccdc3a2cfdbd4 (diff)
downloadgitlab-ce-a40fd9e9f33ad1ee94174b5ce743b71e5ea823f4.tar.gz
WIP
-rw-r--r--doc/user/project/integrations/prometheus_library/kubernetes.md19
-rw-r--r--doc/user/project/integrations/prometheus_library/metrics.md35
2 files changed, 54 insertions, 0 deletions
diff --git a/doc/user/project/integrations/prometheus_library/kubernetes.md b/doc/user/project/integrations/prometheus_library/kubernetes.md
new file mode 100644
index 00000000000..eb6b377dd62
--- /dev/null
+++ b/doc/user/project/integrations/prometheus_library/kubernetes.md
@@ -0,0 +1,19 @@
+# Monitoring Kubernetes
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8935) in GitLab 9.0
+
+GitLab has support for automatically detecting and monitoring Kubernetes metrics. Kubernetes exposes Node level metrics out of the box via the built-in [Prometheus metrics support in cAdvisor](https://github.com/google/cadvisor).
+
+## Metrics supported
+
+| Name | Query |
+| ---- | ----- |
+| Average Memory Usage (MB) | (sum(container_memory_usage_bytes{container_name!="POD",%{environment_filter}}) / count(container_memory_usage_bytes{container_name!="POD",%{environment_filter}})) /1024/1024 |
+| Average CPU Utilization (%) | sum(rate(container_cpu_usage_seconds_total{container_name!="POD",%{environment_filter}}[2m])) / count(container_cpu_usage_seconds_total{container_name!="POD",%{environment_filter}}) * 100 |
+
+## Configuring Prometheus to monitor for Kubernetes node metrics
+
+Prometheus has internal support for discovering and monitoring of Kubernetes node metrics.
+
+If you have an Omnibus based GitLab installation within your Kubernetes cluster, you can leverage the bundled Prometheus server to [monitor Kubernetes](../../../../administration/monitoring/prometheus/index.md#configuring-prometheus-to-monitor-kubernetes).
+
+To configure your own Prometheus server
diff --git a/doc/user/project/integrations/prometheus_library/metrics.md b/doc/user/project/integrations/prometheus_library/metrics.md
new file mode 100644
index 00000000000..f783b97c38f
--- /dev/null
+++ b/doc/user/project/integrations/prometheus_library/metrics.md
@@ -0,0 +1,35 @@
+# Prometheus Metrics library
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8935) in GitLab 9.0
+
+GitLab offers
+
+## Metrics and Labels
+
+GitLab retrieves performance data from two metrics, `container_cpu_usage_seconds_total`
+and `container_memory_usage_bytes`. These metrics are collected from the
+Kubernetes pods via Prometheus, and report CPU and Memory utilization of each
+container or Pod running in the cluster.
+
+In order to isolate and only display relevant metrics for a given environment
+however, GitLab needs a method to detect which pods are associated. To do that,
+GitLab will specifically request metrics that have an `environment` tag that
+matches the [$CI_ENVIRONMENT_SLUG][ci-environment-slug].
+
+If you are using [GitLab Auto-Deploy][autodeploy] and one of the methods of
+configuring Prometheus above, the `environment` will be automatically added.
+
+## Configuring Prometheus to collect automatically collected metrics within Kubernetes
+
+In order for Prometheus to collect Kubernetes metrics, you first must have a
+Prometheus server up and running. You have two options here:
+
+- If you installed Omnibus GitLab inside of Kubernetes, you can simply use the
+ [bundled version of Prometheus][promgldocs]. In that case, follow the info in the
+ [Omnibus GitLab section](#configuring-omnibus-gitlab-prometheus-to-monitor-kubernetes)
+ below.
+- If you are using GitLab.com or installed GitLab outside of Kubernetes, you
+ will likely need to run a Prometheus server within the Kubernetes cluster.
+ Once installed, the easiest way to monitor Kubernetes is to simply use
+ Prometheus' support for [Kubernetes Service Discovery][prometheus-k8s-sd].
+ In that case, follow the instructions on
+ [configuring your own Prometheus server within Kubernetes](../prometheus.md#configuring-your-own-prometheus-server-within-kubernetes).