Skip to content

Commit 41a0ec9

Browse files
author
Philipp Dorschner
committed
Add icinga2-commands.conf
Add icinga2-service-example.conf
1 parent b72610c commit 41a0ec9

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

contrib/icinga2-commands.conf

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
template CheckCommand "elasticsearch-netways" {
2+
command = [ PluginDir + "/check_elasticsearch" ]
3+
4+
arguments = {
5+
"-H" = {
6+
value = "$elasticsearch_hostname$"
7+
description = "Hostname of the Elasticsearch instance (default 'localhost')"
8+
}
9+
"-p" = {
10+
value= "$elasticsearch_port$"
11+
description = "Port of the Elasticsearch instance (default 9200)"
12+
}
13+
"-U" = {
14+
value = "$elasticsearch_username$"
15+
description = "Username if authentication is required"
16+
}
17+
"-P" = {
18+
value = "$elasticsearch_password$"
19+
description = "Password if authentication is required"
20+
}
21+
"-S" = {
22+
set_if = "$elasticsearch_tls$"
23+
description = "Use a HTTPS connection (default false)"
24+
}
25+
"--insecure" = {
26+
set_if = "$elasticsearch_insecure$"
27+
description = "Skip the verification of the server's TLS certificate (default false)"
28+
}
29+
"-t" = {
30+
value = "$elasticsearch_timeout$"
31+
description = "Timeout in seconds for the CheckPlugin (default 30)"
32+
}
33+
}
34+
}
35+
36+
object CheckCommand "elasticsearch-query" {
37+
import "elasticsearch-netways"
38+
39+
command += [ "query" ]
40+
41+
arguments += {
42+
"-q" = {
43+
value = "$elasticsearch_query$"
44+
description = "The Elasticsearch query"
45+
}
46+
"-I" = {
47+
value = "$elasticsearch_query_index$"
48+
description = "Name of the Index which will be used (default '_all')"
49+
}
50+
"-k" = {
51+
value = "$elasticsearch_query_msgkey$"
52+
description = "Message of messagekey to display"
53+
}
54+
"-m" = {
55+
value = "$elasticsearch_query_msglen$"
56+
description = "Number of characters to display in the latest message (default 80)"
57+
}
58+
"-w" = {
59+
value = "$elasticsearch_query_warning$"
60+
description = "Warning threshold for total hits (default '20')"
61+
}
62+
"-c" = {
63+
value = "$elasticsearch_query_critical$"
64+
description = "Critical threshold for total hits (default '50')"
65+
}
66+
}
67+
}
68+
69+
object CheckCommand "elasticsearch-health" {
70+
import "elasticsearch-netways"
71+
72+
command += [ "health" ]
73+
}

contrib/icinga2-service-example.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apply Service "elasticsearch-example-query" {
2+
check_command = "elasticsearch-query"
3+
4+
vars.elasticsearch_query = "event.dataset:sample_web_logs and @timestamp:[now-5m TO now]"
5+
vars.elasticsearch_query_index = "kibana_sample_data_logs"
6+
vars.elasticsearch_query_msgkey = "message"
7+
8+
assign where host.name == NodeName
9+
}
10+
11+
apply Service "elasticsearch-example-health" {
12+
check_command = "elasticsearch-health"
13+
14+
vars.elasticsearch_username = "exampleuser"
15+
vars.elasticsearch_password = "examplepassword"
16+
vars.elasticsearch_insecure = true
17+
18+
assign where host.name == NodeName
19+
}

0 commit comments

Comments
 (0)