Skip to content

Commit b4e2763

Browse files
committed
Add process-exporter
1 parent ffacc48 commit b4e2763

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
process_names:
2+
- name: "{{.Comm}}|{{ index .Cgroups 0 }}"
3+
cmdline:
4+
- '.+'

framework/observability/compose/conf/prometheus.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ scrape_configs:
2020
static_configs:
2121
- targets:
2222
- cadvisor:8080
23+
metric_relabel_configs:
24+
# Extract hex ID from common cgroup/runtime formats:
25+
# /docker/<id>, docker-<id>.scope, containerd://<id>, cri-containerd-<id>.scope, etc.
26+
- source_labels: [ id ]
27+
regex: '.*(?:/docker/|docker-|containerd://|containerd-|cri-containerd-|crio-)([a-f0-9]{12,64})(?:\.scope)?.*'
28+
target_label: container_id
29+
replacement: '$1'
30+
action: replace
2331
- job_name: 'postgres_exporter_0'
2432
static_configs:
2533
- targets: ['postgres_exporter_0:9187']
@@ -35,3 +43,26 @@ scrape_configs:
3543
- job_name: 'postgres_exporter_4'
3644
static_configs:
3745
- targets: ['postgres_exporter_4:9187']
46+
- job_name: 'process_exporter'
47+
static_configs:
48+
- targets: ['process-exporter:9256']
49+
metric_relabel_configs:
50+
# Extract container id from groupname so we can match it to the container
51+
- source_labels: [groupname]
52+
regex: "^[^|]+\\|.*/([a-f0-9]{12,64})$"
53+
target_label: container_id
54+
replacement: "$1"
55+
action: replace
56+
57+
# We detect the special '/../..' tail and set container_id=host.
58+
- source_labels: [groupname]
59+
regex: "^[^|]+\\|/\\.\\./\\.\\.$"
60+
target_label: container_id
61+
replacement: "host"
62+
action: replace
63+
64+
- source_labels: [groupname]
65+
regex: "^([^|]+)\\|.*"
66+
target_label: groupname
67+
replacement: "$1"
68+
action: replace

framework/observability/compose/docker-compose.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ services:
135135
- '9304:9187'
136136
restart: unless-stopped
137137

138+
process-exporter:
139+
image: ncabatoff/process-exporter:latest
140+
container_name: process-exporter
141+
pid: host
142+
privileged: true
143+
volumes:
144+
- /proc:/host/proc:ro
145+
- ./conf/process-exporter.yaml:/config.yaml:ro
146+
command:
147+
- "--procfs=/host/proc"
148+
- "--config.path=/config.yaml"
149+
ports:
150+
- "9256:9256"
151+
138152
volumes:
139153
loki_data:
140154
grafana_data:

0 commit comments

Comments
 (0)