Skip to content

Commit 9b90fc9

Browse files
authoredDec 8, 2020
Merge pull request #513 from rabbitmq/prometheus-example
Add Prometheus example
2 parents 8f066d1 + 30a323f commit 9b90fc9

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed
 

‎.github/workflows/pr.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ jobs:
2727
steps:
2828
- name: Check out code into the Go module directory
2929
uses: actions/checkout@v2
30-
- name: System tests
30+
- name: Dry run examples
3131
run: |
3232
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
3333
export GOPATH=$HOME/go
3434
export PATH=$PATH:$GOPATH/bin
3535
make install-tools
3636
kind create cluster --image kindest/node:v1.19.1
3737
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.crds.yaml
38+
# Create CRD PodMonitor without running Prometheus operator
39+
curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml | sed "s/replicas: 1$/replicas: 0/" | kubectl apply -f -
3840
make install
41+
sleep 3 # otherwise we sporadically observe 'no matches for kind "RabbitmqCluster" in version "rabbitmq.com/v1beta1'
3942
kubectl apply --dry-run=server --recursive -f docs/examples/
4043
4144
system_tests:

‎docs/examples/prometheus/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Prometheus Example
2+
3+
See [Monitoring RabbitMQ in Kubernetes](https://www.rabbitmq.com/kubernetes/operator/operator-monitoring.html) for detailed instructions.
4+
5+
If you deployed the [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator), make Prometheus scrape RabbitMQ nodes by:
6+
```shell
7+
kubectl apply -f rabbitmq-podmonitor.yaml
8+
```
9+
10+
Alternatively, if you deployed the Prometheus Operator via the [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) Helm chart,
11+
set the values in [kube-prometheus-stack-values.yaml.example](kube-prometheus-stack-values.yaml.example) when installing / upgrading the Helm chart.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
prometheus:
3+
additionalPodMonitors:
4+
- name: rabbitmq
5+
podMetricsEndpoints:
6+
- port: prometheus
7+
selector:
8+
matchLabels:
9+
app.kubernetes.io/component: rabbitmq
10+
namespaceSelector:
11+
any: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: rabbitmq
6+
spec:
7+
podMetricsEndpoints:
8+
- interval: 15s
9+
port: prometheus
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/component: rabbitmq
13+
namespaceSelector:
14+
any: true

0 commit comments

Comments
 (0)
Please sign in to comment.