Service with dashboard¶
This example show how to setup Monitoring for collect metrics from service and dashboard for show collected metrics.
ServiceMonitor¶
spec:
endpoints:
- interval: 30s
port: http
jobLabel: k8s-app
selector:
matchLabels:
k8s-app: sample-service
It means that Prometheus will collect metrics from service with settings:
- metrics will collect with job with label
k8s-app
- metrics will collect from all pods with label
k8s-app: sample-service
- metrics will collect from all discovered pod from port with name
http
with interval30s
Dashboard¶
spec:
name: simple-dashboard.json
json: >
{
"id": null,
"title": "Simple Dashboard",
...
<dashboard content in json format>
...
}
It means that in grafana will import dashboard with name Simple Dashboard
.
Files¶
How to apply example¶
Kubernetes:
OpenShift:
Links¶
- Prometheus operator
- API Documentation
- Grafana operator
- Dashboard API
- Victoriametrics operator
- API Documentation