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