-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathscript_exporter.alloy
More file actions
74 lines (61 loc) · 1.76 KB
/
script_exporter.alloy
File metadata and controls
74 lines (61 loc) · 1.76 KB
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
/*
Grafana Alloy Module for the script_exporter.
Example Usage:
import.git "script_exporter" {
repository = "https://github.com/ricoberger/script_exporter.git"
revision = "main"
path = "script_exporter.alloy"
}
prometheus.remote_write "local_prometheus" {
endpoint {
url = "http://localhost:9090/api/v1/write"
}
}
script_exporter.scrape_script "output" {
address = "localhost:9469"
forward_to = [prometheus.remote_write.local_prometheus.receiver]
params = {
script = ["output"],
}
}
script_exporter.scrape_script "ping" {
address = "localhost:9469"
forward_to = [prometheus.remote_write.local_prometheus.receiver]
params = {
script = ["ping"],
pingtarget = ["example.com"],
params = ["pingtarget"],
}
}
*/
declare "scrape_script" {
argument "address" {
comment = "The address of the script_exporter."
default = "localhost:9469"
optional = true
}
argument "scrape_interval" {
comment = "The Prometheus scrape interval."
default = "60s"
optional = true
}
argument "scrape_timeout" {
comment = "The Prometheus scrape timeout."
default = "10s"
optional = true
}
argument "forward_to" {
comment = "A list of receivers, where scraped metrics are forwarded to."
}
argument "params" {
comment = "The parameters which should be used. Must contain a parameter named 'script', with the name of the script which should be executed."
}
prometheus.scrape "script" {
targets = [{ __address__ = argument.address.value }]
metrics_path = "/probe"
scrape_interval = argument.scrape_interval.value
scrape_timeout = argument.scrape_timeout.value
forward_to = argument.forward_to.value
params = argument.params.value
}
}