]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/monitoring/objects_common.nix
Add beta for Denise OMS
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_common.nix
CommitLineData
eb071dd4 1{ hostFQDN
e820134d 2, hostName
2d7caffb 3, interface ? "eth0"
eb071dd4
IB
4, processWarn ? "250"
5, processAlert ? "400"
6, loadWarn ? "8.0"
7ad4966f
IB
7, load5Warn ? loadWarn
8, load15Warn ? load5Warn
eb071dd4 9, loadAlert ? "10.0"
7ad4966f
IB
10, load5Alert ? loadAlert
11, load15Alert ? load5Alert
eb071dd4
IB
12, mdadm
13, sudo
e820134d
IB
14, master
15, lib
eb071dd4
IB
16, ...
17}:
e820134d
IB
18let
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 };
28in
eb071dd4
IB
29{
30 host = {
31 "${hostFQDN}" = {
32 alias = hostFQDN;
33 address = hostFQDN;
34 use = "linux-server";
e820134d
IB
35 hostgroups = "webstatus-hosts";
36 _webstatus_name = hostName;
2edbb2d8 37 _webstatus_vhost = "status.immae.eu";
eb071dd4
IB
38 };
39 };
40 service = [
41 {
e820134d 42 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
43 service_description = "Size on root partition";
44 use = "local-service";
45 check_command = ["check_local_disk" "20%" "10%" "/"];
46 }
47 {
e820134d 48 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
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 }
2d7caffb
IB
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 }
eb071dd4 72 {
e820134d 73 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
74 service_description = "Average load";
75 use = "local-service";
76 check_command = [
77 "check_local_load"
7ad4966f
IB
78 "${loadWarn},${load5Warn},${load15Warn}"
79 "${loadAlert},${load5Alert},${load15Alert}"
eb071dd4
IB
80 ];
81 }
82 {
e820134d 83 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
84 service_description = "Swap usage";
85 use = "local-service";
86 check_command = ["check_local_swap" "20" "10"];
87 }
88 {
e820134d 89 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
90 service_description = "Memory usage";
91 use = "local-service";
92 check_command = ["check_memory" "80" "90"];
93 }
94 {
e820134d 95 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
96 service_description = "NTP is activated and working";
97 use = "local-service";
98 check_command = ["check_ntp"];
99 }
100 {
e820134d 101 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
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 = {
e820134d 113 check_dns = "$USER1$/check_dns -H $ARG1$ -s $HOSTADDRESS$ $ARG2$";
71a2425e
IB
114 check_emails = "$USER2$/check_emails -H $HOSTADDRESS$ -i $USER203$ -l $ARG1$ -p $ARG2$ -s $ARG3$ -f $ARG4$";
115 check_emails_local = "$USER2$/check_emails -H $HOSTADDRESS$ -n $ARG1$ -r $ADMINEMAIL$ -s $ARG2$ -f $ARG3$";
5a61f6ad
IB
116 check_backup_eriomem = "$USER2$/check_eriomem $USER208$";
117 check_backup_eriomem_age = "$USER2$/check_backup_eriomem_age $ARG1$";
118 check_backup_ovh_age = "$USER2$/check_backup_ovh_age $ARG1$";
e820134d
IB
119 check_external_dns = "$USER1$/check_dns -H $ARG2$ -s $ARG1$ $ARG3$";
120 check_ftp_database = "$USER2$/check_ftp_database";
121 check_git = "$USER2$/check_git $USER203$";
122 check_http = "$USER1$/check_http --sni -f stickyport -H \"$ARG1$\" -u \"$ARG2$\" -r \"$ARG3$\"";
123 check_https = "$USER1$/check_http --sni --ssl -f stickyport -H \"$ARG1$\" -u \"$ARG2$\" -r \"$ARG3$\"";
124 check_https_auth = "$USER1$/check_http --sni --ssl -a \"$USER202$\" -f stickyport -H \"$ARG1$\" -u \"$ARG2$\" -r \"$ARG3$\"";
125 check_https_certificate = "$USER1$/check_http --sni --ssl -H \"$ARG1$\" -C 21,15";
126 check_https_code = "$USER1$/check_http --sni --ssl -f stickyport -H \"$ARG1$\" -u \"$ARG2$\" -e \"$ARG3$\" -r \"$ARG4$\"";
127 check_imap_connection = "$USER2$/check_imap_connection -u \"$USER204$\" -p \"$USER205$\" -H \"imap.immae.eu:143\"";
eb071dd4
IB
128 check_local_disk = "$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$";
129 check_local_procs = "$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$";
130 check_local_load = "$USER1$/check_load -w $ARG1$ -c $ARG2$";
131 check_local_swap = "$USER1$/check_swap -n ok -w $ARG1$ -c $ARG2$";
2d7caffb 132 check_local_bandwidth = "$USER2$/check_bandwidth -i=$ARG1$ -w $ARG2$ -c $ARG3$";
eb071dd4 133 check_memory = "$USER2$/check_mem.sh -w $ARG1$ -c $ARG2$";
e820134d 134 check_command_match = "$USER2$/check_command -c \"$ARG1$\" -C \"$ARG2$\" $ARG3$";
eb071dd4 135 check_command_output = "$USER2$/check_command -c \"$ARG1$\" -s 0 -o \"$ARG2$\" $ARG3$";
e820134d 136 check_command_status = "$USER2$/check_command -c \"$ARG1$\" -s \"$ARG2$\" $ARG3$";
eb071dd4 137 check_ntp = "$USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org";
e820134d 138 check_mailq = "$USER1$/check_mailq -s -w 1 -c 2";
f7a3019f 139 check_megaraid = "$USER2$/check_megaraid_sas --sudo";
6015a3b5 140 check_mysql_replication = "${sudo} -u mysql $USER2$/check_mysql_replication \"$ARG1$\" \"$ARG2$\"";
eb071dd4 141 check_postgresql_replication = "${sudo} -u postgres $USER2$/check_postgres_replication \"$ARG1$\" \"$ARG2$\" \"$ARG3$\"";
16b80abd 142 check_openldap_replication = "${sudo} -u openldap $USER2$/check_openldap_replication \"$ARG1$\" \"$ARG2$\" \"$ARG3$\" \"$ARG4$\" \"$ARG5$\"";
6191bdeb 143 check_ovh_sms = "$USER2$/check_ovh_sms \"$USER209$\"";
6015a3b5 144 check_redis_replication = "${sudo} -u redis $USER2$/check_redis_replication \"$ARG1$\"";
e820134d
IB
145 check_smtp = "$USER1$/check_smtp -H $HOSTADDRESS$ -p 25 -S -D 21,15";
146 check_tcp = "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -e \"$ARG2$\" -Mcrit";
147 check_tcp_ssl = "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -S -D 21,15";
6ee77836 148 check_zfs = "$USER2$/check_zpool.sh -p ALL";
eb071dd4
IB
149
150 check_host_alive = "$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5";
151 check_last_file_date = "${sudo} -u \"$ARG3$\" $USER2$/check_last_file_date \"$ARG1$\" \"$ARG2$\"";
e820134d
IB
152 check_ok = "$USER1$/check_dummy 0 \"Dummy OK\"";
153 check_critical = "$USER1$/check_dummy 2 \"Dummy CRITICAL\"";
eb071dd4 154
e820134d
IB
155 # $OVE is to force naemon to run via shell instead of execve which fails here
156 notify-host-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" HOSTSTATE=\"$HOSTSTATE$\" HOSTOUTPUT=\"$HOSTOUTPUT$\" $USER2$/notify_by_email host \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE";
157 # $OVE is to force naemon to run via shell instead of execve which fails here
158 notify-service-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_by_email service \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE";
e820134d 159 notify-by-slack = "HOST=\"$HOSTALIAS$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_by_slack \"$ARG1$\" \"$ARG2$\"";
2edbb2d8
IB
160 notify-host-eban-url = "STATUS_NAME=\"Server\" PASSWORD=\"$USER210$\" HOSTSTATE=\"$HOSTSTATE$\" $USER2$/notify_eban_url";
161 notify-service-eban-url = "STATUS_NAME=\"$_SERVICEWEBSTATUS_NAME$\" PASSWORD=\"$USER210$\" SERVICESTATE=\"$SERVICESTATE$\" $USER2$/notify_eban_url";
eb071dd4 162
a97118c4 163 notify-master = "$USER2$/send_nrdp.sh -u \"$USER200$\" -t \"$USER201$\" -H \"$HOSTADDRESS$\" -s \"$SERVICEDESC$\" -S \"$SERVICESTATEID$\" -o \"$SERVICEOUTPUT$ | $SERVICEPERFDATA$\"";
eb071dd4
IB
164 };
165 timeperiod = {
166 "24x7" = {
167 alias = "24 Hours A Day, 7 Days A Week";
168 monday = "00:00-24:00";
169 tuesday = "00:00-24:00";
170 wednesday = "00:00-24:00";
171 thursday = "00:00-24:00";
172 friday = "00:00-24:00";
173 saturday = "00:00-24:00";
174 sunday = "00:00-24:00";
175 };
176 };
e820134d
IB
177 servicegroup = {
178 webstatus-webapps = { alias = "Web applications"; };
179 webstatus-websites = { alias = "Personal websites"; };
180 webstatus-ssl = { alias = "SSL certificates"; };
181 webstatus-dns = { alias = "DNS resolution"; };
182 webstatus-remote-services = { alias = "Other remote services"; };
183 webstatus-local-services = { alias = "Other local services"; };
184 webstatus-email = { alias = "E-mail services"; };
185 webstatus-resources = { alias = "Local resources"; };
186 webstatus-databases = { alias = "Databases resources"; };
187 webstatus-backup = { alias = "Backup resources"; };
188 };
189 hostgroup = {
190 webstatus-hosts = { alias = "Hosts"; };
191 };
eb071dd4
IB
192 contactgroup = {
193 admins = { alias = "Naemon Administrators"; };
194 };
eb071dd4
IB
195 templates = {
196 service = {
197 generic-service = {
198 active_checks_enabled = "1";
199 check_freshness = "0";
200 check_interval = "10";
201 check_period = "24x7";
202 contact_groups = "admins";
203 event_handler_enabled = "1";
204 flap_detection_enabled = "1";
205 is_volatile = "0";
206 max_check_attempts = "3";
207 notification_interval = "60";
208 notification_options = "w,u,c,r,f,s";
209 notification_period = "24x7";
e820134d 210 notifications_enabled = if master then "1" else "0";
eb071dd4
IB
211 obsess_over_service = "1";
212 passive_checks_enabled = "1";
213 process_perf_data = "1";
214 retain_nonstatus_information = "1";
215 retain_status_information = "1";
216 retry_interval = "2";
217 };
218 local-service = {
219 use = "generic-service";
220 host_name = hostFQDN;
221 check_interval = "5";
222 max_check_attempts = "4";
223 retry_interval = "1";
e820134d
IB
224 servicegroups = "webstatus-resources";
225 };
226 external-service = {
227 use = "generic-service";
228 check_interval = "5";
229 max_check_attempts = "4";
230 retry_interval = "1";
231 };
232 web-service = {
233 use = "generic-service";
234 check_interval = "20";
235 max_check_attempts = "2";
236 retry_interval = "1";
237 };
238 external-web-service = {
239 use = "generic-service";
240 check_interval = "20";
241 max_check_attempts = "2";
242 retry_interval = "1";
243 };
244 mail-service = {
245 use = "generic-service";
246 check_interval = "15";
247 max_check_attempts = "1";
248 retry_interval = "1";
249 };
250 dns-service = {
251 use = "generic-service";
252 check_interval = "120";
253 notification_interval = "120";
254 max_check_attempts = "5";
255 retry_interval = "5";
eb071dd4
IB
256 };
257 };
258 # No contact, we go through master
e820134d
IB
259 contact = {
260 generic-contact = {
261 host_notification_commands = "notify-host-by-email";
262 host_notification_options = "d,u,r,f,s";
263 host_notification_period = "24x7";
264 service_notification_commands = "notify-service-by-email";
265 service_notification_options = "w,u,c,r,f,s";
266 service_notification_period = "24x7";
267 };
268 };
eb071dd4
IB
269 host = {
270 generic-host = {
271 event_handler_enabled = "1";
272 flap_detection_enabled = "1";
273 notification_period = "24x7";
274 notifications_enabled = "1";
275 process_perf_data = "1";
276 retain_nonstatus_information = "1";
277 retain_status_information = "1";
278 };
279 linux-server = {
280 check_command = "check_host_alive";
281 check_interval = "5";
282 check_period = "24x7";
283 contact_groups = "admins";
284 max_check_attempts = "10";
285 notification_interval = "120";
286 notification_options = "d,u,r,f";
287 retry_interval = "1";
288 };
289 };
290 };
291}