services.conf.erb 2.64 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#######################################
# Icinga 2 selftest configuration
# Managed by Puppet
#######################################

apply Service "ping4" {
  import "generic-service"

  check_command = "ping4"

  assign where host.address
}

apply Service "ssh" {
  import "generic-service"

  check_command = "ssh"

Markus Frosch's avatar
Markus Frosch committed
19
  assign where host.address && host.vars.kernel == "Linux"
20
21
22
23
24
25
26
}

##
# Icinga 2 components
##

apply Service "icinga" {
Markus Frosch's avatar
Markus Frosch committed
27
  import "agent-service"
28
29
30
31
32

  check_command = "icinga"

  assign where host.vars.role == "icinga"
}
33
34

apply Service "icinga cluster" {
Markus Frosch's avatar
Markus Frosch committed
35
  import "agent-service"
36
37
38
39
40
41

  check_command = "cluster"

  assign where host.vars.role == "icinga"
}

Markus Frosch's avatar
Markus Frosch committed
42
apply Service "icinga ido" {
Markus Frosch's avatar
Markus Frosch committed
43
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
44
45
46
47
48
49
50
51
52

  check_command = "ido"

  vars.ido_type = "IdoMysqlConnection"
  vars.ido_name = "ido-mysql"

  assign where host.vars.role == "icinga" && host.vars.zone == "master"
}

53
54
55
56
##
# Icinga 2 zones
##

57
58
59
<%- @_zones.each do |zone, zone_hash|
  next unless zone_hash['endpoints']
-%>
60
apply Service "icinga cluster zone <%= zone %>" {
Markus Frosch's avatar
Markus Frosch committed
61
  import "agent-service"
62
63
64
65
66
67

  check_command = "cluster-zone"

  vars.cluster_zone = <%= scope.function_icinga2_config_value([zone]) %>

  assign where host.vars.role == "icinga"
Markus Frosch's avatar
Markus Frosch committed
68
  ignore where host.vars.zone == <%= scope.function_icinga2_config_value([zone]) %>
69
70
}
<% end -%>
Markus Frosch's avatar
Markus Frosch committed
71
72
73
74
75
76

##
# Linux monitoring
##

apply Service "disk /" {
Markus Frosch's avatar
Markus Frosch committed
77
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
78
79
80
81
82
83
84
85
86

  check_command = "disk"

  vars.disk_partitions = [ "/" ]

  assign where host.vars.role == "icinga"
}

apply Service "load" {
Markus Frosch's avatar
Markus Frosch committed
87
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
88
89
90
91
92
93
94

  check_command = "load"

  assign where host.vars.role == "icinga"
}

apply Service "procs" {
Markus Frosch's avatar
Markus Frosch committed
95
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
96
97
98
99
100
101
102

  check_command = "procs"

  assign where host.vars.role == "icinga"
}

apply Service "swap" {
Markus Frosch's avatar
Markus Frosch committed
103
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
104
105
106
107
108
109
110
111
112
113
114

  check_command = "swap"

  assign where host.vars.role == "icinga"
}

apply Service "http" {
  import "generic-service"

  check_command = "http"

115
116
117
118
119
120
121
122
123
124
  vars.http_expect = "301"

  assign where host.vars.role == "icinga" && host.vars.zone == "master"
}

apply Service "https" {
  import "generic-service"

  check_command = "http"

Markus Frosch's avatar
Markus Frosch committed
125
  vars.http_expect = "302"
126
  vars.http_ssl = true
Markus Frosch's avatar
Markus Frosch committed
127
128
129
130
131
132

  assign where host.vars.role == "icinga" && host.vars.zone == "master"
}

<%-# TODO: needing solution for RHEL! -%>
apply Service "running_kernel" {
Markus Frosch's avatar
Markus Frosch committed
133
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
134
135
136

  check_command = "running_kernel"

137
  assign where host.vars.role == "icinga" && host.vars.osfamily == "Debian"
Markus Frosch's avatar
Markus Frosch committed
138
139
140
}

apply Service "updates" {
Markus Frosch's avatar
Markus Frosch committed
141
  import "agent-service"
Markus Frosch's avatar
Markus Frosch committed
142

143
144
  if (host.vars.osfamily == "Debian") {
    check_command = "apt"
145
  } else if (host.vars.osfamily == "RedHat") {
146
147
    check_command = "updates"
  }
Markus Frosch's avatar
Markus Frosch committed
148
149
150

  assign where host.vars.role == "icinga"
}