diff options
Diffstat (limited to 'modules/private/monitoring/objects_common.nix')
-rw-r--r-- | modules/private/monitoring/objects_common.nix | 253 |
1 files changed, 0 insertions, 253 deletions
diff --git a/modules/private/monitoring/objects_common.nix b/modules/private/monitoring/objects_common.nix deleted file mode 100644 index 7c9f642..0000000 --- a/modules/private/monitoring/objects_common.nix +++ /dev/null | |||
@@ -1,253 +0,0 @@ | |||
1 | { hostFQDN | ||
2 | , hostName | ||
3 | , interface ? "eth0" | ||
4 | , processWarn ? "250" | ||
5 | , processAlert ? "400" | ||
6 | , loadWarn ? "0.9" | ||
7 | , load5Warn ? loadWarn | ||
8 | , load15Warn ? load5Warn | ||
9 | , loadAlert ? "1.0" | ||
10 | , load5Alert ? loadAlert | ||
11 | , load15Alert ? load5Alert | ||
12 | , mdadm | ||
13 | , master | ||
14 | , lib | ||
15 | , mypluginsConfig | ||
16 | , ... | ||
17 | }: | ||
18 | let | ||
19 | defaultPassiveInfo = { | ||
20 | filter = lib.attrsets.filterAttrs | ||
21 | (k: v: builtins.elem k ["service_description"] || builtins.substring 0 1 k == "_"); | ||
22 | use = "external-passive-service"; | ||
23 | freshness_threshold = "450"; | ||
24 | retry_interval = "1"; | ||
25 | servicegroups = "webstatus-resources"; | ||
26 | host_name = hostFQDN; | ||
27 | }; | ||
28 | in | ||
29 | { | ||
30 | host = { | ||
31 | "${hostFQDN}" = { | ||
32 | alias = hostFQDN; | ||
33 | address = hostFQDN; | ||
34 | use = "linux-server"; | ||
35 | hostgroups = "webstatus-hosts"; | ||
36 | _webstatus_name = hostName; | ||
37 | _webstatus_vhost = "status.immae.eu"; | ||
38 | }; | ||
39 | }; | ||
40 | service = [ | ||
41 | { | ||
42 | passiveInfo = defaultPassiveInfo; | ||
43 | service_description = "Size on root partition"; | ||
44 | use = "local-service"; | ||
45 | check_command = ["check_local_disk" "20%" "10%" "/"]; | ||
46 | } | ||
47 | { | ||
48 | passiveInfo = defaultPassiveInfo; | ||
49 | service_description = "Total number of process"; | ||
50 | use = "local-service"; | ||
51 | check_command = [ | ||
52 | "check_local_procs" | ||
53 | processWarn | ||
54 | processAlert | ||
55 | "RSZDT" | ||
56 | ]; | ||
57 | } | ||
58 | { | ||
59 | passiveInfo = defaultPassiveInfo; | ||
60 | service_description = "Network bandwidth"; | ||
61 | use = "local-service"; | ||
62 | check_interval = "2"; | ||
63 | max_check_attempts = "20"; | ||
64 | retry_interval = "2"; | ||
65 | check_command = [ | ||
66 | "check_local_bandwidth" | ||
67 | interface | ||
68 | "20480" # kb/s | ||
69 | "51200" # kb/s | ||
70 | ]; | ||
71 | } | ||
72 | { | ||
73 | passiveInfo = defaultPassiveInfo; | ||
74 | service_description = "Average load"; | ||
75 | use = "local-service"; | ||
76 | check_command = [ | ||
77 | "check_local_load" | ||
78 | "${loadWarn},${load5Warn},${load15Warn}" | ||
79 | "${loadAlert},${load5Alert},${load15Alert}" | ||
80 | ]; | ||
81 | } | ||
82 | { | ||
83 | passiveInfo = defaultPassiveInfo; | ||
84 | service_description = "Swap usage"; | ||
85 | use = "local-service"; | ||
86 | check_command = ["check_local_swap" "20" "10"]; | ||
87 | } | ||
88 | { | ||
89 | passiveInfo = defaultPassiveInfo; | ||
90 | service_description = "Memory usage"; | ||
91 | use = "local-service"; | ||
92 | check_command = ["check_memory" "80" "90"]; | ||
93 | } | ||
94 | { | ||
95 | passiveInfo = defaultPassiveInfo; | ||
96 | service_description = "NTP is activated and working"; | ||
97 | use = "local-service"; | ||
98 | check_command = ["check_ntp"]; | ||
99 | } | ||
100 | { | ||
101 | passiveInfo = defaultPassiveInfo; | ||
102 | service_description = "No mdadm array is degraded"; | ||
103 | use = "local-service"; | ||
104 | check_command = [ | ||
105 | "check_command_output" | ||
106 | "${mdadm}/bin/mdadm --monitor --scan -1" | ||
107 | "^$" | ||
108 | "-s 0 -r root" | ||
109 | ]; | ||
110 | } | ||
111 | ]; | ||
112 | command = lib.foldr (v: o: o // (v.commands or {})) {} (builtins.attrValues mypluginsConfig) // { | ||
113 | check_local_disk = "$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$"; | ||
114 | check_local_procs = "$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$"; | ||
115 | check_local_load = "$USER1$/check_load -r -w $ARG1$ -c $ARG2$"; | ||
116 | check_local_swap = "$USER1$/check_swap -n ok -w $ARG1$ -c $ARG2$"; | ||
117 | check_ntp = "$USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org"; | ||
118 | check_mailq = "$USER1$/check_mailq -s -w 1 -c 2"; | ||
119 | check_smtp = "$USER1$/check_smtp -H $HOSTADDRESS$ -p 25 -S -D 21,15"; | ||
120 | |||
121 | check_host_alive = "$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5"; | ||
122 | check_ok = "$USER1$/check_dummy 0 \"Dummy OK\""; | ||
123 | check_critical = "$USER1$/check_dummy 2 \"Dummy CRITICAL\""; | ||
124 | }; | ||
125 | timeperiod = { | ||
126 | "24x7" = { | ||
127 | alias = "24 Hours A Day, 7 Days A Week"; | ||
128 | monday = "00:00-24:00"; | ||
129 | tuesday = "00:00-24:00"; | ||
130 | wednesday = "00:00-24:00"; | ||
131 | thursday = "00:00-24:00"; | ||
132 | friday = "00:00-24:00"; | ||
133 | saturday = "00:00-24:00"; | ||
134 | sunday = "00:00-24:00"; | ||
135 | }; | ||
136 | }; | ||
137 | servicegroup = { | ||
138 | webstatus-webapps = { alias = "Web applications"; }; | ||
139 | webstatus-websites = { alias = "Personal websites"; }; | ||
140 | webstatus-ssl = { alias = "SSL certificates"; }; | ||
141 | webstatus-dns = { alias = "DNS resolution"; }; | ||
142 | webstatus-remote-services = { alias = "Other remote services"; }; | ||
143 | webstatus-local-services = { alias = "Other local services"; }; | ||
144 | webstatus-email = { alias = "E-mail services"; }; | ||
145 | webstatus-resources = { alias = "Local resources"; }; | ||
146 | webstatus-databases = { alias = "Databases resources"; }; | ||
147 | webstatus-backup = { alias = "Backup resources"; }; | ||
148 | }; | ||
149 | hostgroup = { | ||
150 | webstatus-hosts = { alias = "Hosts"; }; | ||
151 | }; | ||
152 | contactgroup = { | ||
153 | admins = { alias = "Naemon Administrators"; }; | ||
154 | }; | ||
155 | templates = { | ||
156 | service = { | ||
157 | generic-service = { | ||
158 | active_checks_enabled = "1"; | ||
159 | check_freshness = "0"; | ||
160 | check_interval = "10"; | ||
161 | check_period = "24x7"; | ||
162 | contact_groups = "admins"; | ||
163 | event_handler_enabled = "1"; | ||
164 | flap_detection_enabled = "1"; | ||
165 | is_volatile = "0"; | ||
166 | max_check_attempts = "3"; | ||
167 | notification_interval = "60"; | ||
168 | notification_options = "w,u,c,r,f,s"; | ||
169 | notification_period = "24x7"; | ||
170 | notifications_enabled = if master then "1" else "0"; | ||
171 | obsess_over_service = "1"; | ||
172 | passive_checks_enabled = "1"; | ||
173 | process_perf_data = "1"; | ||
174 | retain_nonstatus_information = "1"; | ||
175 | retain_status_information = "1"; | ||
176 | retry_interval = "2"; | ||
177 | _webstatus_namespace = "immae"; | ||
178 | }; | ||
179 | local-service = { | ||
180 | use = "generic-service"; | ||
181 | host_name = hostFQDN; | ||
182 | check_interval = "5"; | ||
183 | max_check_attempts = "4"; | ||
184 | retry_interval = "1"; | ||
185 | servicegroups = "webstatus-resources"; | ||
186 | }; | ||
187 | external-service = { | ||
188 | use = "generic-service"; | ||
189 | check_interval = "5"; | ||
190 | max_check_attempts = "4"; | ||
191 | retry_interval = "1"; | ||
192 | }; | ||
193 | web-service = { | ||
194 | use = "generic-service"; | ||
195 | check_interval = "20"; | ||
196 | max_check_attempts = "2"; | ||
197 | retry_interval = "1"; | ||
198 | }; | ||
199 | external-web-service = { | ||
200 | use = "generic-service"; | ||
201 | check_interval = "20"; | ||
202 | max_check_attempts = "2"; | ||
203 | retry_interval = "1"; | ||
204 | }; | ||
205 | mail-service = { | ||
206 | use = "generic-service"; | ||
207 | check_interval = "15"; | ||
208 | max_check_attempts = "1"; | ||
209 | retry_interval = "1"; | ||
210 | }; | ||
211 | dns-service = { | ||
212 | use = "generic-service"; | ||
213 | check_interval = "120"; | ||
214 | notification_interval = "120"; | ||
215 | max_check_attempts = "5"; | ||
216 | retry_interval = "5"; | ||
217 | }; | ||
218 | }; | ||
219 | # No contact, we go through master | ||
220 | contact = { | ||
221 | generic-contact = { | ||
222 | host_notification_commands = "notify-host-by-email"; | ||
223 | host_notification_options = "d,u,r,f,s"; | ||
224 | host_notification_period = "24x7"; | ||
225 | service_notification_commands = "notify-service-by-email"; | ||
226 | service_notification_options = "w,u,c,r,f,s"; | ||
227 | service_notification_period = "24x7"; | ||
228 | }; | ||
229 | }; | ||
230 | host = { | ||
231 | generic-host = { | ||
232 | event_handler_enabled = "1"; | ||
233 | flap_detection_enabled = "1"; | ||
234 | notification_period = "24x7"; | ||
235 | notifications_enabled = "1"; | ||
236 | process_perf_data = "1"; | ||
237 | retain_nonstatus_information = "1"; | ||
238 | retain_status_information = "1"; | ||
239 | }; | ||
240 | linux-server = { | ||
241 | check_command = "check_host_alive"; | ||
242 | check_interval = "5"; | ||
243 | check_period = "24x7"; | ||
244 | contact_groups = "admins"; | ||
245 | max_check_attempts = "10"; | ||
246 | notification_interval = "120"; | ||
247 | notification_options = "d,u,r,f"; | ||
248 | retry_interval = "1"; | ||
249 | _webstatus_namespace = "immae"; | ||
250 | }; | ||
251 | }; | ||
252 | }; | ||
253 | } | ||