Skip to content

Commit d8812c3

Browse files
committed
Update CheckCommand configuration
1 parent 3cc77b0 commit d8812c3

File tree

1 file changed

+56
-29
lines changed

1 file changed

+56
-29
lines changed

contrib/icinga2-commands.conf

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,65 @@ template CheckCommand "prometheus" {
44
arguments = {
55
"--hostname" = {
66
value = "$prometheus_hostname$"
7-
description = "Address of the prometheus instance"
7+
description = "Hostname of the Prometheus server (default 'localhost')"
88
}
99
"--port" = {
1010
value = "$prometheus_port$"
11-
description = "Port of the prometheus instance"
11+
description = "Port of the Prometheus server (default 9090)"
1212
}
1313
"--secure" = {
14-
value = "$prometheus_secure$"
15-
description = "Use secure connection"
14+
set_if = "$prometheus_secure$"
15+
description = "Use a HTTPS connection"
1616
}
1717
"--insecure" = {
1818
set_if = "$prometheus_insecure$"
19-
description = "Allow use of self signed certificates when using SSL"
19+
description = "Skip the verification of the server's TLS certificate"
20+
}
21+
"--bearer" = {
22+
value = "$prometheus_bearer$"
23+
description = "Specify the Bearer Token for server authentication"
24+
}
25+
"--user" = {
26+
value = "$prometheus_user$"
27+
description = "Specify the user name and password for server authentication <user:password>"
28+
}
29+
"--ca-file" = {
30+
value = "$prometheus_ca_file$"
31+
description = "Specify the CA File for TLS authentication"
32+
}
33+
"--cert-file" = {
34+
value = "$prometheus_cert_file$"
35+
description = "Specify the Certificate File for TLS authentication"
36+
}
37+
"--key-file" = {
38+
value = "$prometheus_key_file$"
39+
description = "Specify the Key File for TLS authentication"
2040
}
2141
"--timeout" = {
2242
value = "$prometheus_timeout$"
23-
description = "Timeout for the check"
43+
description = "Timeout in seconds for the CheckPlugin (default 30)"
2444
}
2545
}
46+
47+
vars.prometheus_hostname = "localhost"
48+
vars.prometheus_port = 9090
49+
vars.prometheus_timeout = 30
2650
}
2751

28-
object CheckCommand "prometheus-query" {
52+
object CheckCommand "prometheus-alert" {
2953
import "prometheus"
3054

31-
command += [ "query" ]
55+
command += [ "alert" ]
3256

3357
arguments += {
34-
"--query" = {
35-
value = "$prometheus_query$"
36-
description = "An Prometheus query which will be performed and the value result will be evaluated"
37-
}
38-
"--warning" = {
39-
value = "$prometheus_warning$"
40-
description = "The warning threshold for a value"
58+
"--name" = {
59+
value = "$prometheus_alert$"
60+
repeat_key = true
61+
description = "The name of one or more specific alerts to check. This parameter can be repeated e.G.: '--name alert1 --name alert2' If no name is given, all alerts will be evaluated"
4162
}
42-
"--critical" = {
43-
value = "$prometheus_critical$"
44-
description = "The critical threshold for a value"
63+
"--problems" = {
64+
value = "$prometheus_alert_problems$"
65+
description = "Display only alerts which status is not inactive/OK. Note that in combination with the --name flag this might result in no alerts being displayed"
4566
}
4667
}
4768
}
@@ -53,30 +74,36 @@ object CheckCommand "prometheus-health" {
5374

5475
arguments += {
5576
"--ready" = {
56-
value = "$prometheus_ready$"
77+
value = "$prometheus_health_ready$"
5778
description = "Checks the readiness of an endpoint"
5879
}
5980
"--info" = {
60-
value = "$prometheus_info"
81+
value = "$prometheus_health_info$"
6182
description = "Displays various build information properties about the Prometheus server"
6283
}
6384
}
6485
}
6586

66-
object CheckCommand "prometheus-alert" {
87+
object CheckCommand "prometheus-query" {
6788
import "prometheus"
6889

69-
command += [ "alert" ]
90+
command += [ "query" ]
7091

7192
arguments += {
72-
"--name" = {
73-
value = "$prometheus_alert$"
74-
repeat_key = true
75-
description = "The name of one or more specific alerts to check"
93+
"--query" = {
94+
value = "$prometheus_query$"
95+
description = "An Prometheus query which will be performed and the value result will be evaluated"
7696
}
77-
"--problems" = {
78-
value = "$prometheus_problems$"
79-
description = "Displays only alerts which status is not OK"
97+
"--warning" = {
98+
value = "$prometheus_query_warning$"
99+
description = "The warning threshold for a value (default '10')"
100+
}
101+
"--critical" = {
102+
value = "$prometheus_query_critical$"
103+
description = "The critical threshold for a value (default '20')"
80104
}
81105
}
106+
107+
vars.prometheus_query_warning = "10"
108+
vars.prometheus_query_critical = "20"
82109
}

0 commit comments

Comments
 (0)