]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - flakes/private/monitoring/objects_common.nix
Adjustments for monitoring and packages
[perso/Immae/Config/Nix.git] / flakes / private / monitoring / objects_common.nix
CommitLineData
eb071dd4 1{ hostFQDN
e820134d 2, hostName
2d7caffb 3, interface ? "eth0"
eb071dd4
IB
4, processWarn ? "250"
5, processAlert ? "400"
c41d0de8 6, loadWarn ? "0.9"
7ad4966f
IB
7, load5Warn ? loadWarn
8, load15Warn ? load5Warn
c41d0de8 9, loadAlert ? "1.0"
7ad4966f
IB
10, load5Alert ? loadAlert
11, load15Alert ? load5Alert
e820134d 12, master
eb071dd4
IB
13, ...
14}:
15{
16 host = {
17 "${hostFQDN}" = {
18 alias = hostFQDN;
19 address = hostFQDN;
20 use = "linux-server";
e820134d
IB
21 hostgroups = "webstatus-hosts";
22 _webstatus_name = hostName;
2edbb2d8 23 _webstatus_vhost = "status.immae.eu";
eb071dd4
IB
24 };
25 };
26 service = [
27 {
28 service_description = "Size on root partition";
29 use = "local-service";
30 check_command = ["check_local_disk" "20%" "10%" "/"];
1a64deeb 31 __passive_servicegroups = "webstatus-resources";
eb071dd4
IB
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 ];
1a64deeb 42 __passive_servicegroups = "webstatus-resources";
eb071dd4 43 }
2d7caffb 44 {
2d7caffb
IB
45 service_description = "Network bandwidth";
46 use = "local-service";
1a64deeb 47 check_interval = 2;
2d7caffb
IB
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 ];
1a64deeb 56 __passive_servicegroups = "webstatus-resources";
2d7caffb 57 }
eb071dd4
IB
58 {
59 service_description = "Average load";
60 use = "local-service";
61 check_command = [
62 "check_local_load"
7ad4966f
IB
63 "${loadWarn},${load5Warn},${load15Warn}"
64 "${loadAlert},${load5Alert},${load15Alert}"
eb071dd4 65 ];
1a64deeb 66 __passive_servicegroups = "webstatus-resources";
eb071dd4
IB
67 }
68 {
69 service_description = "Swap usage";
70 use = "local-service";
71 check_command = ["check_local_swap" "20" "10"];
1a64deeb 72 __passive_servicegroups = "webstatus-resources";
eb071dd4
IB
73 }
74 {
75 service_description = "Memory usage";
76 use = "local-service";
77 check_command = ["check_memory" "80" "90"];
1a64deeb 78 __passive_servicegroups = "webstatus-resources";
eb071dd4
IB
79 }
80 {
81 service_description = "NTP is activated and working";
82 use = "local-service";
83 check_command = ["check_ntp"];
1a64deeb 84 __passive_servicegroups = "webstatus-resources";
eb071dd4
IB
85 }
86 ];
1a64deeb 87 command = {
eb071dd4
IB
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$";
c41d0de8 90 check_local_load = "$USER1$/check_load -r -w $ARG1$ -c $ARG2$";
eb071dd4 91 check_local_swap = "$USER1$/check_swap -n ok -w $ARG1$ -c $ARG2$";
eb071dd4 92 check_ntp = "$USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org";
e820134d 93 check_smtp = "$USER1$/check_smtp -H $HOSTADDRESS$ -p 25 -S -D 21,15";
eb071dd4
IB
94
95 check_host_alive = "$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5";
e820134d
IB
96 check_ok = "$USER1$/check_dummy 0 \"Dummy OK\"";
97 check_critical = "$USER1$/check_dummy 2 \"Dummy CRITICAL\"";
eb071dd4
IB
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 };
e820134d
IB
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 = {
c41d0de8 124 webstatus-hosts = { alias = "Hosts"; };
e820134d 125 };
eb071dd4
IB
126 contactgroup = {
127 admins = { alias = "Naemon Administrators"; };
128 };
eb071dd4
IB
129 templates = {
130 service = {
131 generic-service = {
132 active_checks_enabled = "1";
133 check_freshness = "0";
1a64deeb 134 check_interval = 10;
eb071dd4
IB
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";
e820134d 144 notifications_enabled = if master then "1" else "0";
eb071dd4
IB
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";
c41d0de8 151 _webstatus_namespace = "immae";
eb071dd4
IB
152 };
153 local-service = {
154 use = "generic-service";
155 host_name = hostFQDN;
1a64deeb 156 check_interval = 5;
eb071dd4
IB
157 max_check_attempts = "4";
158 retry_interval = "1";
e820134d
IB
159 servicegroups = "webstatus-resources";
160 };
161 external-service = {
162 use = "generic-service";
1a64deeb 163 check_interval = 5;
e820134d
IB
164 max_check_attempts = "4";
165 retry_interval = "1";
166 };
167 web-service = {
168 use = "generic-service";
1a64deeb 169 check_interval = 20;
e820134d
IB
170 max_check_attempts = "2";
171 retry_interval = "1";
172 };
173 external-web-service = {
174 use = "generic-service";
1a64deeb 175 check_interval = 20;
e820134d
IB
176 max_check_attempts = "2";
177 retry_interval = "1";
178 };
179 mail-service = {
180 use = "generic-service";
1a64deeb 181 check_interval = 15;
e820134d
IB
182 max_check_attempts = "1";
183 retry_interval = "1";
184 };
185 dns-service = {
186 use = "generic-service";
1a64deeb 187 check_interval = 120;
e820134d
IB
188 notification_interval = "120";
189 max_check_attempts = "5";
f07e6124 190 retry_interval = "30";
eb071dd4
IB
191 };
192 };
193 # No contact, we go through master
e820134d
IB
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 };
eb071dd4
IB
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";
c41d0de8 223 _webstatus_namespace = "immae";
eb071dd4
IB
224 };
225 };
226 };
227}