Skip to content

Commit

Permalink
Explain service monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-pona committed Oct 6, 2024
1 parent 7286e5c commit 6241a5e
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion content/en/docs/monitoring/node-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ apiVersion: v1
kind: Service
metadata:
name: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-node-exporter
labels:
node-exporter: true
spec:
ports:
- port: 9100
- port: metrics
protocol: TCP
targetPort: 9100
selector:
Expand All @@ -139,6 +141,40 @@ Test your working webserver from your webshell:
curl -s http://{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-node-exporter.$USER.svc.cluster.local:9100/metrics
```

```bash
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 7
[...]
```

Those metrics are now easily integrated into prometheus with by deploying a ServiceMonitor, which would look similar to:

```yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: node-exporter-servicemonitor
namespace: <user>
spec:
endpoints:
- honorLabels: true
port: metrics
scheme: http
selector:
matchLabels:
node-exporter: true
```
## End of lab
Expand Down

0 comments on commit 6241a5e

Please sign in to comment.