-
Notifications
You must be signed in to change notification settings - Fork 0
/
grafana-agent.yaml
155 lines (145 loc) · 4.69 KB
/
grafana-agent.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
integrations:
node_exporter:
enabled: true
relabel_configs:
- replacement: <hostname>
target_label: instance
prometheus_remote_write:
- basic_auth:
password: <Your Grafana Cloud Key/Password>
username: <Your Grafana Cloud Prometheus username/Instance ID>
url: <Your Grafana Cloud Prometheus Remote Write Endpoint FQDN>
apache_http:
enabled: true
instance: <hostname>
# job is integrations/apache_http by default
scrape_uri: '<Your Apache server status (mod_status.so) endpoint>'
#scrape_uri: 'http://localhost:8080/server-status?auto' ##example of
agent:
enabled: true
metric_relabel_configs:
# required for apache integration.
# scraping agent endpoint is required for apache histogram metric collection.
- source_labels: [exported_job]
target_label: job
- source_labels: [exported_instance]
target_label: instance
- regex: (exported_instance|exported_job)
action: labeldrop
cadvisor:
enabled: true
docker_only: true
instance: localhost:9090
relabel_configs:
- action: replace
replacement: integrations/docker
target_label: job
logs:
configs:
- clients:
- basic_auth:
password: <Your Grafana Cloud Key/Password>
username: <Your Grafana Cloud Loki username/Instance ID>
url: <Your Grafana Cloud Loki Endpoint FQDN>
name: integrations
positions:
filename: /tmp/positions.yaml
target_config:
sync_period: 10s
scrape_configs:
- job_name: integrations/node_exporter_direct_scrape
static_configs:
- targets:
- localhost
labels:
instance: <hostname>
__path__: /var/log/{secure,messages,*.log}
job: integrations/node_exporter
- job_name: integrations/node_exporter_journal_scrape
journal:
labels:
instance: <hostname>
job: integrations/node_exporter
max_age: 24h
relabel_configs:
- source_labels:
- __journal__systemd_unit
target_label: unit
- source_labels:
- __journal__boot_id
target_label: boot_id
- source_labels:
- __journal__transport
target_label: transport
- source_labels:
- __journal_priority_keyword
target_label: level
- job_name: integrations/apache_error
static_configs:
- targets:
- localhost
labels:
__path__: /var/log/httpd/{error_log,ssl_error_log}
job: integrations/apache_http
instance: <hostname>
pipeline_stages:
- regex:
# https://regex101.com/r/zNIq1V/1
expression: '^\[[^ ]* (?P<timestamp>[^\]]*)\] \[(?:(?P<module>[^:\]]+):)?(?P<level>[^\]]+)\](?: \[pid (?P<pid>[^\]]*)\])?(?: \[client (?P<client>[^\]]*)\])? (?P<message>.*)$'
- labels:
module:
level:
- static_labels:
logtype: error
- job_name: integrations/apache_access
static_configs:
- targets:
- localhost
labels:
__path__: /var/log/httpd/{access_log,ssl_access_log}
job: integrations/apache_http
instance: <hostname>
pipeline_stages:
- regex:
# https://regex101.com/r/9G75bY/1
expression: '^(?P<ip>[^ ]*) [^ ]* (?P<user>[^ ]*) \[(?P<timestamp>[^\]]*)\] "(?P<method>\S+)(?: +(?P<path>[^ ]*) +\S*)?" (?P<code>[^ ]*) (?P<size>[^ ]*)(?: "(?P<referer>[^\"]*)" "(?P<agent>.*)")?$'
- metrics:
response_http_codes:
type: Histogram
description: "Apache responses by HTTP codes"
prefix: apache_
source: code
config:
buckets: [199,299,399,499,599]
- labels:
method:
- static_labels:
logtype: access
- job_name: integrations/docker
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 5s
relabel_configs:
- action: replace
replacement: integrations/docker
source_labels:
- __meta_docker_container_id
target_label: job
- source_labels:
- __meta_docker_container_name
regex: '/(.*)'
target_label: container
- source_labels:
- __meta_docker_container_log_stream
target_label: stream
metrics:
configs:
- name: integrations
remote_write:
- basic_auth:
password: <Your Grafana Cloud Key/Password>
username: <Your Grafana Cloud Prometheus username/Instance ID>
url: <Your Grafana Cloud Prometheus Remote Write Endpoint FQDN>
global:
scrape_interval: 60s
wal_directory: /tmp/grafana-agent-wal