Skip to content

Commit ece4690

Browse files
committed
Fix missing monitrc
1 parent b9c47c0 commit ece4690

2 files changed

Lines changed: 311 additions & 3 deletions

File tree

  • root
    • defaults
    • etc/s6-overlay/s6-rc.d/init-monit-config

root/defaults/monitrc

Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
###############################################################################
2+
## Monit control file
3+
###############################################################################
4+
##
5+
## Comments begin with a '#' and extend through the end of the line. Keywords
6+
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
7+
##
8+
## Below you will find examples of some frequently used statements. For
9+
## information about the control file and a complete list of statements and
10+
## options, please have a look in the Monit manual.
11+
##
12+
##
13+
###############################################################################
14+
## Global section
15+
###############################################################################
16+
##
17+
## Start Monit in the background (run as a daemon):
18+
#
19+
set daemon 30 # check services at 30 seconds intervals
20+
# with start delay 240 # optional: delay the first check by 4-minutes (by
21+
# # default Monit check immediately after Monit start)
22+
#
23+
#
24+
## Set syslog logging. If you want to log to a standalone log file instead,
25+
## specify the full path to the log file
26+
#
27+
set log syslog
28+
29+
#
30+
#
31+
## Set the location of the Monit lock file which stores the process id of the
32+
## running Monit instance. By default this file is stored in $HOME/.monit.pid
33+
#
34+
# set pidfile /var/run/monit.pid
35+
#
36+
## Set the location of the Monit id file which stores the unique id for the
37+
## Monit instance. The id is generated and stored on first Monit start. By
38+
## default the file is placed in $HOME/.monit.id.
39+
#
40+
# set idfile /var/.monit.id
41+
#
42+
## Set the location of the Monit state file which saves monitoring states
43+
## on each cycle. By default the file is placed in $HOME/.monit.state. If
44+
## the state file is stored on a persistent filesystem, Monit will recover
45+
## the monitoring state across reboots. If it is on temporary filesystem, the
46+
## state will be lost on reboot which may be convenient in some situations.
47+
#
48+
# set statefile /var/.monit.state
49+
#
50+
#
51+
52+
## Set limits for various tests. The following example shows the default values:
53+
##
54+
# set limits {
55+
# programOutput: 512 B, # check program's output truncate limit
56+
# sendExpectBuffer: 256 B, # limit for send/expect protocol test
57+
# fileContentBuffer: 512 B, # limit for file content test
58+
# httpContentBuffer: 1 MB, # limit for HTTP content test
59+
# networkTimeout: 5 seconds # timeout for network I/O
60+
# programTimeout: 300 seconds # timeout for check program
61+
# stopTimeout: 30 seconds # timeout for service stop
62+
# startTimeout: 30 seconds # timeout for service start
63+
# restartTimeout: 30 seconds # timeout for service restart
64+
# }
65+
66+
## Set global SSL options (just most common options showed, see manual for
67+
## full list).
68+
#
69+
# set ssl {
70+
# verify : enable, # verify SSL certificates (disabled by default but STRONGLY RECOMMENDED)
71+
# selfsigned : allow # allow self signed SSL certificates (reject by default)
72+
# }
73+
#
74+
#
75+
## Set the list of mail servers for alert delivery. Multiple servers may be
76+
## specified using a comma separator. If the first mail server fails, Monit
77+
## will use the second mail server in the list and so on. By default Monit uses
78+
## port 25 - it is possible to override this with the PORT option.
79+
#
80+
# set mailserver mail.bar.baz, # primary mailserver
81+
# backup.bar.baz port 10025, # backup mailserver on port 10025
82+
# localhost # fallback relay
83+
#
84+
#
85+
## By default Monit will drop alert events if no mail servers are available.
86+
## If you want to keep the alerts for later delivery retry, you can use the
87+
## EVENTQUEUE statement. The base directory where undelivered alerts will be
88+
## stored is specified by the BASEDIR option. You can limit the queue size
89+
## by using the SLOTS option (if omitted, the queue is limited by space
90+
## available in the back end filesystem).
91+
#
92+
# set eventqueue
93+
# basedir /var/monit # set the base directory where events will be stored
94+
# slots 100 # optionally limit the queue size
95+
#
96+
#
97+
## Send status and events to M/Monit (for more information about M/Monit
98+
## see https://mmonit.com/). By default Monit registers credentials with
99+
## M/Monit so M/Monit can smoothly communicate back to Monit and you don't
100+
## have to register Monit credentials manually in M/Monit. It is possible to
101+
## disable credential registration using the commented out option below.
102+
## Though, if safety is a concern we recommend instead using https when
103+
## communicating with M/Monit and send credentials encrypted. The password
104+
## should be URL encoded if it contains URL-significant characters like
105+
## ":", "?", "@". Default timeout is 5 seconds, you can customize it by
106+
## adding the timeout option.
107+
#
108+
# set mmonit http://monit:monit@192.168.1.10:8080/collector
109+
# # with timeout 30 seconds # Default timeout is 5 seconds
110+
# # and register without credentials # Don't register credentials
111+
#
112+
#
113+
## Monit by default uses the following format for alerts if the mail-format
114+
## statement is missing::
115+
## --8<--
116+
## set mail-format {
117+
## from: Monit <monit@$HOST>
118+
## subject: monit alert -- $EVENT $SERVICE
119+
## message: $EVENT Service $SERVICE
120+
## Date: $DATE
121+
## Action: $ACTION
122+
## Host: $HOST
123+
## Description: $DESCRIPTION
124+
##
125+
## Your faithful employee,
126+
## Monit
127+
## }
128+
## --8<--
129+
##
130+
## You can override this message format or parts of it, such as subject
131+
## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
132+
## are expanded at runtime. For example, to override the sender, use:
133+
#
134+
# set mail-format { from: monit@foo.bar }
135+
#
136+
#
137+
## You can set alert recipients whom will receive alerts if/when a
138+
## service defined in this file has errors. Alerts may be restricted on
139+
## events by using a filter as in the second example below.
140+
#
141+
# set alert sysadm@foo.bar # receive all alerts
142+
#
143+
## Do not alert when Monit starts, stops or performs a user initiated action.
144+
## This filter is recommended to avoid getting alerts for trivial cases.
145+
#
146+
# set alert your-name@your.domain not on { instance, action }
147+
#
148+
#
149+
## Monit has an embedded HTTP interface which can be used to view status of
150+
## services monitored and manage services from a web interface. The HTTP
151+
## interface is also required if you want to issue Monit commands from the
152+
## command line, such as 'monit status' or 'monit restart service' The reason
153+
## for this is that the Monit client uses the HTTP interface to send these
154+
## commands to a running Monit daemon. See the Monit Wiki if you want to
155+
## enable SSL for the HTTP interface.
156+
#
157+
set httpd port 2812 and
158+
use address localhost # only accept connection from localhost (drop if you use M/Monit)
159+
allow localhost # allow localhost to connect to the server and
160+
allow admin:monit # require user 'admin' with password 'monit'
161+
#with ssl { # enable SSL/TLS and set path to server certificate
162+
# pemfile: /etc/ssl/certs/monit.pem
163+
#}
164+
#
165+
## Monit can perform act differently regarding services previous state when
166+
## going back in duty. By default, Monit will 'start' all services. Monit can
167+
## also takes no action to start services in 'nostart' mode. Monit can try to
168+
## restore the 'laststate' of the service when Monit was shutdown.
169+
# set onreboot start # start, nostart, laststart
170+
171+
###############################################################################
172+
## Services
173+
###############################################################################
174+
##
175+
## Check general system resources such as load average, cpu and memory
176+
## usage. Each test specifies a resource, conditions and the action to be
177+
## performed should a test fail.
178+
#
179+
# check system $HOST
180+
# if loadavg (1min) per core > 2 for 5 cycles then alert
181+
# if loadavg (5min) per core > 1.5 for 10 cycles then alert
182+
# if cpu usage > 95% for 10 cycles then alert
183+
# if memory usage > 75% then alert
184+
# if swap usage > 25% then alert
185+
#
186+
#
187+
## Check if a file exists, checksum, permissions, uid and gid. In addition
188+
## to alert recipients in the global section, customized alert can be sent to
189+
## additional recipients by specifying a local alert handler. The service may
190+
## be grouped using the GROUP option. More than one group can be specified by
191+
## repeating the 'group name' statement.
192+
#
193+
# check file apache_bin with path /usr/local/apache/bin/httpd
194+
# if failed checksum and
195+
# expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
196+
# if failed permission 755 then unmonitor
197+
# if failed uid "root" then unmonitor
198+
# if failed gid "root" then unmonitor
199+
# alert security@foo.bar on {
200+
# checksum, permission, uid, gid, unmonitor
201+
# } with the mail-format { subject: Alarm! }
202+
# group server
203+
#
204+
#
205+
## Check that a process is running, in this case Apache, and that it respond
206+
## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
207+
## and number of children. If the process is not running, Monit will restart
208+
## it by default. In case the service is restarted very often and the
209+
## problem remains, it is possible to disable monitoring using the TIMEOUT
210+
## statement. This service depends on another service (apache_bin) which
211+
## is defined above.
212+
#
213+
# check process apache with pidfile /usr/local/apache/logs/httpd.pid
214+
# start program = "/etc/init.d/httpd start" with timeout 60 seconds
215+
# stop program = "/etc/init.d/httpd stop"
216+
# if cpu > 60% for 2 cycles then alert
217+
# if cpu > 80% for 5 cycles then restart
218+
# if totalmem > 200.0 MB for 5 cycles then restart
219+
# if children > 250 then restart
220+
# if disk read > 500 kb/s for 10 cycles then alert
221+
# if disk write > 500 kb/s for 10 cycles then alert
222+
# if failed host www.tildeslash.com port 80 protocol http and request "/somefile.html" then restart
223+
# if failed port 443 protocol https with timeout 15 seconds then restart
224+
# if 3 restarts within 5 cycles then unmonitor
225+
# depends on apache_bin
226+
# group server
227+
#
228+
#
229+
## Check filesystem permissions, uid, gid, space usage, inode usage and disk I/O.
230+
## Other services, such as databases, may depend on this resource and an automatically
231+
## graceful stop may be cascaded to them before the filesystem will become full and data
232+
## lost.
233+
#
234+
# check filesystem datafs with path /dev/sdb1
235+
# start program = "/bin/mount /data"
236+
# stop program = "/bin/umount /data"
237+
# if failed permission 660 then unmonitor
238+
# if failed uid "root" then unmonitor
239+
# if failed gid "disk" then unmonitor
240+
# if space usage > 80% for 5 times within 15 cycles then alert
241+
# if space usage > 99% then stop
242+
# if inode usage > 30000 then alert
243+
# if inode usage > 99% then stop
244+
# if read rate > 1 MB/s for 5 cycles then alert
245+
# if read rate > 500 operations/s for 5 cycles then alert
246+
# if write rate > 1 MB/s for 5 cycles then alert
247+
# if write rate > 500 operations/s for 5 cycles then alert
248+
# if service time > 10 milliseconds for 3 times within 5 cycles then alert
249+
# group server
250+
#
251+
#
252+
## Check a file's timestamp. In this example, we test if a file is older
253+
## than 15 minutes and assume something is wrong if its not updated. Also,
254+
## if the file size exceed a given limit, execute a script
255+
#
256+
# check file database with path /data/mydatabase.db
257+
# if failed permission 700 then alert
258+
# if failed uid "data" then alert
259+
# if failed gid "data" then alert
260+
# if timestamp > 15 minutes then alert
261+
# if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba
262+
#
263+
#
264+
## Check directory permission, uid and gid. An event is triggered if the
265+
## directory does not belong to the user with uid 0 and gid 0. In addition,
266+
## the permissions have to match the octal description of 755 (see chmod(1)).
267+
#
268+
# check directory bin with path /bin
269+
# if failed permission 755 then unmonitor
270+
# if failed uid 0 then unmonitor
271+
# if failed gid 0 then unmonitor
272+
#
273+
#
274+
## Check a remote host availability by issuing a ping test and check the
275+
## content of a response from a web server. Up to three pings are sent and
276+
## connection to a port and an application level network check is performed.
277+
#
278+
# check host myserver with address 192.168.1.1
279+
# if failed ping then alert
280+
# if failed port 3306 protocol mysql with timeout 15 seconds then alert
281+
# if failed port 80 protocol http
282+
# and request /some/path with content = "a string"
283+
# then alert
284+
#
285+
#
286+
## Check a network link status (up/down), link capacity changes, saturation
287+
## and bandwidth usage.
288+
#
289+
# check network public with interface eth0
290+
# if link down then alert
291+
# if changed link then alert
292+
# if saturation > 90% then alert
293+
# if download > 10 MB/s then alert
294+
# if total uploaded > 1 GB in last hour then alert
295+
#
296+
#
297+
## Check custom program status output.
298+
#
299+
# check program myscript with path /usr/local/bin/myscript.sh
300+
# if status != 0 then alert
301+
#
302+
#
303+
###############################################################################
304+
## Includes
305+
###############################################################################
306+
##
307+
## It is possible to include additional configuration parts from other files or
308+
## directories.
309+
#
310+
# include /etc/monit.d/*
311+
#

root/etc/s6-overlay/s6-rc.d/init-monit-config/run

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@ fi
1414
chmod 700 \
1515
/config/monitrc
1616

17-
chmod +x \
18-
/config/monit2apprise.sh
19-
2017
lsiown -R abc:abc \
2118
/config

0 commit comments

Comments
 (0)