diff options
24 files changed, 2198 insertions, 0 deletions
diff --git a/modules/default.nix b/modules/default.nix index 5346956..9e9c411 100644 --- a/modules/default.nix +++ b/modules/default.nix | |||
@@ -13,6 +13,8 @@ | |||
13 | opendmarc = ./opendmarc.nix; | 13 | opendmarc = ./opendmarc.nix; |
14 | openarc = ./openarc.nix; | 14 | openarc = ./openarc.nix; |
15 | 15 | ||
16 | naemon = ./naemon; | ||
17 | |||
16 | php-application = ./websites/php-application.nix; | 18 | php-application = ./websites/php-application.nix; |
17 | websites = ./websites; | 19 | websites = ./websites; |
18 | } // (if builtins.pathExists ./private then import ./private else {}) | 20 | } // (if builtins.pathExists ./private then import ./private else {}) |
diff --git a/modules/myids.nix b/modules/myids.nix index e949ca7..ac9fd65 100644 --- a/modules/myids.nix +++ b/modules/myids.nix | |||
@@ -14,6 +14,7 @@ | |||
14 | mastodon = 399; | 14 | mastodon = 399; |
15 | }; | 15 | }; |
16 | ids.gids = { | 16 | ids.gids = { |
17 | nagios = 11; # commented in the ids file | ||
17 | vhost = 390; | 18 | vhost = 390; |
18 | openarc = 391; | 19 | openarc = 391; |
19 | opendmarc = 392; | 20 | opendmarc = 392; |
diff --git a/modules/naemon/default.nix b/modules/naemon/default.nix new file mode 100644 index 0000000..38e99a9 --- /dev/null +++ b/modules/naemon/default.nix | |||
@@ -0,0 +1,184 @@ | |||
1 | { config, lib, pkgs, ... }: | ||
2 | |||
3 | with lib; | ||
4 | |||
5 | let | ||
6 | cfg = config.services.naemon; | ||
7 | |||
8 | naemonConfig = pkgs.runCommand "naemon-config" { | ||
9 | objectsFile = pkgs.writeText "naemon_objects.cfg" cfg.objectDefs; | ||
10 | resourceFile = config.secrets.fullPaths."naemon/resources.cfg"; | ||
11 | extraConfig = pkgs.writeText "extra.cfg" cfg.extraConfig; | ||
12 | inherit (cfg) logDir varDir runDir cacheDir; | ||
13 | } '' | ||
14 | substituteAll ${./naemon.cfg} $out | ||
15 | cat $extraConfig >> $out | ||
16 | ''; | ||
17 | in | ||
18 | { | ||
19 | options = { | ||
20 | services.naemon = { | ||
21 | enable = mkOption { | ||
22 | default = false; | ||
23 | description = " | ||
24 | Whether to use <link | ||
25 | xlink:href='http://www.naemon.org/'>Naemon</link> to monitor | ||
26 | your system or network. | ||
27 | "; | ||
28 | }; | ||
29 | |||
30 | objectDefs = mkOption { | ||
31 | type = types.lines; | ||
32 | default = ""; | ||
33 | description = " | ||
34 | A list of Naemon object configuration that must define | ||
35 | the hosts, host groups, services and contacts for the | ||
36 | network that you want Naemon to monitor. | ||
37 | "; | ||
38 | }; | ||
39 | |||
40 | extraResource = mkOption { | ||
41 | type = types.lines; | ||
42 | default = ""; | ||
43 | example = '' | ||
44 | # Sets $USER2$ to be the path to event handlers | ||
45 | #$USER2$=/usr/lib/monitoring-plugins/eventhandlers | ||
46 | |||
47 | # Store some usernames and passwords (hidden from the CGIs) | ||
48 | #$USER3$=someuser | ||
49 | #$USER4$=somepassword | ||
50 | ''; | ||
51 | description = " | ||
52 | Lines to add to the resource file | ||
53 | # You can define $USERx$ macros in this file, which can in turn be used | ||
54 | # in command definitions in your host config file(s). $USERx$ macros are | ||
55 | # useful for storing sensitive information such as usernames, passwords, | ||
56 | # etc. They are also handy for specifying the path to plugins and | ||
57 | # event handlers - if you decide to move the plugins or event handlers to | ||
58 | # a different directory in the future, you can just update one or two | ||
59 | # $USERx$ macros, instead of modifying a lot of command definitions. | ||
60 | # | ||
61 | # Naemon supports up to 256 $USERx$ macros ($USER1$ through $USER256$) | ||
62 | # | ||
63 | # Resource files may also be used to store configuration directives for | ||
64 | # external data sources like MySQL... | ||
65 | # | ||
66 | "; | ||
67 | }; | ||
68 | |||
69 | extraConfig = mkOption { | ||
70 | type = types.lines; | ||
71 | default = ""; | ||
72 | description = " | ||
73 | Extra config to append to main config | ||
74 | "; | ||
75 | }; | ||
76 | |||
77 | user = mkOption { | ||
78 | type = types.str; | ||
79 | default = "naemon"; | ||
80 | description = "User for naemon"; | ||
81 | }; | ||
82 | |||
83 | group = mkOption { | ||
84 | type = types.str; | ||
85 | default = "naemon"; | ||
86 | description = "Group for naemon"; | ||
87 | }; | ||
88 | |||
89 | varDir = mkOption { | ||
90 | type = types.path; | ||
91 | default = "/var/lib/naemon"; | ||
92 | description = "The directory where naemon stores its data"; | ||
93 | }; | ||
94 | |||
95 | cacheDir = mkOption { | ||
96 | type = types.path; | ||
97 | default = "/var/cache/naemon"; | ||
98 | description = "The directory where naemon stores its cache"; | ||
99 | }; | ||
100 | |||
101 | runDir = mkOption { | ||
102 | type = types.path; | ||
103 | default = "/run/naemon"; | ||
104 | description = "The directory where naemon stores its runtime files"; | ||
105 | }; | ||
106 | |||
107 | logDir = mkOption { | ||
108 | type = types.path; | ||
109 | default = "/var/log/naemon"; | ||
110 | description = "The directory where naemon stores its log files"; | ||
111 | }; | ||
112 | |||
113 | package = mkOption { | ||
114 | type = types.package; | ||
115 | default = pkgs.naemon.override { | ||
116 | inherit (cfg) varDir cacheDir logDir runDir user group; | ||
117 | }; | ||
118 | description = '' | ||
119 | Naemon package to use | ||
120 | ''; | ||
121 | }; | ||
122 | }; | ||
123 | }; | ||
124 | |||
125 | |||
126 | config = mkIf cfg.enable { | ||
127 | secrets.keys = [ | ||
128 | { | ||
129 | dest = "naemon/resources.cfg"; | ||
130 | user = cfg.user; | ||
131 | group = cfg.group; | ||
132 | permissions = "0400"; | ||
133 | text = '' | ||
134 | $USER1$=${pkgs.monitoring-plugins}/libexec | ||
135 | ${cfg.extraResource} | ||
136 | ''; | ||
137 | } | ||
138 | ]; | ||
139 | |||
140 | users.users = optionalAttrs (cfg.user == "naemon") (singleton | ||
141 | { | ||
142 | name = "naemon"; | ||
143 | group = cfg.group; | ||
144 | uid = config.ids.uids.nagios; | ||
145 | extraGroups = [ "keys" ]; | ||
146 | }); | ||
147 | users.groups = optionalAttrs (cfg.user == "naemon") (singleton | ||
148 | { | ||
149 | name = "naemon"; | ||
150 | gid = config.ids.gids.nagios; | ||
151 | }); | ||
152 | |||
153 | services.filesWatcher.naemon = { | ||
154 | paths = [ config.secrets.fullPaths."naemon/resources.cfg" ]; | ||
155 | }; | ||
156 | systemd.services.naemon = { | ||
157 | description = "Naemon monitoring daemon"; | ||
158 | path = [ cfg.package pkgs.monitoring-plugins ]; | ||
159 | wantedBy = [ "multi-user.target" ]; | ||
160 | after = [ "network.target" ]; | ||
161 | |||
162 | preStart = "${cfg.package}/bin/naemon -vp ${naemonConfig}"; | ||
163 | script = "${cfg.package}/bin/naemon --daemon ${naemonConfig}"; | ||
164 | reload = "${pkgs.utillinux}/bin/kill -HUP $MAINPID"; | ||
165 | serviceConfig = { | ||
166 | User = cfg.user; | ||
167 | Restart = "always"; | ||
168 | RestartSec = 2; | ||
169 | StandardOutput = "journal"; | ||
170 | StandardError = "inherit"; | ||
171 | PIDFile = "${cfg.runDir}/naemon.pid"; | ||
172 | LogsDirectory = assert lib.strings.hasPrefix "/var/log/" cfg.logDir; | ||
173 | lib.strings.removePrefix "/var/log/" cfg.logDir; | ||
174 | CacheDirectory = assert lib.strings.hasPrefix "/var/cache/" cfg.cacheDir; | ||
175 | let unprefixed = lib.strings.removePrefix "/var/cache/" cfg.cacheDir; | ||
176 | in [ unprefixed "${unprefixed}/checkresults" ]; | ||
177 | StateDirectory = assert lib.strings.hasPrefix "/var/lib/" cfg.varDir; | ||
178 | lib.strings.removePrefix "/var/lib/" cfg.varDir; | ||
179 | RuntimeDirectory = assert lib.strings.hasPrefix "/run/" cfg.runDir; | ||
180 | lib.strings.removePrefix "/run/" cfg.runDir; | ||
181 | }; | ||
182 | }; | ||
183 | }; | ||
184 | } | ||
diff --git a/modules/naemon/naemon.cfg b/modules/naemon/naemon.cfg new file mode 100644 index 0000000..792e03b --- /dev/null +++ b/modules/naemon/naemon.cfg | |||
@@ -0,0 +1,1059 @@ | |||
1 | ############################################################################## | ||
2 | # | ||
3 | # naemon.cfg - Sample Main Config File for Naemon 1.0.10.gc2a87305.dirty.20190703.source | ||
4 | # | ||
5 | # Read the documentation for more information on this configuration | ||
6 | # file. I've provided some comments here, but things may not be so | ||
7 | # clear without further explanation. | ||
8 | # | ||
9 | # | ||
10 | ############################################################################## | ||
11 | |||
12 | |||
13 | # LOG FILE | ||
14 | # This is the main log file where service and host events are logged | ||
15 | # for historical purposes. This should be the first option specified | ||
16 | # in the config file!!! | ||
17 | |||
18 | log_file=@logDir@/naemon.log | ||
19 | |||
20 | |||
21 | |||
22 | # OBJECT CONFIGURATION FILE(S) | ||
23 | # These are the object configuration files in which you define hosts, | ||
24 | # host groups, contacts, contact groups, services, etc. | ||
25 | # You can split your object definitions across several config files | ||
26 | # if you wish (as shown below), or keep them all in a single config file. | ||
27 | |||
28 | # You can specify individual object config files as shown below: | ||
29 | #cfg_file=/etc/naemon/objects/commands.cfg | ||
30 | #cfg_file=/etc/naemon/objects/contacts.cfg | ||
31 | #cfg_file=/etc/naemon/objects/timeperiods.cfg | ||
32 | #cfg_file=/etc/naemon/objects/templates.cfg | ||
33 | cfg_file=@objectsFile@ | ||
34 | |||
35 | |||
36 | # You can also tell naemon to process all config files (with a .cfg | ||
37 | # extension) in a particular directory by using the cfg_dir | ||
38 | # directive as shown below: | ||
39 | #cfg_dir=/etc/naemon/conf.d | ||
40 | |||
41 | |||
42 | |||
43 | |||
44 | # OBJECT CACHE FILE | ||
45 | # This option determines where object definitions are cached when | ||
46 | # naemon starts/restarts. The CGIs read object definitions from | ||
47 | # this cache file (rather than looking at the object config files | ||
48 | # directly) in order to prevent inconsistencies that can occur | ||
49 | # when the config files are modified after naemon starts. | ||
50 | |||
51 | object_cache_file=@varDir@/objects.cache | ||
52 | |||
53 | |||
54 | |||
55 | # PRE-CACHED OBJECT FILE | ||
56 | # This options determines the location of the precached object file. | ||
57 | # If you run naemon with the -p command line option, it will preprocess | ||
58 | # your object configuration file(s) and write the cached config to this | ||
59 | # file. You can then start naemon with the -u option to have it read | ||
60 | # object definitions from this precached file, rather than the standard | ||
61 | # object configuration files (see the cfg_file and cfg_dir options above). | ||
62 | # Using a precached object file can speed up the time needed to (re)start | ||
63 | # the naemon process if you've got a large and/or complex configuration. | ||
64 | # Read the documentation section on optimizing naemon to find our more | ||
65 | # about how this feature works. | ||
66 | |||
67 | precached_object_file=@varDir@/objects.precache | ||
68 | |||
69 | |||
70 | |||
71 | # RESOURCE FILE | ||
72 | # This is an optional resource file that contains $USERx$ macro | ||
73 | # definitions. Multiple resource files can be specified by using | ||
74 | # multiple resource_file definitions. The CGIs will not attempt to | ||
75 | # read the contents of resource files, so information that is | ||
76 | # considered to be sensitive (usernames, passwords, etc) can be | ||
77 | # defined as macros in this file and restrictive permissions (600) | ||
78 | # can be placed on this file. | ||
79 | |||
80 | resource_file=@resourceFile@ | ||
81 | |||
82 | |||
83 | |||
84 | # STATUS FILE | ||
85 | # This is where the current status of all monitored services and | ||
86 | # hosts is stored. Its contents are read and processed by the CGIs. | ||
87 | # The contents of the status file are deleted every time naemon | ||
88 | # restarts. | ||
89 | |||
90 | status_file=@varDir@/status.dat | ||
91 | |||
92 | |||
93 | |||
94 | # STATUS FILE UPDATE INTERVAL | ||
95 | # This option determines the frequency (in seconds) that | ||
96 | # naemon will periodically dump program, host, and | ||
97 | # service status data. Set it to 0 to disable updates. | ||
98 | |||
99 | status_update_interval=10 | ||
100 | |||
101 | |||
102 | |||
103 | # EXTERNAL COMMAND OPTION | ||
104 | # This option allows you to specify whether or not Naemon should check | ||
105 | # for external commands (in the command file defined below). By default | ||
106 | # Naemon will *not* check for external commands, just to be on the | ||
107 | # cautious side. If you want to be able to use the CGI command interface | ||
108 | # you will have to enable this. | ||
109 | # Values: 0 = disable commands, 1 = enable commands | ||
110 | |||
111 | check_external_commands=1 | ||
112 | |||
113 | |||
114 | |||
115 | # EXTERNAL COMMAND FILE | ||
116 | # This is the file that Naemon checks for external command requests. | ||
117 | # It is also where the command CGI will write commands that are submitted | ||
118 | # by users, so it must be writeable by the user that the web server | ||
119 | # is running as (usually 'nobody'). Permissions should be set at the | ||
120 | # directory level instead of on the file, as the file is deleted every | ||
121 | # time its contents are processed. | ||
122 | |||
123 | command_file=@runDir@/naemon.cmd | ||
124 | |||
125 | |||
126 | |||
127 | # QUERY HANDLER INTERFACE | ||
128 | # This is the socket that is created for the Query Handler interface | ||
129 | |||
130 | query_socket=@runDir@/naemon.qh | ||
131 | |||
132 | |||
133 | |||
134 | # LOCK FILE | ||
135 | # This is the lockfile that Naemon will use to store its PID number | ||
136 | # in when it is running in daemon mode. | ||
137 | |||
138 | lock_file=@runDir@/naemon.pid | ||
139 | |||
140 | |||
141 | |||
142 | # TEMP FILE | ||
143 | # This is a temporary file that is used as scratch space when Naemon | ||
144 | # updates the status log, cleans the comment file, etc. This file | ||
145 | # is created, used, and deleted throughout the time that Naemon is | ||
146 | # running. | ||
147 | |||
148 | temp_file=@cacheDir@/naemon.tmp | ||
149 | |||
150 | |||
151 | |||
152 | # TEMP PATH | ||
153 | # This is path where Naemon can create temp files for service and | ||
154 | # host check results, etc. | ||
155 | |||
156 | temp_path=@cacheDir@ | ||
157 | |||
158 | |||
159 | |||
160 | # EVENT BROKER OPTIONS | ||
161 | # Controls what (if any) data gets sent to the event broker. | ||
162 | # Values: 0 = Broker nothing | ||
163 | # -1 = Broker everything | ||
164 | # <other> = See documentation | ||
165 | |||
166 | event_broker_options=-1 | ||
167 | |||
168 | |||
169 | |||
170 | # EVENT BROKER MODULE(S) | ||
171 | # This directive is used to specify an event broker module that should | ||
172 | # be loaded by Naemon at startup. Use multiple directives if you want | ||
173 | # to load more than one module. Arguments that should be passed to | ||
174 | # the module at startup are seperated from the module path by a space. | ||
175 | # | ||
176 | # Example: | ||
177 | # | ||
178 | # broker_module=<modulepath> [moduleargs] | ||
179 | |||
180 | #broker_module=/usr/lib/naemon/naemon-livestatus/livestatus.so @cacheDir@/live | ||
181 | #broker_module=/somewhere/module1.o | ||
182 | #broker_module=/somewhere/module2.o arg1 arg2=3 debug=0 | ||
183 | |||
184 | # In order to provide drop-in support for new modules, you can also make use of | ||
185 | # the include_dir directive. The include_dir directive causes Naemon to parse | ||
186 | # any configuration (not just object configuration, as with cfg_dir) as if the | ||
187 | # contents of the files in the pointed-to directory was included on this line. | ||
188 | # The path to the directory is relative to the path of the main naemon.cfg | ||
189 | # file. | ||
190 | #include_dir=module-conf.d | ||
191 | |||
192 | # LOG ARCHIVE PATH | ||
193 | # This is the directory where archived (rotated) log files are placed by the | ||
194 | # logrotate daemon. It is used by out of core add-ons to discover the logfiles. | ||
195 | |||
196 | log_archive_path=@logDir@/archives | ||
197 | |||
198 | |||
199 | |||
200 | # LOGGING OPTIONS | ||
201 | # If you want messages logged to the syslog facility, as well as the | ||
202 | # Naemon log file set this option to 1. If not, set it to 0. | ||
203 | |||
204 | use_syslog=0 | ||
205 | |||
206 | # NOTIFICATION LOGGING OPTION | ||
207 | # If you don't want notifications to be logged, set this value to 0. | ||
208 | # If notifications should be logged, set the value to 1. | ||
209 | |||
210 | log_notifications=1 | ||
211 | |||
212 | # Notification suppression reason (NSR) logging causes the reason for a | ||
213 | # notification suppression to be logged, when it occurs. This can potentially | ||
214 | # add some noise to your log file, but is highly useful when troubleshooting | ||
215 | # missing notifications. | ||
216 | |||
217 | enable_notification_suppression_reason_logging=1 | ||
218 | |||
219 | |||
220 | # SERVICE RETRY LOGGING OPTION | ||
221 | # If you don't want service check retries to be logged, set this value | ||
222 | # to 0. If retries should be logged, set the value to 1. | ||
223 | |||
224 | log_service_retries=1 | ||
225 | |||
226 | |||
227 | |||
228 | # HOST RETRY LOGGING OPTION | ||
229 | # If you don't want host check retries to be logged, set this value to | ||
230 | # 0. If retries should be logged, set the value to 1. | ||
231 | |||
232 | log_host_retries=1 | ||
233 | |||
234 | |||
235 | |||
236 | # EVENT HANDLER LOGGING OPTION | ||
237 | # If you don't want host and service event handlers to be logged, set | ||
238 | # this value to 0. If event handlers should be logged, set the value | ||
239 | # to 1. | ||
240 | |||
241 | log_event_handlers=1 | ||
242 | |||
243 | |||
244 | |||
245 | # INITIAL STATES LOGGING OPTION | ||
246 | # If you want Naemon to log all initial host and service states to | ||
247 | # the main log file (the first time the service or host is checked) | ||
248 | # you can enable this option by setting this value to 1. If you | ||
249 | # are not using an external application that does long term state | ||
250 | # statistics reporting, you do not need to enable this option. In | ||
251 | # this case, set the value to 0. | ||
252 | |||
253 | log_initial_states=0 | ||
254 | |||
255 | |||
256 | |||
257 | # CURRENT STATES LOGGING OPTION | ||
258 | # If you don't want Naemon to log all current host and service states | ||
259 | # after log has been rotated to the main log file, you can disable this | ||
260 | # option by setting this value to 0. Default value is 1. | ||
261 | |||
262 | log_current_states=1 | ||
263 | |||
264 | |||
265 | |||
266 | # EXTERNAL COMMANDS LOGGING OPTION | ||
267 | # If you don't want Naemon to log external commands, set this value | ||
268 | # to 0. If external commands should be logged, set this value to 1. | ||
269 | # Note: This option does not include logging of passive service | ||
270 | # checks - see the option below for controlling whether or not | ||
271 | # passive checks are logged. | ||
272 | |||
273 | log_external_commands=1 | ||
274 | |||
275 | |||
276 | |||
277 | # PASSIVE CHECKS LOGGING OPTION | ||
278 | # If you don't want Naemon to log passive host and service checks, set | ||
279 | # this value to 0. If passive checks should be logged, set | ||
280 | # this value to 1. | ||
281 | |||
282 | log_passive_checks=1 | ||
283 | |||
284 | |||
285 | |||
286 | # GLOBAL HOST AND SERVICE EVENT HANDLERS | ||
287 | # These options allow you to specify a host and service event handler | ||
288 | # command that is to be run for every host or service state change. | ||
289 | # The global event handler is executed immediately prior to the event | ||
290 | # handler that you have optionally specified in each host or | ||
291 | # service definition. The command argument is the short name of a | ||
292 | # command definition that you define in your host configuration file. | ||
293 | # Read the HTML docs for more information. | ||
294 | |||
295 | #global_host_event_handler=somecommand | ||
296 | #global_service_event_handler=somecommand | ||
297 | |||
298 | |||
299 | |||
300 | # MAXIMUM CONCURRENT SERVICE CHECKS | ||
301 | # This option allows you to specify the maximum number of | ||
302 | # service checks that can be run in parallel at any given time. | ||
303 | # Specifying a value of 1 for this variable essentially prevents | ||
304 | # any service checks from being parallelized. A value of 0 | ||
305 | # will not restrict the number of concurrent checks that are | ||
306 | # being executed. | ||
307 | |||
308 | max_concurrent_checks=0 | ||
309 | |||
310 | |||
311 | # CHECK RESULT PATH | ||
312 | # This is directory where Naemon reads check results of host and | ||
313 | # service checks to further process them. | ||
314 | # | ||
315 | # Note: Naemon does not require this folder internally but it still | ||
316 | # can be used to pass check results to Naemon. | ||
317 | |||
318 | check_result_path=@cacheDir@/checkresults | ||
319 | |||
320 | |||
321 | # CACHED HOST CHECK HORIZON | ||
322 | # This option determines the maximum amount of time (in seconds) | ||
323 | # that the state of a previous host check is considered current. | ||
324 | # Cached host states (from host checks that were performed more | ||
325 | # recently that the timeframe specified by this value) can immensely | ||
326 | # improve performance in regards to the host check logic. | ||
327 | # Too high of a value for this option may result in inaccurate host | ||
328 | # states being used by Naemon, while a lower value may result in a | ||
329 | # performance hit for host checks. Use a value of 0 to disable host | ||
330 | # check caching. | ||
331 | |||
332 | cached_host_check_horizon=15 | ||
333 | |||
334 | |||
335 | |||
336 | # CACHED SERVICE CHECK HORIZON | ||
337 | # This option determines the maximum amount of time (in seconds) | ||
338 | # that the state of a previous service check is considered current. | ||
339 | # Cached service states (from service checks that were performed more | ||
340 | # recently that the timeframe specified by this value) can immensely | ||
341 | # improve performance in regards to predictive dependency checks. | ||
342 | # Use a value of 0 to disable service check caching. | ||
343 | |||
344 | cached_service_check_horizon=15 | ||
345 | |||
346 | |||
347 | |||
348 | # ENABLE PREDICTIVE HOST DEPENDENCY CHECKS | ||
349 | # This option determines whether or not Naemon will attempt to execute | ||
350 | # checks of hosts when it predicts that future dependency logic test | ||
351 | # may be needed. These predictive checks can help ensure that your | ||
352 | # host dependency logic works well. | ||
353 | # Values: | ||
354 | # 0 = Disable predictive checks | ||
355 | # 1 = Enable predictive checks (default) | ||
356 | |||
357 | enable_predictive_host_dependency_checks=1 | ||
358 | |||
359 | |||
360 | |||
361 | # ENABLE PREDICTIVE SERVICE DEPENDENCY CHECKS | ||
362 | # This option determines whether or not Naemon will attempt to execute | ||
363 | # checks of service when it predicts that future dependency logic test | ||
364 | # may be needed. These predictive checks can help ensure that your | ||
365 | # service dependency logic works well. | ||
366 | # Values: | ||
367 | # 0 = Disable predictive checks | ||
368 | # 1 = Enable predictive checks (default) | ||
369 | |||
370 | enable_predictive_service_dependency_checks=1 | ||
371 | |||
372 | |||
373 | |||
374 | # SOFT STATE DEPENDENCIES | ||
375 | # This option determines whether or not Naemon will use soft state | ||
376 | # information when checking host and service dependencies. Normally | ||
377 | # Naemon will only use the latest hard host or service state when | ||
378 | # checking dependencies. If you want it to use the latest state (regardless | ||
379 | # of whether its a soft or hard state type), enable this option. | ||
380 | # Values: | ||
381 | # 0 = Don't use soft state dependencies (default) | ||
382 | # 1 = Use soft state dependencies | ||
383 | |||
384 | soft_state_dependencies=0 | ||
385 | |||
386 | |||
387 | |||
388 | # TIME CHANGE ADJUSTMENT THRESHOLDS | ||
389 | # These options determine when Naemon will react to detected changes | ||
390 | # in system time (either forward or backwards). | ||
391 | |||
392 | #time_change_threshold=900 | ||
393 | |||
394 | |||
395 | |||
396 | # TIMEOUT VALUES | ||
397 | # These options control how much time Naemon will allow various | ||
398 | # types of commands to execute before killing them off. Options | ||
399 | # are available for controlling maximum time allotted for | ||
400 | # service checks, host checks, event handlers, notifications, the | ||
401 | # ocsp command, and performance data commands. All values are in | ||
402 | # seconds. | ||
403 | |||
404 | service_check_timeout=60 | ||
405 | host_check_timeout=30 | ||
406 | event_handler_timeout=30 | ||
407 | notification_timeout=30 | ||
408 | ocsp_timeout=5 | ||
409 | perfdata_timeout=5 | ||
410 | |||
411 | |||
412 | |||
413 | # RETAIN STATE INFORMATION | ||
414 | # This setting determines whether or not Naemon will save state | ||
415 | # information for services and hosts before it shuts down. Upon | ||
416 | # startup Naemon will reload all saved service and host state | ||
417 | # information before starting to monitor. This is useful for | ||
418 | # maintaining long-term data on state statistics, etc, but will | ||
419 | # slow Naemon down a bit when it (re)starts. Since its only | ||
420 | # a one-time penalty, I think its well worth the additional | ||
421 | # startup delay. | ||
422 | |||
423 | retain_state_information=1 | ||
424 | |||
425 | |||
426 | |||
427 | # STATE RETENTION FILE | ||
428 | # This is the file that Naemon should use to store host and | ||
429 | # service state information before it shuts down. The state | ||
430 | # information in this file is also read immediately prior to | ||
431 | # starting to monitor the network when Naemon is restarted. | ||
432 | # This file is used only if the retain_state_information | ||
433 | # variable is set to 1. | ||
434 | |||
435 | state_retention_file=@varDir@/retention.dat | ||
436 | |||
437 | |||
438 | |||
439 | # RETENTION DATA UPDATE INTERVAL | ||
440 | # This setting determines how often (in minutes) that Naemon | ||
441 | # will automatically save retention data during normal operation. | ||
442 | # If you set this value to 0, Naemon will not save retention | ||
443 | # data at regular interval, but it will still save retention | ||
444 | # data before shutting down or restarting. If you have disabled | ||
445 | # state retention, this option has no effect. | ||
446 | |||
447 | retention_update_interval=60 | ||
448 | |||
449 | |||
450 | |||
451 | # USE RETAINED PROGRAM STATE | ||
452 | # This setting determines whether or not Naemon will set | ||
453 | # program status variables based on the values saved in the | ||
454 | # retention file. If you want to use retained program status | ||
455 | # information, set this value to 1. If not, set this value | ||
456 | # to 0. | ||
457 | |||
458 | use_retained_program_state=1 | ||
459 | |||
460 | |||
461 | |||
462 | # USE RETAINED SCHEDULING INFO | ||
463 | # This setting determines whether or not Naemon will retain | ||
464 | # the scheduling info (next check time) for hosts and services | ||
465 | # based on the values saved in the retention file. If you | ||
466 | # If you want to use retained scheduling info, set this | ||
467 | # value to 1. If not, set this value to 0. | ||
468 | |||
469 | use_retained_scheduling_info=1 | ||
470 | |||
471 | |||
472 | # RETAINED_SCHEDULING_RANDOMIZE_WINDOW | ||
473 | # If use_retained_scheduling info is enabled, this setting | ||
474 | # sets the window (in seconds), in which checks that were | ||
475 | # supposed to executed during a restart, is rescheduled. | ||
476 | # That is, if set to 60 seconds, then all checks that were | ||
477 | # missed due to a restart will be scheduled randomly to be | ||
478 | # executed in the first 60 seconds after a restart. | ||
479 | # If the retained_scheduling_randomize_window is larger than | ||
480 | # the objects check_interval, the check_interval is used | ||
481 | # instead. | ||
482 | |||
483 | retained_scheduling_randomize_window=60 | ||
484 | |||
485 | |||
486 | # RETAINED ATTRIBUTE MASKS (ADVANCED FEATURE) | ||
487 | # The following variables are used to specify specific host and | ||
488 | # service attributes that should *not* be retained by Naemon during | ||
489 | # program restarts. | ||
490 | # | ||
491 | # The values of the masks are bitwise ANDs of values specified | ||
492 | # by the "MODATTR_" definitions found in include/common.h. | ||
493 | # For example, if you do not want the current enabled/disabled state | ||
494 | # of flap detection and event handlers for hosts to be retained, you | ||
495 | # would use a value of 24 for the host attribute mask... | ||
496 | # MODATTR_EVENT_HANDLER_ENABLED (8) + MODATTR_FLAP_DETECTION_ENABLED (16) = 24 | ||
497 | |||
498 | # This mask determines what host attributes are not retained | ||
499 | retained_host_attribute_mask=0 | ||
500 | |||
501 | # This mask determines what service attributes are not retained | ||
502 | retained_service_attribute_mask=0 | ||
503 | |||
504 | # These two masks determine what process attributes are not retained. | ||
505 | # There are two masks, because some process attributes have host and service | ||
506 | # options. For example, you can disable active host checks, but leave active | ||
507 | # service checks enabled. | ||
508 | retained_process_host_attribute_mask=0 | ||
509 | retained_process_service_attribute_mask=0 | ||
510 | |||
511 | # These two masks determine what contact attributes are not retained. | ||
512 | # There are two masks, because some contact attributes have host and | ||
513 | # service options. For example, you can disable host notifications for | ||
514 | # a contact, but leave service notifications enabled for them. | ||
515 | retained_contact_host_attribute_mask=0 | ||
516 | retained_contact_service_attribute_mask=0 | ||
517 | |||
518 | |||
519 | |||
520 | # INTERVAL LENGTH | ||
521 | # This is the seconds per unit interval as used in the | ||
522 | # host/contact/service configuration files. Setting this to 60 means | ||
523 | # that each interval is one minute long (60 seconds). Other settings | ||
524 | # have not been tested much, so your mileage is likely to vary... | ||
525 | |||
526 | interval_length=60 | ||
527 | |||
528 | |||
529 | |||
530 | # AGGRESSIVE HOST CHECKING OPTION | ||
531 | # If you don't want to turn on aggressive host checking features, set | ||
532 | # this value to 0 (the default). Otherwise set this value to 1 to | ||
533 | # enable the aggressive check option. Read the docs for more info | ||
534 | # on what aggressive host check is or check out the source code in | ||
535 | # base/checks.c | ||
536 | |||
537 | use_aggressive_host_checking=0 | ||
538 | |||
539 | |||
540 | |||
541 | # SERVICE CHECK EXECUTION OPTION | ||
542 | # This determines whether or not Naemon will actively execute | ||
543 | # service checks when it initially starts. If this option is | ||
544 | # disabled, checks are not actively made, but Naemon can still | ||
545 | # receive and process passive check results that come in. Unless | ||
546 | # you're implementing redundant hosts or have a special need for | ||
547 | # disabling the execution of service checks, leave this enabled! | ||
548 | # Values: 1 = enable checks, 0 = disable checks | ||
549 | |||
550 | execute_service_checks=1 | ||
551 | |||
552 | |||
553 | |||
554 | # PASSIVE SERVICE CHECK ACCEPTANCE OPTION | ||
555 | # This determines whether or not Naemon will accept passive | ||
556 | # service checks results when it initially (re)starts. | ||
557 | # Values: 1 = accept passive checks, 0 = reject passive checks | ||
558 | |||
559 | accept_passive_service_checks=1 | ||
560 | |||
561 | |||
562 | |||
563 | # HOST CHECK EXECUTION OPTION | ||
564 | # This determines whether or not Naemon will actively execute | ||
565 | # host checks when it initially starts. If this option is | ||
566 | # disabled, checks are not actively made, but Naemon can still | ||
567 | # receive and process passive check results that come in. Unless | ||
568 | # you're implementing redundant hosts or have a special need for | ||
569 | # disabling the execution of host checks, leave this enabled! | ||
570 | # Values: 1 = enable checks, 0 = disable checks | ||
571 | |||
572 | execute_host_checks=1 | ||
573 | |||
574 | |||
575 | |||
576 | # PASSIVE HOST CHECK ACCEPTANCE OPTION | ||
577 | # This determines whether or not Naemon will accept passive | ||
578 | # host checks results when it initially (re)starts. | ||
579 | # Values: 1 = accept passive checks, 0 = reject passive checks | ||
580 | |||
581 | accept_passive_host_checks=1 | ||
582 | |||
583 | |||
584 | |||
585 | # NOTIFICATIONS OPTION | ||
586 | # This determines whether or not Naemon will sent out any host or | ||
587 | # service notifications when it is initially (re)started. | ||
588 | # Values: 1 = enable notifications, 0 = disable notifications | ||
589 | |||
590 | enable_notifications=1 | ||
591 | |||
592 | |||
593 | |||
594 | # EVENT HANDLER USE OPTION | ||
595 | # This determines whether or not Naemon will run any host or | ||
596 | # service event handlers when it is initially (re)started. Unless | ||
597 | # you're implementing redundant hosts, leave this option enabled. | ||
598 | # Values: 1 = enable event handlers, 0 = disable event handlers | ||
599 | |||
600 | enable_event_handlers=1 | ||
601 | |||
602 | |||
603 | |||
604 | # PROCESS PERFORMANCE DATA OPTION | ||
605 | # This determines whether or not Naemon will process performance | ||
606 | # data returned from service and host checks. If this option is | ||
607 | # enabled, host performance data will be processed using the | ||
608 | # host_perfdata_command (defined below) and service performance | ||
609 | # data will be processed using the service_perfdata_command (also | ||
610 | # defined below). Read the HTML docs for more information on | ||
611 | # performance data. | ||
612 | # Values: 1 = process performance data, 0 = do not process performance data | ||
613 | |||
614 | process_performance_data=0 | ||
615 | |||
616 | |||
617 | |||
618 | # HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS | ||
619 | # These commands are run after every host and service check is | ||
620 | # performed. These commands are executed only if the | ||
621 | # enable_performance_data option (above) is set to 1. The command | ||
622 | # argument is the short name of a command definition that you | ||
623 | # define in your host configuration file. Read the HTML docs for | ||
624 | # more information on performance data. | ||
625 | |||
626 | #host_perfdata_command=process-host-perfdata | ||
627 | #service_perfdata_command=process-service-perfdata | ||
628 | |||
629 | |||
630 | |||
631 | # HOST AND SERVICE PERFORMANCE DATA FILES | ||
632 | # These files are used to store host and service performance data. | ||
633 | # Performance data is only written to these files if the | ||
634 | # enable_performance_data option (above) is set to 1. | ||
635 | |||
636 | #host_perfdata_file=@varDir@/host-perfdata | ||
637 | #service_perfdata_file=@varDir@/service-perfdata | ||
638 | |||
639 | |||
640 | |||
641 | # HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES | ||
642 | # These options determine what data is written (and how) to the | ||
643 | # performance data files. The templates may contain macros, special | ||
644 | # characters (\t for tab, \r for carriage return, \n for newline) | ||
645 | # and plain text. A newline is automatically added after each write | ||
646 | # to the performance data file. Some examples of what you can do are | ||
647 | # shown below. | ||
648 | |||
649 | #host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$ | ||
650 | #service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$ | ||
651 | |||
652 | |||
653 | |||
654 | # HOST AND SERVICE PERFORMANCE DATA FILE MODES | ||
655 | # This option determines whether or not the host and service | ||
656 | # performance data files are opened in write ("w") or append ("a") | ||
657 | # mode. If you want to use named pipes, you should use the special | ||
658 | # pipe ("p") mode which avoid blocking at startup, otherwise you will | ||
659 | # likely want the defult append ("a") mode. | ||
660 | |||
661 | #host_perfdata_file_mode=a | ||
662 | #service_perfdata_file_mode=a | ||
663 | |||
664 | |||
665 | |||
666 | # HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL | ||
667 | # These options determine how often (in seconds) the host and service | ||
668 | # performance data files are processed using the commands defined | ||
669 | # below. A value of 0 indicates the files should not be periodically | ||
670 | # processed. | ||
671 | |||
672 | #host_perfdata_file_processing_interval=0 | ||
673 | #service_perfdata_file_processing_interval=0 | ||
674 | |||
675 | |||
676 | |||
677 | # HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS | ||
678 | # These commands are used to periodically process the host and | ||
679 | # service performance data files. The interval at which the | ||
680 | # processing occurs is determined by the options above. | ||
681 | |||
682 | #host_perfdata_file_processing_command=process-host-perfdata-file | ||
683 | #service_perfdata_file_processing_command=process-service-perfdata-file | ||
684 | |||
685 | |||
686 | |||
687 | # HOST AND SERVICE PERFORMANCE DATA PROCESS EMPTY RESULTS | ||
688 | # These options determine wether the core will process empty perfdata | ||
689 | # results or not. This is needed for distributed monitoring, and intentionally | ||
690 | # turned on by default. | ||
691 | # If you don't require empty perfdata - saving some cpu cycles | ||
692 | # on unwanted macro calculation - you can turn that off. Be careful! | ||
693 | # Values: 1 = enable, 0 = disable | ||
694 | |||
695 | #host_perfdata_process_empty_results=1 | ||
696 | #service_perfdata_process_empty_results=1 | ||
697 | |||
698 | |||
699 | # OBSESS OVER SERVICE CHECKS OPTION | ||
700 | # This determines whether or not Naemon will obsess over service | ||
701 | # checks and run the ocsp_command defined below. Unless you're | ||
702 | # planning on implementing distributed monitoring, do not enable | ||
703 | # this option. Read the HTML docs for more information on | ||
704 | # implementing distributed monitoring. | ||
705 | # Values: 1 = obsess over services, 0 = do not obsess (default) | ||
706 | |||
707 | obsess_over_services=0 | ||
708 | |||
709 | |||
710 | |||
711 | # OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND | ||
712 | # This is the command that is run for every service check that is | ||
713 | # processed by Naemon. This command is executed only if the | ||
714 | # obsess_over_services option (above) is set to 1. The command | ||
715 | # argument is the short name of a command definition that you | ||
716 | # define in your host configuration file. Read the HTML docs for | ||
717 | # more information on implementing distributed monitoring. | ||
718 | |||
719 | #ocsp_command=somecommand | ||
720 | |||
721 | |||
722 | |||
723 | # OBSESS OVER HOST CHECKS OPTION | ||
724 | # This determines whether or not Naemon will obsess over host | ||
725 | # checks and run the ochp_command defined below. Unless you're | ||
726 | # planning on implementing distributed monitoring, do not enable | ||
727 | # this option. Read the HTML docs for more information on | ||
728 | # implementing distributed monitoring. | ||
729 | # Values: 1 = obsess over hosts, 0 = do not obsess (default) | ||
730 | |||
731 | obsess_over_hosts=0 | ||
732 | |||
733 | |||
734 | |||
735 | # OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND | ||
736 | # This is the command that is run for every host check that is | ||
737 | # processed by Naemon. This command is executed only if the | ||
738 | # obsess_over_hosts option (above) is set to 1. The command | ||
739 | # argument is the short name of a command definition that you | ||
740 | # define in your host configuration file. Read the HTML docs for | ||
741 | # more information on implementing distributed monitoring. | ||
742 | |||
743 | #ochp_command=somecommand | ||
744 | |||
745 | |||
746 | |||
747 | # TRANSLATE PASSIVE HOST CHECKS OPTION | ||
748 | # This determines whether or not Naemon will translate | ||
749 | # DOWN/UNREACHABLE passive host check results into their proper | ||
750 | # state for this instance of Naemon. This option is useful | ||
751 | # if you have distributed or failover monitoring setup. In | ||
752 | # these cases your other Naemon servers probably have a different | ||
753 | # "view" of the network, with regards to the parent/child relationship | ||
754 | # of hosts. If a distributed monitoring server thinks a host | ||
755 | # is DOWN, it may actually be UNREACHABLE from the point of | ||
756 | # this Naemon instance. Enabling this option will tell Naemon | ||
757 | # to translate any DOWN or UNREACHABLE host states it receives | ||
758 | # passively into the correct state from the view of this server. | ||
759 | # Values: 1 = perform translation, 0 = do not translate (default) | ||
760 | |||
761 | translate_passive_host_checks=0 | ||
762 | |||
763 | |||
764 | |||
765 | # PASSIVE HOST CHECKS ARE SOFT OPTION | ||
766 | # This determines whether or not Naemon will treat passive host | ||
767 | # checks as being HARD or SOFT. By default, a passive host check | ||
768 | # result will put a host into a HARD state type. This can be changed | ||
769 | # by enabling this option. | ||
770 | # Values: 0 = passive checks are HARD, 1 = passive checks are SOFT | ||
771 | |||
772 | passive_host_checks_are_soft=0 | ||
773 | |||
774 | |||
775 | |||
776 | # ORPHANED HOST/SERVICE CHECK OPTIONS | ||
777 | # These options determine whether or not Naemon will periodically | ||
778 | # check for orphaned host service checks. Since service checks are | ||
779 | # not rescheduled until the results of their previous execution | ||
780 | # instance are processed, there exists a possibility that some | ||
781 | # checks may never get rescheduled. A similar situation exists for | ||
782 | # host checks, although the exact scheduling details differ a bit | ||
783 | # from service checks. Orphaned checks seem to be a rare | ||
784 | # problem and should not happen under normal circumstances. | ||
785 | # If you have problems with service checks never getting | ||
786 | # rescheduled, make sure you have orphaned service checks enabled. | ||
787 | # Values: 1 = enable checks, 0 = disable checks | ||
788 | |||
789 | check_for_orphaned_services=1 | ||
790 | check_for_orphaned_hosts=1 | ||
791 | |||
792 | |||
793 | |||
794 | # SERVICE FRESHNESS CHECK OPTION | ||
795 | # This option determines whether or not Naemon will periodically | ||
796 | # check the "freshness" of service results. Enabling this option | ||
797 | # is useful for ensuring passive checks are received in a timely | ||
798 | # manner. | ||
799 | # Values: 1 = enabled freshness checking, 0 = disable freshness checking | ||
800 | |||
801 | check_service_freshness=1 | ||
802 | |||
803 | |||
804 | |||
805 | # SERVICE FRESHNESS CHECK INTERVAL | ||
806 | # This setting determines how often (in seconds) Naemon will | ||
807 | # check the "freshness" of service check results. If you have | ||
808 | # disabled service freshness checking, this option has no effect. | ||
809 | |||
810 | service_freshness_check_interval=60 | ||
811 | |||
812 | |||
813 | |||
814 | # SERVICE CHECK TIMEOUT STATE | ||
815 | # This setting determines the state Naemon will report when a | ||
816 | # service check times out - that is does not respond within | ||
817 | # service_check_timeout seconds. This can be useful if a | ||
818 | # machine is running at too high a load and you do not want | ||
819 | # to consider a failed service check to be critical (the default). | ||
820 | # Valid settings are: | ||
821 | # c - Critical (default) | ||
822 | # u - Unknown | ||
823 | # w - Warning | ||
824 | # o - OK | ||
825 | |||
826 | service_check_timeout_state=c | ||
827 | |||
828 | |||
829 | |||
830 | # HOST FRESHNESS CHECK OPTION | ||
831 | # This option determines whether or not Naemon will periodically | ||
832 | # check the "freshness" of host results. Enabling this option | ||
833 | # is useful for ensuring passive checks are received in a timely | ||
834 | # manner. | ||
835 | # Values: 1 = enabled freshness checking, 0 = disable freshness checking | ||
836 | |||
837 | check_host_freshness=0 | ||
838 | |||
839 | |||
840 | |||
841 | # HOST FRESHNESS CHECK INTERVAL | ||
842 | # This setting determines how often (in seconds) Naemon will | ||
843 | # check the "freshness" of host check results. If you have | ||
844 | # disabled host freshness checking, this option has no effect. | ||
845 | |||
846 | host_freshness_check_interval=60 | ||
847 | |||
848 | |||
849 | |||
850 | |||
851 | # ADDITIONAL FRESHNESS THRESHOLD LATENCY | ||
852 | # This setting determines the number of seconds that Naemon | ||
853 | # will add to any host and service freshness thresholds that | ||
854 | # it calculates (those not explicitly specified by the user). | ||
855 | |||
856 | additional_freshness_latency=15 | ||
857 | |||
858 | |||
859 | |||
860 | |||
861 | # FLAP DETECTION OPTION | ||
862 | # This option determines whether or not Naemon will try | ||
863 | # and detect hosts and services that are "flapping". | ||
864 | # Flapping occurs when a host or service changes between | ||
865 | # states too frequently. When Naemon detects that a | ||
866 | # host or service is flapping, it will temporarily suppress | ||
867 | # notifications for that host/service until it stops | ||
868 | # flapping. Flap detection is very experimental, so read | ||
869 | # the HTML documentation before enabling this feature! | ||
870 | # Values: 1 = enable flap detection | ||
871 | # 0 = disable flap detection (default) | ||
872 | |||
873 | enable_flap_detection=1 | ||
874 | |||
875 | |||
876 | |||
877 | # FLAP DETECTION THRESHOLDS FOR HOSTS AND SERVICES | ||
878 | # Read the HTML documentation on flap detection for | ||
879 | # an explanation of what this option does. This option | ||
880 | # has no effect if flap detection is disabled. | ||
881 | |||
882 | low_service_flap_threshold=5.0 | ||
883 | high_service_flap_threshold=20.0 | ||
884 | low_host_flap_threshold=5.0 | ||
885 | high_host_flap_threshold=20.0 | ||
886 | |||
887 | |||
888 | |||
889 | # DATE FORMAT OPTION | ||
890 | # This option determines how short dates are displayed. Valid options | ||
891 | # include: | ||
892 | # us (MM-DD-YYYY HH:MM:SS) | ||
893 | # euro (DD-MM-YYYY HH:MM:SS) | ||
894 | # iso8601 (YYYY-MM-DD HH:MM:SS) | ||
895 | # strict-iso8601 (YYYY-MM-DDTHH:MM:SS) | ||
896 | # | ||
897 | |||
898 | date_format=us | ||
899 | |||
900 | |||
901 | |||
902 | |||
903 | # TIMEZONE OFFSET | ||
904 | # This option is used to override the default timezone that this | ||
905 | # instance of Naemon runs in. If not specified, Naemon will use | ||
906 | # the system configured timezone. | ||
907 | |||
908 | #use_timezone=US/Mountain | ||
909 | #use_timezone=Australia/Brisbane | ||
910 | |||
911 | |||
912 | |||
913 | # ILLEGAL OBJECT NAME CHARACTERS | ||
914 | # This option allows you to specify illegal characters that cannot | ||
915 | # be used in host names, service descriptions, or names of other | ||
916 | # object types. | ||
917 | |||
918 | illegal_object_name_chars=`~!$%^&*|'"<>?,()= | ||
919 | |||
920 | |||
921 | |||
922 | # ILLEGAL MACRO OUTPUT CHARACTERS | ||
923 | # This option allows you to specify illegal characters that are | ||
924 | # stripped from macros before being used in notifications, event | ||
925 | # handlers, etc. This DOES NOT affect macros used in service or | ||
926 | # host check commands. | ||
927 | # The following macros are stripped of the characters you specify: | ||
928 | # $HOSTOUTPUT$ | ||
929 | # $HOSTPERFDATA$ | ||
930 | # $HOSTACKAUTHOR$ | ||
931 | # $HOSTACKCOMMENT$ | ||
932 | # $SERVICEOUTPUT$ | ||
933 | # $SERVICEPERFDATA$ | ||
934 | # $SERVICEACKAUTHOR$ | ||
935 | # $SERVICEACKCOMMENT$ | ||
936 | |||
937 | illegal_macro_output_chars=`~$&|'"<> | ||
938 | |||
939 | |||
940 | |||
941 | # REGULAR EXPRESSION MATCHING | ||
942 | # This option controls whether or not regular expression matching | ||
943 | # takes place in the object config files. Regular expression | ||
944 | # matching is used to match host, hostgroup, service, and service | ||
945 | # group names/descriptions in some fields of various object types. | ||
946 | # Values: 1 = enable regexp matching, 0 = disable regexp matching | ||
947 | |||
948 | use_regexp_matching=0 | ||
949 | |||
950 | |||
951 | |||
952 | # "TRUE" REGULAR EXPRESSION MATCHING | ||
953 | # This option controls whether or not "true" regular expression | ||
954 | # matching takes place in the object config files. This option | ||
955 | # only has an effect if regular expression matching is enabled | ||
956 | # (see above). If this option is DISABLED, regular expression | ||
957 | # matching only occurs if a string contains wildcard characters | ||
958 | # (* and ?). If the option is ENABLED, regexp matching occurs | ||
959 | # all the time (which can be annoying). | ||
960 | # Values: 1 = enable true matching, 0 = disable true matching | ||
961 | |||
962 | use_true_regexp_matching=0 | ||
963 | |||
964 | |||
965 | |||
966 | # ADMINISTRATOR EMAIL/PAGER ADDRESSES | ||
967 | # The email and pager address of a global administrator (likely you). | ||
968 | # Naemon never uses these values itself, but you can access them by | ||
969 | # using the $ADMINEMAIL$ and $ADMINPAGER$ macros in your notification | ||
970 | # commands. | ||
971 | |||
972 | admin_email=naemon@localhost | ||
973 | admin_pager=pagenaemon@localhost | ||
974 | |||
975 | |||
976 | |||
977 | # DEBUG LEVEL | ||
978 | # This option determines how much (if any) debugging information will | ||
979 | # be written to the debug file. OR values together to log multiple | ||
980 | # types of information. | ||
981 | # Values: | ||
982 | # -1 = Everything | ||
983 | # 0 = Nothing | ||
984 | # 1 = Functions | ||
985 | # 2 = Configuration | ||
986 | # 4 = Process information | ||
987 | # 8 = Scheduled events | ||
988 | # 16 = Host/service checks | ||
989 | # 32 = Notifications | ||
990 | # 64 = Event broker | ||
991 | # 128 = External commands | ||
992 | # 256 = Commands | ||
993 | # 512 = Scheduled downtime | ||
994 | # 1024 = Comments | ||
995 | # 2048 = Macros | ||
996 | |||
997 | debug_level=0 | ||
998 | |||
999 | |||
1000 | |||
1001 | # DEBUG VERBOSITY | ||
1002 | # This option determines how verbose the debug log out will be. | ||
1003 | # Values: 0 = Brief output | ||
1004 | # 1 = More detailed | ||
1005 | # 2 = Very detailed | ||
1006 | |||
1007 | debug_verbosity=1 | ||
1008 | |||
1009 | |||
1010 | |||
1011 | # DEBUG FILE | ||
1012 | # This option determines where Naemon should write debugging information. | ||
1013 | |||
1014 | debug_file=@cacheDir@/naemon.debug | ||
1015 | |||
1016 | |||
1017 | |||
1018 | # MAX DEBUG FILE SIZE | ||
1019 | # This option determines the maximum size (in bytes) of the debug file. If | ||
1020 | # the file grows larger than this size, it will be renamed with a .old | ||
1021 | # extension. If a file already exists with a .old extension it will | ||
1022 | # automatically be deleted. This helps ensure your disk space usage doesn't | ||
1023 | # get out of control when debugging Naemon. | ||
1024 | |||
1025 | max_debug_file_size=1000000 | ||
1026 | |||
1027 | |||
1028 | |||
1029 | # Should we allow hostgroups to have no hosts, we default this to off since | ||
1030 | # that was the old behavior | ||
1031 | |||
1032 | allow_empty_hostgroup_assignment=0 | ||
1033 | |||
1034 | |||
1035 | |||
1036 | # Normally worker count is dynamically allocated based on 1.5 * number of cpu's | ||
1037 | # with a minimum of 4 workers. This value will override the defaults | ||
1038 | |||
1039 | #check_workers=3 | ||
1040 | |||
1041 | |||
1042 | # DISABLE SERVICE CHECKS WHEN HOST DOWN | ||
1043 | # This option will disable all service checks if the host is not in an UP state | ||
1044 | # | ||
1045 | # While desirable in some environments, enabling this value can distort report | ||
1046 | # values as the expected quantity of checks will not have been performed | ||
1047 | |||
1048 | #host_down_disable_service_checks=0 | ||
1049 | |||
1050 | |||
1051 | # CIRCULAR DEPENDENCIES (EXPERIMENTAL) | ||
1052 | # Allow for circular dependencies in naemon's host graph. | ||
1053 | # Enabaling this will cause propagation the following to stop working: | ||
1054 | # * scheduling downtime | ||
1055 | # * enabling notification | ||
1056 | # * disabling notification | ||
1057 | # This feature is experimental and bugs might occur. | ||
1058 | |||
1059 | allow_circular_dependencies=0 | ||
diff --git a/modules/private/default.nix b/modules/private/default.nix index 552ee8c..5f97f7f 100644 --- a/modules/private/default.nix +++ b/modules/private/default.nix | |||
@@ -64,6 +64,7 @@ set = { | |||
64 | ftp = ./ftp.nix; | 64 | ftp = ./ftp.nix; |
65 | mpd = ./mpd.nix; | 65 | mpd = ./mpd.nix; |
66 | ssh = ./ssh; | 66 | ssh = ./ssh; |
67 | monitoring = ./monitoring; | ||
67 | 68 | ||
68 | system = ./system.nix; | 69 | system = ./system.nix; |
69 | }; | 70 | }; |
diff --git a/modules/private/monitoring/conf/contacts.cfg b/modules/private/monitoring/conf/contacts.cfg new file mode 100644 index 0000000..e088f69 --- /dev/null +++ b/modules/private/monitoring/conf/contacts.cfg | |||
@@ -0,0 +1,41 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | # CONTACT GROUPS | ||
4 | define contactgroup { | ||
5 | contactgroup_name admins | ||
6 | alias Naemon Administrators | ||
7 | # members immae | ||
8 | } | ||
9 | |||
10 | # No contact, we go through master | ||
11 | # define contact { | ||
12 | # contact_name immae | ||
13 | # alias Immae | ||
14 | # use generic-contact | ||
15 | # email ismael@bouya.org | ||
16 | # } | ||
17 | # | ||
18 | # define contact { | ||
19 | # name generic-contact | ||
20 | # host_notification_commands notify-host-by-email | ||
21 | # host_notification_options d,u,r,f,s | ||
22 | # host_notification_period 24x7 | ||
23 | # register 0 | ||
24 | # service_notification_commands notify-service-by-email | ||
25 | # service_notification_options w,u,c,r,f,s | ||
26 | # service_notification_period 24x7 | ||
27 | # } | ||
28 | # | ||
29 | # define command { | ||
30 | # command_name notify-host-by-email | ||
31 | # command_line SERVICENOTIFICATIONID="$SERVICENOTIFICATIONID$" HOSTSTATE="$HOSTSTATE$" HOSTOUTPUT="$HOSTOUTPUT$" $USER2$/notify_by_email host "$NOTIFICATIONTYPE$" "$HOSTALIAS$" "$LONGDATETIME$" "$CONTACTEMAIL$" $OVE | ||
32 | # #$OVE is to force naemon to run via shell instead of execve which fails here | ||
33 | # } | ||
34 | # | ||
35 | # # 'notify-service-by-email' command definition | ||
36 | # define command { | ||
37 | # command_name notify-service-by-email | ||
38 | # command_line SERVICENOTIFICATIONID="$SERVICENOTIFICATIONID$" SERVICEDESC="$SERVICEDESC$" SERVICESTATE="$SERVICESTATE$" SERVICEOUTPUT="$SERVICEOUTPUT$" $USER2$/notify_by_email service "$NOTIFICATIONTYPE$" "$HOSTALIAS$" "$LONGDATETIME$" "$CONTACTEMAIL$" $OVE | ||
39 | # # command_line sudo /usr/bin/strace -o /tmp/foo -vf -s 256 -u naemon $USER2$/notify_by_email | ||
40 | # #$OVE is to force naemon to run via shell instead of execve which fails here | ||
41 | # } | ||
diff --git a/modules/private/monitoring/conf/hosts.cfg b/modules/private/monitoring/conf/hosts.cfg new file mode 100644 index 0000000..d903b0a --- /dev/null +++ b/modules/private/monitoring/conf/hosts.cfg | |||
@@ -0,0 +1,32 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | define host { | ||
4 | name generic-host | ||
5 | event_handler_enabled 1 | ||
6 | flap_detection_enabled 1 | ||
7 | notification_period 24x7 | ||
8 | notifications_enabled 1 | ||
9 | process_perf_data 1 | ||
10 | register 0 | ||
11 | retain_nonstatus_information 1 | ||
12 | retain_status_information 1 | ||
13 | } | ||
14 | |||
15 | define host { | ||
16 | name linux-server | ||
17 | use generic-host | ||
18 | check_command check-host-alive | ||
19 | check_interval 5 | ||
20 | check_period 24x7 | ||
21 | contact_groups admins | ||
22 | max_check_attempts 10 | ||
23 | notification_interval 120 | ||
24 | notification_options d,u,r,f | ||
25 | register 0 | ||
26 | retry_interval 1 | ||
27 | } | ||
28 | |||
29 | define command { | ||
30 | command_name check-host-alive | ||
31 | command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 | ||
32 | } | ||
diff --git a/modules/private/monitoring/conf/local_services.cfg b/modules/private/monitoring/conf/local_services.cfg new file mode 100644 index 0000000..56bc8f6 --- /dev/null +++ b/modules/private/monitoring/conf/local_services.cfg | |||
@@ -0,0 +1,68 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | # System usage | ||
4 | define service { | ||
5 | service_description Size on root partition | ||
6 | use local-service | ||
7 | check_command check_local_disk!20%!10%!/ | ||
8 | } | ||
9 | define command { | ||
10 | command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ | ||
11 | command_name check_local_disk | ||
12 | } | ||
13 | |||
14 | define service { | ||
15 | service_description Total number of process | ||
16 | use local-service | ||
17 | check_command check_local_procs!250!400!RSZDT | ||
18 | } | ||
19 | define command { | ||
20 | command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ | ||
21 | command_name check_local_procs | ||
22 | } | ||
23 | |||
24 | define service { | ||
25 | service_description Average load | ||
26 | use local-service | ||
27 | check_command check_local_load!8.0,8.0,8.0!10.0,10.0,10.0 | ||
28 | } | ||
29 | define command { | ||
30 | command_line $USER1$/check_load -w $ARG1$ -c $ARG2$ | ||
31 | command_name check_local_load | ||
32 | } | ||
33 | |||
34 | define service { | ||
35 | service_description Swap usage | ||
36 | use local-service | ||
37 | check_command check_local_swap!20!10 | ||
38 | } | ||
39 | define command { | ||
40 | command_line $USER1$/check_swap -n ok -w $ARG1$ -c $ARG2$ | ||
41 | command_name check_local_swap | ||
42 | } | ||
43 | |||
44 | define service { | ||
45 | service_description Memory usage | ||
46 | use local-service | ||
47 | check_command check_memory!80!90 | ||
48 | } | ||
49 | define command { | ||
50 | command_line $USER2$/check_mem.sh -w $ARG1$ -c $ARG2$ | ||
51 | command_name check_memory | ||
52 | } | ||
53 | |||
54 | define command { | ||
55 | command_line $USER2$/check_command -c "$ARG1$" -s 0 -o "$ARG2$" $ARG3$ | ||
56 | command_name check_command_output | ||
57 | } | ||
58 | |||
59 | # Network dependent local services | ||
60 | define service { | ||
61 | service_description NTP is activated and working | ||
62 | use local-service | ||
63 | check_command check_ntp | ||
64 | } | ||
65 | define command { | ||
66 | command_line $USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org | ||
67 | command_name check_ntp | ||
68 | } | ||
diff --git a/modules/private/monitoring/conf/notify.cfg b/modules/private/monitoring/conf/notify.cfg new file mode 100644 index 0000000..63b380d --- /dev/null +++ b/modules/private/monitoring/conf/notify.cfg | |||
@@ -0,0 +1,8 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | define command { | ||
4 | command_line /etc/naemon/send_nrdp.sh -H "$HOSTADDRESS$" -s "$SERVICEDESC$" -S "$SERVICESTATEID$" -o "$SERVICEOUTPUT$" | ||
5 | command_name notify-master | ||
6 | } | ||
7 | |||
8 | |||
diff --git a/modules/private/monitoring/conf/objects.cfg b/modules/private/monitoring/conf/objects.cfg new file mode 100644 index 0000000..653477f --- /dev/null +++ b/modules/private/monitoring/conf/objects.cfg | |||
@@ -0,0 +1,84 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | define command { | ||
4 | command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 | ||
5 | command_name check-host-alive | ||
6 | } | ||
7 | |||
8 | define command { | ||
9 | command_line $USER2$/check_md_raid | ||
10 | command_name check_md_raid | ||
11 | } | ||
12 | |||
13 | define command { | ||
14 | command_line $USER2$/check_command -c "$ARG1$" -o "$ARG2$" $ARG3$ | ||
15 | command_name check_command_output | ||
16 | } | ||
17 | |||
18 | |||
19 | define command { | ||
20 | command_line /usr/bin/sudo -u postgres $USER2$/check_postgres_replication "$ARG1$" "$ARG2$" "$ARG3$" | ||
21 | command_name check_postgresql_replication | ||
22 | } | ||
23 | |||
24 | define service { | ||
25 | ## --PUPPET_NAME-- (called '_naginator_name' in the manifest) Databases are present in postgresql | ||
26 | active_checks_enabled 1 | ||
27 | check_command check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace'!public!-r postgres | ||
28 | check_freshness 0 | ||
29 | check_interval 5 | ||
30 | check_period 24x7 | ||
31 | contact_groups admins | ||
32 | event_handler_enabled 1 | ||
33 | flap_detection_enabled 1 | ||
34 | host_name caldance-1.v.immae.eu | ||
35 | is_volatile 0 | ||
36 | max_check_attempts 4 | ||
37 | notification_interval 60 | ||
38 | notification_options w,u,c,r | ||
39 | notification_period 24x7 | ||
40 | notifications_enabled 0 | ||
41 | obsess_over_service 1 | ||
42 | passive_checks_enabled 1 | ||
43 | process_perf_data 1 | ||
44 | retain_nonstatus_information 1 | ||
45 | retain_status_information 1 | ||
46 | retry_interval 1 | ||
47 | service_description Databases are present in postgresql | ||
48 | } | ||
49 | |||
50 | define command { | ||
51 | command_line $USER2$/check_last_file_date "$ARG1$" "$ARG2$" "$ARG3$" | ||
52 | command_name check_last_file_date | ||
53 | } | ||
54 | |||
55 | define command { | ||
56 | command_line $USER2$/check_date "$ARG1$" "$ARG2$" "$ARG3$" | ||
57 | command_name check_date | ||
58 | } | ||
59 | |||
60 | define service { | ||
61 | ## --PUPPET_NAME-- (called '_naginator_name' in the manifest) Postgresql replication for backup-1 is up to date | ||
62 | active_checks_enabled 1 | ||
63 | check_command check_postgresql_replication!backup-1!/run/postgresql!5432 | ||
64 | check_freshness 0 | ||
65 | check_interval 5 | ||
66 | check_period 24x7 | ||
67 | contact_groups admins | ||
68 | event_handler_enabled 1 | ||
69 | flap_detection_enabled 1 | ||
70 | host_name caldance-1.v.immae.eu | ||
71 | is_volatile 0 | ||
72 | max_check_attempts 4 | ||
73 | notification_interval 60 | ||
74 | notification_options w,u,c,r | ||
75 | notification_period 24x7 | ||
76 | notifications_enabled 0 | ||
77 | obsess_over_service 1 | ||
78 | passive_checks_enabled 1 | ||
79 | process_perf_data 1 | ||
80 | retain_nonstatus_information 1 | ||
81 | retain_status_information 1 | ||
82 | retry_interval 1 | ||
83 | service_description Postgresql replication for backup-1 is up to date | ||
84 | } | ||
diff --git a/modules/private/monitoring/conf/services.cfg b/modules/private/monitoring/conf/services.cfg new file mode 100644 index 0000000..0740dc7 --- /dev/null +++ b/modules/private/monitoring/conf/services.cfg | |||
@@ -0,0 +1,27 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | define service { | ||
4 | name generic-service | ||
5 | active_checks_enabled 1 | ||
6 | check_freshness 0 | ||
7 | check_interval 10 | ||
8 | check_period 24x7 | ||
9 | contact_groups admins | ||
10 | event_handler_enabled 1 | ||
11 | flap_detection_enabled 1 | ||
12 | is_volatile 0 | ||
13 | max_check_attempts 3 | ||
14 | notification_interval 60 | ||
15 | notification_options w,u,c,r,f | ||
16 | notification_period 24x7 | ||
17 | # no notification since we send them to master | ||
18 | notifications_enabled 0 | ||
19 | obsess_over_service 1 | ||
20 | passive_checks_enabled 1 | ||
21 | process_perf_data 1 | ||
22 | register 0 | ||
23 | retain_nonstatus_information 1 | ||
24 | retain_status_information 1 | ||
25 | retry_interval 2 | ||
26 | } | ||
27 | |||
diff --git a/modules/private/monitoring/conf/timeperiods.cfg b/modules/private/monitoring/conf/timeperiods.cfg new file mode 100644 index 0000000..5ffe4ca --- /dev/null +++ b/modules/private/monitoring/conf/timeperiods.cfg | |||
@@ -0,0 +1,15 @@ | |||
1 | # vim: filetype=nagios | ||
2 | |||
3 | define timeperiod { | ||
4 | alias 24 Hours A Day, 7 Days A Week | ||
5 | friday 00:00-24:00 | ||
6 | monday 00:00-24:00 | ||
7 | saturday 00:00-24:00 | ||
8 | sunday 00:00-24:00 | ||
9 | thursday 00:00-24:00 | ||
10 | timeperiod_name 24x7 | ||
11 | tuesday 00:00-24:00 | ||
12 | wednesday 00:00-24:00 | ||
13 | } | ||
14 | |||
15 | |||
diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix new file mode 100644 index 0000000..11861ad --- /dev/null +++ b/modules/private/monitoring/default.nix | |||
@@ -0,0 +1,111 @@ | |||
1 | { config, myconfig, pkgs, lib, ... }: | ||
2 | let | ||
3 | myplugins = pkgs.runCommand "buildplugins" { | ||
4 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; | ||
5 | } '' | ||
6 | mkdir $out | ||
7 | cp ${./plugins}/* $out/ | ||
8 | patchShebangs $out | ||
9 | wrapProgram $out/check_command --prefix PATH : ${config.security.wrapperDir} | ||
10 | wrapProgram $out/send_nrdp.sh --prefix PATH : ${lib.makeBinPath [ | ||
11 | pkgs.curl pkgs.which pkgs.coreutils | ||
12 | ]} | ||
13 | wrapProgram $out/check_mem.sh --prefix PATH : ${lib.makeBinPath [ | ||
14 | pkgs.gnugrep pkgs.gawk pkgs.procps-ng | ||
15 | ]} | ||
16 | ''; | ||
17 | in | ||
18 | { | ||
19 | options = { | ||
20 | myServices.monitoring.enable = lib.mkOption { | ||
21 | type = lib.types.bool; | ||
22 | default = false; | ||
23 | description = '' | ||
24 | Whether to enable monitoring. | ||
25 | ''; | ||
26 | }; | ||
27 | }; | ||
28 | |||
29 | config = lib.mkIf config.myServices.monitoring.enable { | ||
30 | security.sudo.extraRules = [ | ||
31 | { | ||
32 | commands = [ | ||
33 | { command = "${pkgs.mdadm}/bin/mdadm --monitor --scan -1"; options = [ "NOPASSWD" ]; } | ||
34 | { command = "${pkgs.postfix}/bin/mailq"; options = [ "NOPASSWD" ]; } | ||
35 | ]; | ||
36 | users = [ "naemon" ]; | ||
37 | runAs = "root"; | ||
38 | } | ||
39 | ]; | ||
40 | environment.etc."mdadm.conf" = { | ||
41 | enable = true; | ||
42 | mode = "0644"; | ||
43 | user = "root"; | ||
44 | text = "MAILADDR naemon@immae.eu"; | ||
45 | }; | ||
46 | |||
47 | # needed since extraResource is not in the closure | ||
48 | systemd.services.naemon.path = [ myplugins ]; | ||
49 | services.naemon = { | ||
50 | enable = true; | ||
51 | extraConfig = '' | ||
52 | broker_module=${pkgs.naemon-livestatus}/lib/naemon-livestatus/livestatus.so ${config.services.naemon.runDir}/live | ||
53 | use_syslog=1 | ||
54 | log_initial_states=1 | ||
55 | date_format=iso8601 | ||
56 | admin_email=naemon@immae.eu | ||
57 | |||
58 | obsess_over_services=1 | ||
59 | ocsp_command=notify-master | ||
60 | ''; | ||
61 | extraResource = '' | ||
62 | $USER2$=${myplugins} | ||
63 | $USER200$=${myconfig.env.monitoring.status_url} | ||
64 | $USER201$=${myconfig.env.monitoring.status_token} | ||
65 | ''; | ||
66 | objectDefs = builtins.readFile ./conf/local_services.cfg | ||
67 | + builtins.readFile ./conf/timeperiods.cfg | ||
68 | + builtins.readFile ./conf/services.cfg | ||
69 | + builtins.readFile ./conf/contacts.cfg | ||
70 | + builtins.readFile ./conf/hosts.cfg | ||
71 | + '' | ||
72 | define command { | ||
73 | command_line ${myplugins}/send_nrdp.sh -u "$USER200$" -t "$USER201$" -H "$HOSTADDRESS$" -s "$SERVICEDESC$" -S "$SERVICESTATEID$" -o "$SERVICEOUTPUT$" | ||
74 | command_name notify-master | ||
75 | } | ||
76 | define service { | ||
77 | service_description No mdadm array is degraded | ||
78 | use local-service | ||
79 | check_command check_command_output!${pkgs.mdadm}/bin/mdadm --monitor --scan -1!^$!-s 0 -r root | ||
80 | } | ||
81 | |||
82 | define service { | ||
83 | service_description mailq is empty | ||
84 | use local-service | ||
85 | check_command check_mailq | ||
86 | } | ||
87 | |||
88 | define command { | ||
89 | command_name check_mailq | ||
90 | command_line $USER1$/check_mailq -s -w 1 -c 2 | ||
91 | } | ||
92 | |||
93 | define service { | ||
94 | name local-service | ||
95 | use generic-service | ||
96 | host_name eldiron.immae.eu | ||
97 | check_interval 5 | ||
98 | max_check_attempts 4 | ||
99 | register 0 | ||
100 | retry_interval 1 | ||
101 | } | ||
102 | define host { | ||
103 | host_name eldiron.immae.eu | ||
104 | alias eldiron.immae.eu | ||
105 | address eldiron.immae.eu | ||
106 | use linux-server | ||
107 | } | ||
108 | ''; | ||
109 | }; | ||
110 | }; | ||
111 | } | ||
diff --git a/modules/private/monitoring/plugins/check_command b/modules/private/monitoring/plugins/check_command new file mode 100755 index 0000000..55779fd --- /dev/null +++ b/modules/private/monitoring/plugins/check_command | |||
@@ -0,0 +1,113 @@ | |||
1 | #!/usr/bin/env perl | ||
2 | |||
3 | use strict; | ||
4 | use Getopt::Std; | ||
5 | $| = 1; | ||
6 | |||
7 | my %opts; | ||
8 | getopts('hr:C:c:s:o:', \%opts); | ||
9 | |||
10 | my $STATE_OK = 0; | ||
11 | my $STATE_WARNING = 1; | ||
12 | my $STATE_CRITICAL = 2; | ||
13 | my $STATE_UNKNOWN = 3; | ||
14 | |||
15 | if ($opts{'h'} || scalar(%opts) == 0) { | ||
16 | &print_help(); | ||
17 | exit($STATE_OK); | ||
18 | } | ||
19 | |||
20 | my $command = $opts{'c'}; | ||
21 | if ($command eq '') { | ||
22 | print "You must provide a command to check.\n"; | ||
23 | exit($STATE_UNKNOWN); | ||
24 | } | ||
25 | |||
26 | my $expected_output = $opts{'o'}; | ||
27 | my $expected_status = $opts{'s'}; | ||
28 | my $other_command = $opts{'C'}; | ||
29 | |||
30 | if ($other_command eq '' and $expected_status eq '' and $expected_output eq '') { | ||
31 | $expected_status = 0; | ||
32 | } | ||
33 | |||
34 | my $cmd = $command . ' 2>&1'; | ||
35 | my $other_cmd; | ||
36 | if ($other_command ne '') { | ||
37 | $other_cmd = $other_command . ' 2>&1'; | ||
38 | } | ||
39 | |||
40 | my $run_as; | ||
41 | if ($opts{'r'}) { | ||
42 | $run_as = $opts{'r'}; | ||
43 | $cmd = "sudo -u $run_as -n $cmd"; | ||
44 | |||
45 | if ($other_command ne '') { | ||
46 | $other_cmd = "sudo -u $run_as -n $other_cmd"; | ||
47 | } | ||
48 | |||
49 | } | ||
50 | |||
51 | my $cmd_result = `$cmd`; | ||
52 | my $other_cmd_result; | ||
53 | if ($other_command ne '') { | ||
54 | $other_cmd_result = `$other_cmd`; | ||
55 | chomp($other_cmd_result); | ||
56 | } | ||
57 | |||
58 | chomp($cmd_result); | ||
59 | if ($cmd_result =~ /sudo/i) { | ||
60 | print "$command CRITICAL - No sudo right to run the command\n"; | ||
61 | exit($STATE_UNKNOWN); | ||
62 | } elsif ($expected_status ne '') { | ||
63 | if ($? != $expected_status) { | ||
64 | print "$command CRITICAL - Response status $?\n"; | ||
65 | exit($STATE_CRITICAL); | ||
66 | } else { | ||
67 | print "$command OK - Response status $?\n"; | ||
68 | exit($STATE_OK); | ||
69 | } | ||
70 | } elsif ($other_command ne '') { | ||
71 | if ($cmd_result ne $other_cmd_result) { | ||
72 | print "$command CRITICAL - Expected output not matching other command output\n"; | ||
73 | exit($STATE_CRITICAL); | ||
74 | } else { | ||
75 | print "$command OK - Expected output matching other command output\n"; | ||
76 | exit($STATE_OK); | ||
77 | } | ||
78 | } else { | ||
79 | if ($cmd_result !~ /$expected_output/) { | ||
80 | print "$command CRITICAL - Expected output not matching\n"; | ||
81 | exit($STATE_CRITICAL); | ||
82 | } else { | ||
83 | print "$command OK - Expected output matching\n"; | ||
84 | exit($STATE_OK); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | sub print_help() { | ||
89 | print << "EOF"; | ||
90 | Check whether the given command responds as expected. One of -o -C or -s must be selected. | ||
91 | |||
92 | Options: | ||
93 | -h | ||
94 | Print detailed help screen | ||
95 | |||
96 | -c | ||
97 | command to run (required) | ||
98 | |||
99 | -C | ||
100 | other command to compare output | ||
101 | |||
102 | -r user | ||
103 | Run as user via sudo. | ||
104 | |||
105 | -s | ||
106 | status code to check | ||
107 | |||
108 | -o | ||
109 | output to check | ||
110 | |||
111 | EOF | ||
112 | } | ||
113 | |||
diff --git a/modules/private/monitoring/plugins/check_mem.sh b/modules/private/monitoring/plugins/check_mem.sh new file mode 100755 index 0000000..cc97ae2 --- /dev/null +++ b/modules/private/monitoring/plugins/check_mem.sh | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ]; then | ||
4 | FreeM=`free -m` | ||
5 | memTotal_m=`echo "$FreeM" |grep Mem |awk '{print $2}'` | ||
6 | memUsed_m=`echo "$FreeM" |grep Mem |awk '{print $3}'` | ||
7 | memFree_m=`echo "$FreeM" |grep Mem |awk '{print $4}'` | ||
8 | memBuffer_m=`echo "$FreeM" |grep Mem |awk '{print $6}'` | ||
9 | memCache_m=`echo "$FreeM" |grep Mem |awk '{print $7}'` | ||
10 | memUsedPrc=`echo $((($memUsed_m*100)/$memTotal_m))||cut -d. -f1` | ||
11 | if [ "$memUsedPrc" -ge "$4" ]; then | ||
12 | echo "Memory: CRITICAL Total: $memTotal_m MB - Used: $memUsed_m MB - $memUsedPrc% used!|TOTAL=$memTotal_m;;;; USED=$memUsed_m;;;; CACHE=$memCache_m;;;; BUFFER=$memBuffer_m;;;;" | ||
13 | exit 2 | ||
14 | elif [ "$memUsedPrc" -ge "$2" ]; then | ||
15 | echo "Memory: WARNING Total: $memTotal_m MB - Used: $memUsed_m MB - $memUsedPrc% used!|TOTAL=$memTotal_m;;;; USED=$memUsed_m;;;; CACHE=$memCache_m;;;; BUFFER=$memBuffer_m;;;;" | ||
16 | exit 1 | ||
17 | else | ||
18 | echo "Memory: OK Total: $memTotal_m MB - Used: $memUsed_m MB - $memUsedPrc% used|TOTAL=$memTotal_m;;;; USED=$memUsed_m;;;; CACHE=$memCache_m;;;; BUFFER=$memBuffer_m;;;;" | ||
19 | exit 0 | ||
20 | fi | ||
21 | else # If inputs are not as expected, print help. | ||
22 | sName="`echo $0|awk -F '/' '{print $NF}'`" | ||
23 | echo -e "\n\n\t\t### $sName Version 2.0###\n" | ||
24 | echo -e "# Usage:\t$sName -w <warnlevel> -c <critlevel>" | ||
25 | echo -e "\t\t= warnlevel and critlevel is percentage value without %\n" | ||
26 | echo "# EXAMPLE:\t/usr/lib64/nagios/plugins/$sName -w 80 -c 90" | ||
27 | echo -e "\nCopyright (C) 2012 Lukasz Gogolin (lukasz.gogolin@gmail.com), improved by Nestor 2015\n\n" | ||
28 | exit | ||
29 | fi | ||
diff --git a/modules/private/monitoring/plugins/notify_by_email b/modules/private/monitoring/plugins/notify_by_email new file mode 100755 index 0000000..ad0dcc7 --- /dev/null +++ b/modules/private/monitoring/plugins/notify_by_email | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # $1 = service/host | ||
4 | |||
5 | # $2 = type (PROBLEM RECOVERY ACKNOWLEDGEMENT FLAPPINGSTART FLAPPINGSTOP FLAPPINGDISABLED DOWNTIMESTART DOWNTIMESTOP DOWNTIMECANCELLED) | ||
6 | # http://www.naemon.org/documentation/usersguide/macrolist.html#notificationtype | ||
7 | |||
8 | # $3 = host alias | ||
9 | |||
10 | # $4 = date (YYYY-MM-DDTHH:MM:SS) | ||
11 | |||
12 | # $5 = E-mail | ||
13 | |||
14 | NOTIFICATION_TYPE="$2" | ||
15 | HOST_ALIAS="$3" | ||
16 | DATE="$4" | ||
17 | CONTACT="$5" | ||
18 | |||
19 | message="" | ||
20 | |||
21 | if [ "$1" = "host" ]; then | ||
22 | message=$(printf "%b" "***** Naemon *****\n\nNotification Type: $NOTIFICATION_TYPE\n\nHost: $HOST_ALIAS\nState: $HOSTSTATE\nInfo: $HOSTOUTPUT\n\nDate/Time: $DATE\n") | ||
23 | subject="** $NOTIFICATION_TYPE Host Alert: $HOST_ALIAS is $HOSTSTATE **" | ||
24 | else | ||
25 | message=$(printf "%b" "***** Naemon *****\n\nNotification Type: $NOTIFICATION_TYPE\n\nService: $SERVICEDESC\nHost: $HOST_ALIAS\nState: $SERVICESTATE\n\nDate/Time: $DATE\n\nAdditional Info:\n\n$SERVICEOUTPUT\n") | ||
26 | subject="** $NOTIFICATION_TYPE Service Alert: $HOST_ALIAS/$SERVICEDESC is $SERVICESTATE **" | ||
27 | fi | ||
28 | |||
29 | # sendwait waits for sendmail to finish its job, otherwise it continues in the | ||
30 | # background and gets killed too early | ||
31 | echo "$message" | MAILRC=/dev/null mail -r "naemon@immae.eu" -n -Ssendwait -s "$subject" "$CONTACT" | ||
diff --git a/modules/private/monitoring/plugins/send_nrdp.sh b/modules/private/monitoring/plugins/send_nrdp.sh new file mode 100755 index 0000000..27e47b4 --- /dev/null +++ b/modules/private/monitoring/plugins/send_nrdp.sh | |||
@@ -0,0 +1,267 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # check_nrdp.sh | ||
4 | # | ||
5 | # Copyright (c) 2010-2017 - Nagios Enterprises, LLC. | ||
6 | # Written by: Scott Wilkerson (nagios@nagios.org) | ||
7 | # | ||
8 | # 2017-09-25 Troy Lea aka BOX293 | ||
9 | # - Fixed script not working with arguments when run as a cron job | ||
10 | # or if being used as a nagios command like obsessive compulsive. | ||
11 | # ... "if [ ! -t 0 ]" was the reason why. | ||
12 | # 2017-12-08 Jørgen van der Meulen (Conclusion Xforce) | ||
13 | # - Fixed typo in NRDP abbreviation | ||
14 | |||
15 | |||
16 | PROGNAME=$(basename $0) | ||
17 | RELEASE="Revision 0.6.1" | ||
18 | |||
19 | print_release() { | ||
20 | echo "$RELEASE" | ||
21 | } | ||
22 | |||
23 | print_usage() { | ||
24 | echo "" | ||
25 | echo "$PROGNAME $RELEASE - Send NRDP script for Nagios" | ||
26 | echo "" | ||
27 | echo "Usage: send_nrdp.sh -u URL -t token [options]" | ||
28 | echo "" | ||
29 | echo "Usage: $PROGNAME -h display help" | ||
30 | echo "" | ||
31 | } | ||
32 | |||
33 | print_help() { | ||
34 | print_usage | ||
35 | echo "" | ||
36 | echo "This script is used to send NRDP data to a Nagios server" | ||
37 | echo "" | ||
38 | echo "Required:" | ||
39 | echo " -u"," URL of NRDP server. Usually http://<IP_ADDRESS>/nrdp/" | ||
40 | echo " -t"," Shared token. Must be the same token set in NRDP Server" | ||
41 | echo "" | ||
42 | echo "Options:" | ||
43 | echo " Single Check:" | ||
44 | echo " -H host name" | ||
45 | echo " -s service name" | ||
46 | echo " -S State" | ||
47 | echo " -o output" | ||
48 | echo "" | ||
49 | echo " STDIN:" | ||
50 | echo " [-d delimiter] (default -d \"\\t\")" | ||
51 | echo " With only the required parameters $PROGNAME is capable of" | ||
52 | echo " processing data piped to it either from a file or other" | ||
53 | echo " process. By default, we use \t as the delimiter however this" | ||
54 | echo " may be specified with the -d option data should be in the" | ||
55 | echo " following formats one entry per line." | ||
56 | echo " For Host checks:" | ||
57 | echo " hostname State output" | ||
58 | echo " For Service checks" | ||
59 | echo " hostname servicename State output" | ||
60 | echo "" | ||
61 | echo " File:" | ||
62 | echo " -f /full/path/to/file" | ||
63 | echo " This file will be sent to the NRDP server specified in -u" | ||
64 | echo " The file should be an XML file in the following format" | ||
65 | echo " ##################################################" | ||
66 | echo "" | ||
67 | echo " <?xml version='1.0'?>" | ||
68 | echo " <checkresults>" | ||
69 | echo " <checkresult type=\"host\" checktype=\"1\">" | ||
70 | echo " <hostname>YOUR_HOSTNAME</hostname>" | ||
71 | echo " <state>0</state>" | ||
72 | echo " <output>OK|perfdata=1.00;5;10;0</output>" | ||
73 | echo " </checkresult>" | ||
74 | echo " <checkresult type=\"service\" checktype=\"1\">" | ||
75 | echo " <hostname>YOUR_HOSTNAME</hostname>" | ||
76 | echo " <servicename>YOUR_SERVICENAME</servicename>" | ||
77 | echo " <state>0</state>" | ||
78 | echo " <output>OK|perfdata=1.00;5;10;0</output>" | ||
79 | echo " </checkresult>" | ||
80 | echo " </checkresults>" | ||
81 | echo " ##################################################" | ||
82 | echo "" | ||
83 | echo " Directory:" | ||
84 | echo " -D /path/to/temp/dir" | ||
85 | echo " This is a directory that contains XML files in the format" | ||
86 | echo " above. Additionally, if the -d flag is specified, $PROGNAME" | ||
87 | echo " will create temp files here if the server could not be reached." | ||
88 | echo " On additional calls with the same -D path, if a connection to" | ||
89 | echo " the server is successful, all temp files will be sent." | ||
90 | exit 0 | ||
91 | } | ||
92 | |||
93 | send_data() { | ||
94 | pdata="token=$token&cmd=submitcheck" | ||
95 | if [ $file ]; then | ||
96 | fdata="--data-urlencode XMLDATA@$file" | ||
97 | rslt=`curl -f --silent --insecure -d "$pdata" $fdata "$url/"` | ||
98 | else | ||
99 | pdata="$pdata&XMLDATA=$1" | ||
100 | rslt=`curl -f --silent --insecure -d "$pdata" "$url/"` | ||
101 | fi | ||
102 | |||
103 | ret=$? | ||
104 | |||
105 | status=`echo $rslt | sed -n 's|.*<status>\(.*\)</status>.*|\1|p'` | ||
106 | message=`echo $rslt | sed -n 's|.*<message>\(.*\)</message>.*|\1|p'` | ||
107 | if [ $ret != 0 ];then | ||
108 | echo "ERROR: could not connect to NRDP server at $url" | ||
109 | # verify we are not processing the directory already and then write to the directory | ||
110 | if [ ! "$2" ] && [ $directory ];then | ||
111 | if [ ! -d "$directory" ];then | ||
112 | mkdir -p "$directory" | ||
113 | fi | ||
114 | # This is where we write to the tmp directory | ||
115 | echo $xml > `mktemp $directory/nrdp.XXXXXX` | ||
116 | fi | ||
117 | exit 1 | ||
118 | fi | ||
119 | |||
120 | if [ "$status" != "0" ];then | ||
121 | # This means we couldn't connect to NRPD server | ||
122 | echo "ERROR: The NRDP Server said $message" | ||
123 | # verify we are not processing the directory already and then write to the directory | ||
124 | if [ ! "$2" ] && [ $directory ];then | ||
125 | if [ ! -d "$directory" ];then | ||
126 | mkdir -p "$directory" | ||
127 | fi | ||
128 | # This is where we write to the tmp directory | ||
129 | echo $xml > `mktemp $directory/nrdp.XXXXXX` | ||
130 | fi | ||
131 | |||
132 | exit 2 | ||
133 | fi | ||
134 | |||
135 | # If this was a directory call and was successful, remove the file | ||
136 | if [ $2 ] && [ "$status" == "0" ];then | ||
137 | rm -f "$2" | ||
138 | fi | ||
139 | |||
140 | # If we weren't successful error | ||
141 | if [ $ret != 0 ];then | ||
142 | echo "exited with error "$ret | ||
143 | exit $ret | ||
144 | fi | ||
145 | } | ||
146 | |||
147 | while getopts "u:t:H:s:S:o:f:d:c:D:hv" option | ||
148 | do | ||
149 | case $option in | ||
150 | u) url=$OPTARG ;; | ||
151 | t) token=$OPTARG ;; | ||
152 | H) host=$OPTARG ;; | ||
153 | s) service=$OPTARG ;; | ||
154 | S) State=$OPTARG ;; | ||
155 | o) output=$OPTARG ;; | ||
156 | f) file=$OPTARG ;; | ||
157 | d) delim=$OPTARG ;; | ||
158 | c) checktype=$OPTARG ;; | ||
159 | D) directory=$OPTARG ;; | ||
160 | h) print_help 0;; | ||
161 | v) print_release | ||
162 | exit 0 ;; | ||
163 | esac | ||
164 | done | ||
165 | |||
166 | if [ ! $checktype ]; then | ||
167 | checktype=1 | ||
168 | fi | ||
169 | if [ ! $delim ]; then | ||
170 | delim=`echo -e "\t"` | ||
171 | fi | ||
172 | |||
173 | if [ "x$url" == "x" -o "x$token" == "x" ] | ||
174 | then | ||
175 | echo "Usage: send_nrdp -u url -t token" | ||
176 | exit 1 | ||
177 | fi | ||
178 | # detecting curl | ||
179 | if [[ `which curl` =~ "/curl" ]] | ||
180 | then curl=1; | ||
181 | fi | ||
182 | |||
183 | if [[ ! $curl ]]; | ||
184 | then | ||
185 | echo "Either curl or wget are required to run $PROGNAME" | ||
186 | exit 1 | ||
187 | fi | ||
188 | |||
189 | checkcount=0 | ||
190 | |||
191 | if [ $host ]; then | ||
192 | xml="" | ||
193 | # we are not getting piped results | ||
194 | if [ "$host" == "" ] || [ "$State" == "" ]; then | ||
195 | echo "You must provide a host -H and State -S" | ||
196 | exit 2 | ||
197 | fi | ||
198 | if [ "$service" != "" ]; then | ||
199 | xml="$xml<checkresult type='service' checktype='$checktype'><servicename>$service</servicename>" | ||
200 | else | ||
201 | xml="$xml<checkresult type='host' checktype='$checktype'>" | ||
202 | fi | ||
203 | |||
204 | # urlencode XML special chars | ||
205 | output=${output//&/%26} | ||
206 | output=${output//</%3C} | ||
207 | output=${output//>/%3E} | ||
208 | |||
209 | xml="$xml<hostname>$host</hostname><state>$State</state><output><![CDATA["$output"]]></output></checkresult>" | ||
210 | checkcount=1 | ||
211 | fi | ||
212 | |||
213 | # If only url and token have been provided then it is assumed that data is being piped | ||
214 | ######################## | ||
215 | if [[ ! $host && ! $State && ! $file && ! $directory ]]; then | ||
216 | xml="" | ||
217 | # we know we are being piped results | ||
218 | IFS=$delim | ||
219 | |||
220 | while read -r line ; do | ||
221 | arr=($line) | ||
222 | if [ ${#arr[@]} != 0 ];then | ||
223 | if [[ ${#arr[@]} < 3 ]] || [[ ${#arr[@]} > 4 ]];then | ||
224 | echo "ERROR: STDIN must be either 3 or 4 fields long, I found "${#arr[@]} | ||
225 | else | ||
226 | if [ ${#arr[@]} == 4 ]; then | ||
227 | xml="$xml<checkresult type='service' checktype='$checktype'> | ||
228 | <servicename>${arr[1]}</servicename> | ||
229 | <hostname>${arr[0]}</hostname> | ||
230 | <state>${arr[2]}</state> | ||
231 | <output>${arr[3]}</output>" | ||
232 | else | ||
233 | xml="$xml<checkresult type='host' checktype='$checktype'> | ||
234 | <hostname>${arr[0]}</hostname> | ||
235 | <state>${arr[1]}</state> | ||
236 | <output>${arr[2]}</output>" | ||
237 | fi | ||
238 | |||
239 | xml="$xml</checkresult>" | ||
240 | checkcount=$[checkcount+1] | ||
241 | fi | ||
242 | fi | ||
243 | done | ||
244 | IFS=" " | ||
245 | fi | ||
246 | |||
247 | if [ $file ]; then | ||
248 | xml=`cat $file` | ||
249 | send_data "$xml" | ||
250 | fi | ||
251 | |||
252 | if [ $directory ]; then | ||
253 | #echo "Processing directory..." | ||
254 | for f in `ls $directory` | ||
255 | do | ||
256 | #echo "Processing $f file..." | ||
257 | # take action on each file. $f store current file name | ||
258 | xml=`cat $directory/$f` | ||
259 | send_data "$xml" "$directory/$f" | ||
260 | done | ||
261 | fi | ||
262 | |||
263 | if [ "x$file" == "x" ] && [ "x$directory" == "x" ]; then | ||
264 | xml="<?xml version='1.0'?><checkresults>$xml</checkresults>" | ||
265 | send_data "$xml" | ||
266 | echo "Sent $checkcount checks to $url" | ||
267 | fi | ||
diff --git a/modules/private/system/eldiron.nix b/modules/private/system/eldiron.nix index df40187..22de37e 100644 --- a/modules/private/system/eldiron.nix +++ b/modules/private/system/eldiron.nix | |||
@@ -24,6 +24,7 @@ | |||
24 | myServices.buildbot.enable = true; | 24 | myServices.buildbot.enable = true; |
25 | myServices.databases.enable = true; | 25 | myServices.databases.enable = true; |
26 | myServices.gitolite.enable = true; | 26 | myServices.gitolite.enable = true; |
27 | myServices.monitoring.enable = true; | ||
27 | myServices.irc.enable = true; | 28 | myServices.irc.enable = true; |
28 | myServices.pub.enable = true; | 29 | myServices.pub.enable = true; |
29 | myServices.tasks.enable = true; | 30 | myServices.tasks.enable = true; |
diff --git a/pkgs/default.nix b/pkgs/default.nix index ff9d477..4949573 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix | |||
@@ -42,6 +42,10 @@ rec { | |||
42 | composerEnv = callPackage ./composer-env {}; | 42 | composerEnv = callPackage ./composer-env {}; |
43 | webapps = callPackage ./webapps { inherit mylibs composerEnv private; }; | 43 | webapps = callPackage ./webapps { inherit mylibs composerEnv private; }; |
44 | 44 | ||
45 | monitoring-plugins = callPackage ./monitoring-plugins {}; | ||
46 | naemon = callPackage ./naemon { inherit mylibs monitoring-plugins; }; | ||
47 | naemon-livestatus = callPackage ./naemon-livestatus { inherit mylibs naemon; }; | ||
48 | |||
45 | private = if builtins.pathExists (./. + "/private") | 49 | private = if builtins.pathExists (./. + "/private") |
46 | then import ./private { inherit pkgs; } | 50 | then import ./private { inherit pkgs; } |
47 | else { webapps = {}; }; | 51 | else { webapps = {}; }; |
diff --git a/pkgs/monitoring-plugins/default.nix b/pkgs/monitoring-plugins/default.nix new file mode 100644 index 0000000..852d29b --- /dev/null +++ b/pkgs/monitoring-plugins/default.nix | |||
@@ -0,0 +1,33 @@ | |||
1 | { stdenv, iputils, fetchpatch, fetchurl, file, hostname, perl, openssl, | ||
2 | bind, openldap, procps-ng, postfix, | ||
3 | wrapperDir ? "/run/wrappers/bin" | ||
4 | }: | ||
5 | stdenv.mkDerivation rec { | ||
6 | pname = "monitoring-plugins"; | ||
7 | version = "2.2"; | ||
8 | name = "${pname}-${version}"; | ||
9 | |||
10 | src = fetchurl { | ||
11 | url = "https://www.monitoring-plugins.org/download/${name}.tar.gz"; | ||
12 | sha256 = "0r9nvnk64nv7k8w352n99lw4p92pycxd9wlga9zyzjx9027m6si9"; | ||
13 | }; | ||
14 | |||
15 | patches = [ | ||
16 | (fetchpatch { | ||
17 | name = "mariadb.patch"; | ||
18 | url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/0001-mariadb.patch?h=packages/monitoring-plugins"; | ||
19 | sha256 = "0jf6fqkyzag66rid92m7asnr2dp8rr8kn4zjvhqg0mqvf8imppky"; | ||
20 | }) | ||
21 | ]; | ||
22 | |||
23 | # ping needs CAP_NET_RAW capability which is set only in the wrappers namespace | ||
24 | configurePhase = '' | ||
25 | ./configure --disable-static --disable-dependency-tracking \ | ||
26 | --prefix=$out \ | ||
27 | --with-ping-command="${wrapperDir}/ping -4 -n -U -w %d -c %d %s" \ | ||
28 | --with-ping6-command="${wrapperDir}/ping -6 -n -U -w %d -c %d %s" \ | ||
29 | --with-sudo-command="${wrapperDir}/sudo" | ||
30 | ''; | ||
31 | |||
32 | buildInputs = [ perl file hostname iputils openssl openldap procps-ng bind.dnsutils postfix ]; | ||
33 | } | ||
diff --git a/pkgs/naemon-livestatus/default.nix b/pkgs/naemon-livestatus/default.nix new file mode 100644 index 0000000..46ef51a --- /dev/null +++ b/pkgs/naemon-livestatus/default.nix | |||
@@ -0,0 +1,23 @@ | |||
1 | { stdenv, mylibs, autoconf, automake, | ||
2 | libtool, pkg-config, naemon, | ||
3 | varDir ? "/var/lib/naemon", | ||
4 | etcDir ? "/etc/naemon" | ||
5 | }: | ||
6 | stdenv.mkDerivation (mylibs.fetchedGithub ./naemon-livestatus.json // { | ||
7 | preConfigure = '' | ||
8 | ./autogen.sh || true | ||
9 | ''; | ||
10 | |||
11 | configureFlags = [ | ||
12 | "--localstatedir=${varDir}" | ||
13 | "--sysconfdir=${etcDir}" | ||
14 | ]; | ||
15 | |||
16 | preInstall = '' | ||
17 | substituteInPlace Makefile --replace \ | ||
18 | '@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am' \ | ||
19 | '@$(MAKE) $(AM_MAKEFLAGS) install-exec-am' | ||
20 | ''; | ||
21 | |||
22 | buildInputs = [ autoconf automake libtool pkg-config naemon ]; | ||
23 | }) | ||
diff --git a/pkgs/naemon-livestatus/naemon-livestatus.json b/pkgs/naemon-livestatus/naemon-livestatus.json new file mode 100644 index 0000000..c648d2b --- /dev/null +++ b/pkgs/naemon-livestatus/naemon-livestatus.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "tag": "33dbcfe-master", | ||
3 | "meta": { | ||
4 | "name": "naemon-livestatus", | ||
5 | "url": "https://github.com/naemon/naemon-livestatus", | ||
6 | "branch": "master" | ||
7 | }, | ||
8 | "github": { | ||
9 | "owner": "naemon", | ||
10 | "repo": "naemon-livestatus", | ||
11 | "rev": "33dbcfe18e42158f25c27cff95a1e07b73be53b0", | ||
12 | "sha256": "16jk0c6pwr7ck0g6s12hj6czbhgdr7c7f74zzsp5279af86y8fd6", | ||
13 | "fetchSubmodules": true | ||
14 | } | ||
15 | } | ||
diff --git a/pkgs/naemon/default.nix b/pkgs/naemon/default.nix new file mode 100644 index 0000000..080a226 --- /dev/null +++ b/pkgs/naemon/default.nix | |||
@@ -0,0 +1,34 @@ | |||
1 | { stdenv, mylibs, help2man, monitoring-plugins, autoconf, automake, | ||
2 | libtool, glib, pkg-config, gperf, | ||
3 | varDir ? "/var/lib/naemon", | ||
4 | etcDir ? "/etc/naemon", | ||
5 | cacheDir ? "/var/cache/naemon", | ||
6 | logDir ? "/var/log/naemon", | ||
7 | runDir ? "/run/naemon", | ||
8 | user ? "naemon", | ||
9 | group ? "naemon" | ||
10 | }: | ||
11 | stdenv.mkDerivation (mylibs.fetchedGithub ./naemon.json // { | ||
12 | preConfigure = '' | ||
13 | ./autogen.sh || true | ||
14 | ''; | ||
15 | |||
16 | configureFlags = [ | ||
17 | "--localstatedir=${varDir}" | ||
18 | "--sysconfdir=${etcDir}" | ||
19 | "--with-pkgconfdir=${etcDir}" | ||
20 | "--with-pluginsdir=${monitoring-plugins}/libexec" | ||
21 | "--with-tempdir=${cacheDir}" | ||
22 | "--with-checkresultdir=${cacheDir}/checkresults" | ||
23 | "--with-logdir=${logDir}" | ||
24 | "--with-naemon-user=${user}" | ||
25 | "--with-naemon-group=${group}" | ||
26 | "--with-lockfile=${runDir}/naemon.pid" | ||
27 | ]; | ||
28 | |||
29 | preInstall = '' | ||
30 | substituteInPlace Makefile --replace '$(MAKE) $(AM_MAKEFLAGS) install-exec-hook' "" | ||
31 | ''; | ||
32 | |||
33 | buildInputs = [ autoconf automake help2man libtool glib pkg-config gperf ]; | ||
34 | }) | ||
diff --git a/pkgs/naemon/naemon.json b/pkgs/naemon/naemon.json new file mode 100644 index 0000000..c68647f --- /dev/null +++ b/pkgs/naemon/naemon.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "tag": "ba6fd20-master", | ||
3 | "meta": { | ||
4 | "name": "naemon", | ||
5 | "url": "https://github.com/naemon/naemon-core", | ||
6 | "branch": "master" | ||
7 | }, | ||
8 | "github": { | ||
9 | "owner": "naemon", | ||
10 | "repo": "naemon-core", | ||
11 | "rev": "ba6fd20221fbdd5c99b4eb5dcf4ee5681c5a9495", | ||
12 | "sha256": "15rvqg985nn05rsgkch4ix8y2wg7a6pb70d63ckzy1inwqjp8z46", | ||
13 | "fetchSubmodules": true | ||
14 | } | ||
15 | } | ||