-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathindex.html
431 lines (356 loc) · 12.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: README
— Documentation by YARD 0.9.20
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
pathId = "";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="puppet_class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> »
<span class="title">File: README</span>
</div>
<div id="search">
<a class="full_list_link" id="puppet_class_list_link"
href="puppet_class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'>
<h1 id="label-monit">monit</h1>
<h4 id="label-Table+of+Contents">Table of Contents</h4>
<ol><li>
<p><a href="#label-Description">Description</a></p>
</li><li>
<p><a href="#label-Setup">Setup - The basics of getting started with monit</a></p>
<ul><li>
<p><a href="#label-What+monit+affects">What monit affects</a></p>
</li><li>
<p><a href="#label-Setup+requirements">Setup requirements</a></p>
</li><li>
<p><a href="#label-Beginning+with+monit">Beginning with monit</a></p>
</li></ul>
</li><li>
<p><a href="#label-Usage">Usage - Configuration options and additional
functionality</a></p>
</li><li>
<p><a href="#label-Reference">Reference - An under-the-hood peek at what the module
is doing and how</a></p>
</li><li>
<p><a href="#label-Limitations">Limitations - OS compatibility, etc.</a></p>
</li><li>
<p><a href="#label-Development">Development - Guide for contributing to the
module</a></p>
</li></ol>
<h2 id="label-Description">Description</h2>
<p>Performs installation and configuration of Monit service, along with fine
grained definition of checks.</p>
<p>All check types provided by Monit are supported. Namely:
<code>directory</code>, <code>fifo</code>, <code>file</code>,
<code>filesystem</code>, <code>host</code>, <code>process</code>,
<code>program</code>, and <code>system</code>.</p>
<p>In adition to primitive types, a compound check type is provided:
<code>service</code>. It is a set of primitives to check a service's
init script, binary and process.</p>
<h2 id="label-Setup">Setup</h2>
<h3 id="label-Beginning+with+monit">Beginning with monit</h3>
<p><code>include '::monit'</code> is enough to get you up and running.
It will configure the basis of monit, with HTTP server listening at
<code>localhost:2812</code> and a system check for <code>LOADAVG</code>,
<code>CPU</code>, <code>MEMORY</code> and <code>FILESYSTEM</code> at
<code>/</code>.</p>
<p>To pass in parameters and override default configuration:</p>
<pre class="code ruby"><code class="ruby">class { '::monit':
check_interval => 60,
check_start_delay => 120,
mailserver => 'localhost',
eventqueue => true,
alerts => ['root@localhost', 'sla1@example.com only on { timeout, nonexist }'],
httpserver => true,
httpserver_allow => ['admin:secret'],
}</code></pre>
<h2 id="label-Usage">Usage</h2>
<p>All parameters for the monit module are contained within the main
<code>::monit</code> class, so for any function of the module, set the
options you want. See the common usages below for examples.</p>
<p>Check types are implemented by defined types, named after
<code>monit::check::TYPE</code>. All check types have several configuration
options in common (ex: group, priority, alerts, dependencies, etc.), along
with the check specific options.</p>
<p>On the other hand, <code>monit::check</code> defined type is a facade for
all check types. It works as a single entry point to declare any type of
check in the same way. Common configuration options are parameters of the
defined type, and check specific options are passed through a hash in the
<code>config</code> parameter.</p>
<p>So there're several entry points to declare your own checks:</p>
<ul><li>
<p>Create an instance of the specific defined type for the given check (ex:
<code>monit::check::TYPE</code>)</p>
</li><li>
<p>Create an instance of the generic <code>monit::check</code> defined type,
and pass in the details of the check</p>
</li><li>
<p>Pass in a hash of checks to <code>::monit</code> class. This enables
providing the checks from Hiera, with your preferred merge strategy</p>
</li></ul>
<h3 id="label-Install+and+enable+monit">Install and enable monit</h3>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_include'>include</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>::monit</span><span class='tstring_end'>'</span></span>
</code></pre>
<h3 id="label-Customize+the+system+check">Customize the system check</h3>
<pre class="code ruby"><code class="ruby">class { '::monit':
system_cpu_wait => '40%',
system_memory => '84%',
system_loadavg_1min => 14.0,
system_fs_space_usage => '88%',
system_fs => ['/', '/mnt/backups'],
}</code></pre>
<h3 id="label-Declare+a+check+by+instantiating+the+check-27s+defined+type">Declare a check by instantiating the check's defined type</h3>
<pre class="code ruby"><code class="ruby">include ::monit
monit::check::filesystem { 'somefs':
paths => ['/mount/somefs',],
tests => [
{'type' => 'fsflags'},
{'type' => 'permission', 'value' => '0755'},
{'type' => 'space', 'operator' => '>', 'value' => '80%'},
]
}</code></pre>
<h3 id="label-Declare+a+check+by+instantiating+the+generic+check+defined+type">Declare a check by instantiating the generic check defined type</h3>
<pre class="code ruby"><code class="ruby">include ::monit
# Add a check for ntp process.
monit::check { 'ntp':
type => 'process',
config => {
'pidfile' => '/var/run/ntpd.pid',
'program_start' => '/etc/init.d/ntp start',
'program_stop' => '/etc/init.d/ntp stop',
},
tests => [
{
'type' => 'connection',
'host' => '127.0.0.1',
'port' => '123',
'protocol' => 'ntp',
'action' => 'restart',
},
],
}</code></pre>
<h3 id="label-Provide+the+monit+class+with+a+check+for+ssh+service">Provide the monit class with a check for ssh service</h3>
<pre class="code ruby"><code class="ruby">include::monit
class { '::monit':
checks => {
'sshd' => {
'type' => 'service',
'config' => {
'pidfile' => '/var/run/sshd.pid',
},
'tests' => [
{
'type' => 'connection',
'host' => '127.0.0.1',
'port' => '22',
'protocol' => 'ssh',
'action' => 'restart',
},
],
},
}
}</code></pre>
<h3 id="label-Provide+full+module+config+and+checks+from+Hiera">Provide full module config and checks from Hiera</h3>
<pre class="code ruby"><code class="ruby"># Main monitrc configuration options.
monit::check_interval: '60'
monit::check_start_delay: '120'
monit::mailserver: 'localhost'
monit::eventqueue: true
monit::alerts:
- 'root@localhost'
- 'sla1@example.com only on { timeout, nonexist }'
monit::httpserver: true
monit::httpserver_allow:
- 'admin:secret'
# Tweak system check.
monit::system_fs: ['/', '/mnt/backups']
# Add some checks.
monit::checks:
somefs:
type: filesystem
config:
paths:
- /
- /mount/somefs
tests:
- type: fsflags
- type: permission
value: '0755'
- type: space
operator: '>'
value: 80%
sshd:
type: process
config:
pidfile: /var/run/sshd.pid
program_start: /etc/init.d/sshd start
program_stop: /etc/init.d/sshd stop
tests:
- type: connection
host: 127.0.0.1
port: 22
protocol: ssh
action: restart
php5-fpm:
type: process
config:
pidfile: /var/run/php5-fpm.pid
program_start: /etc/init.d/php5-fpm start
program_stop: /etc/init.d/php5-fpm stop
tests:
- type: connection
host: 127.0.0.1
port: 9000
socket_type: TCP
protocol: GENERIC
protocol_test:
- send: '"\0x01\0x09\0x00\0x00\0x00\0x00\0x08\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00"'
expect: '"\0x01\0x0A"'
action: restart
ntp:
type: process
config:
pidfile: /var/run/ntpd.pid
program_start: /etc/init.d/ntpd start
program_stop: /etc/init.d/ntpd stop
tests:
- type: connection
host: 127.0.0.1
socket_type: udp
port: 123
protocol: ntp
action: restart
varnish:
type: process
config:
pidfile: /var/run/varnish.pid
program_start: /etc/init.d/varnish start
program_stop: /etc/init.d/varnish stop
tests:
- type: connection
host: 127.0.0.1
port: 8080
protocol: http
protocol_test:
request: /health.varnish
- type: cpu(user)
operator: '>'
value: 60%
tolerance:
cycles: 2
- type: children
operator: '>'
value: 150
httpd:
type: service
config:
pidfile: /var/run/httpd/httpd.pid
binary: /usr/sbin/httpd
tests:
- type: connection
host: 127.0.0.1
port: 80
protocol: http
# Notice: Param 'HOSTHEADER' changed to 'HTTP HEADERS' in monit 5.9
# see https://mmonit.com/monit/changes/
http_headers:
type: host
config:
address: 127.0.0.1
tests:
- type: connection
host: 127.0.0.1
port: 80
protocol: http
protocol_test:
request: /
status: 200
http headers: '[host: www.example.com]'
custom-script:
type: program
config:
path: /path/to/custom/pingcheck.sh
tests:
- type: status
operator: '!='
value: 0
tolerance:
cycles: 2
action: exec
exec: sudo /sbin/reboot
# uid, git and repeat_every are optional.
uid: root
gid: root
repeat_every: 1
reboot:
type: system
tests:
- type: uptime
operator: '<'
value: '3 MINUTES'</code></pre>
<p>There's a bunch of examples for configuring real services across Debian
and RedHat families in <a
href="https://github.com/sbitio/puppet-ducktape">sbitio/ducktape</a>
module. Please refer to <a
href="https://github.com/sbitio/puppet-ducktape/tree/master/manifests">manifests/*/external/monit.pp</a>
files.</p>
<h2 id="label-Reference">Reference</h2>
<p>See Puppet Strings doc at <a
href="https://github.com/sbitio/puppet-monit/blob/master/doc/index.html">doc/index.html</a></p>
<h2 id="label-Limitations">Limitations</h2>
<p>This module requires Puppet 4.x or above, and is compatible with the
following OSes/versions:</p>
<ul><li>
<p>FreeBSD</p>
</li><li>
<p>Debian 7, 8, 9, 10, 11</p>
</li><li>
<p>RedHat/CentOS 7, 8</p>
</li><li>
<p>Ubuntu 12.04, 14.04, 16.04</p>
</li></ul>
<p>For Puppet 3 or older versions of Debian, please use 1.x.x releases.</p>
<h2 id="label-Development">Development</h2>
<p>Development happens on <a
href="https://github.com/sbitio/puppet-monit">GitHub</a>.</p>
<p>Please log issues for any bug report, feature or support request.</p>
<p>Pull requests are welcome.</p>
<h2 id="label-License">License</h2>
<p>MIT License, see LICENSE file</p>
<h2 id="label-Contact">Contact</h2>
<p>Use contact form on <a href="http://sbit.io">sbit.io</a></p>
</div></div>
<div id="footer">
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
</div>
</div>
</body>
</html>