Skip to content

Commit

Permalink
Add node_exporter scrape target to Prometheus
Browse files Browse the repository at this point in the history
Also filters out any non-system components from appearing in the
prometheus configuration.
  • Loading branch information
smarterclayton committed Jan 19, 2018
1 parent 78ddc10 commit 30516b5
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 27 deletions.
64 changes: 55 additions & 9 deletions examples/prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,15 @@ objects:
- role: endpoints
relabel_configs:
# only scrape infrastructure components
- source_labels: [__meta_kubernetes_namespace]
action: keep
regex: 'default|logging|metrics|kube-.+|openshift|openshift-.+'
# drop infrastructure components managed by other scrape targets
- source_labels: [__meta_kubernetes_service_name]
action: drop
regex: 'prometheus-node-exporter'
# only those that have requested scraping
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
action: keep
regex: true
Expand All @@ -540,14 +549,6 @@ objects:
target_label: __address__
regex: (.+)(?::\d+);(\d+)
replacement: $1:$2
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_username]
action: replace
target_label: __basic_auth_username__
regex: (.+)
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_password]
action: replace
target_label: __basic_auth_password__
regex: (.+)
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
Expand All @@ -557,8 +558,53 @@ objects:
action: replace
target_label: kubernetes_name
- job_name: 'openshift-template-service-broker'
# Scrape config for node-exporter, which is expected to be running on port 9100.
- job_name: 'kubernetes-nodes-exporter'
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
kubernetes_sd_configs:
- role: node
metric_relabel_configs:
- source_labels: [__name__]
action: drop
regex: 'node_cpu|node_(disk|scrape_collector)_.+'
# preserve a subset of the network, netstat, vmstat, and filesystem series
- source_labels: [__name__]
action: replace
regex: '(node_(netstat_Ip_.+|vmstat_(nr|thp)_.+|filesystem_(free|size|device_error)|network_(transmit|receive)_(drop|errs)))'
target_label: __name__
replacement: renamed_$1
- source_labels: [__name__]
action: drop
regex: 'node_(netstat|vmstat|filesystem|network)_.+'
- source_labels: [__name__]
action: replace
regex: 'renamed_(.+)'
target_label: __name__
replacement: $1
# drop any partial expensive series
- source_labels: [__name__, device]
action: drop
regex: 'node_network_.+;veth.+'
- source_labels: [__name__, mountpoint]
action: drop
regex: 'node_filesystem_(free|size|device_error);([^/].*|/.+)'
relabel_configs:
- source_labels: [__address__]
regex: '(.*):10250'
replacement: '${1}:9100'
target_label: __address__
- source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
target_label: __instance__
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
# Scrape config for the template service broker
- job_name: 'openshift-template-service-broker'
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
Expand Down
64 changes: 55 additions & 9 deletions pkg/oc/bootstrap/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 55 additions & 9 deletions test/extended/testdata/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 30516b5

Please sign in to comment.