215 |
monit -g <groupname> status |
monit -g <groupname> status |
216 |
|
|
217 |
|
|
218 |
|
=head1 MONITORING MODE SELECTION |
219 |
|
|
220 |
|
Monit supports three monitoring modes: active, passive and |
221 |
|
manual. |
222 |
|
|
223 |
|
In I<active> mode, monit will monitor the program - in the |
224 |
|
case that the program is not running it will start/restart |
225 |
|
it (this is the default behaviour). |
226 |
|
|
227 |
|
In I<passive> mode, monit will only monitor the service. |
228 |
|
Resource related restart and stop options are ignored in |
229 |
|
this mode as well and will only send alert. |
230 |
|
|
231 |
|
For clustered environments there is I<manual> option. If it |
232 |
|
is defined, monit will enter I<active> mode only if the |
233 |
|
service was started under monit's control, for example by: |
234 |
|
|
235 |
|
monit start sybase |
236 |
|
|
237 |
|
or |
238 |
|
|
239 |
|
monit -g database start (for service group) |
240 |
|
|
241 |
|
If the service wasn't started by monit or was stopped for |
242 |
|
example by: |
243 |
|
|
244 |
|
monit stop sybase |
245 |
|
|
246 |
|
or |
247 |
|
|
248 |
|
monit -g database stop (for service group) |
249 |
|
|
250 |
|
it woun't monitor the service at all. It allows to have |
251 |
|
service configured in monitrc and start it along with its |
252 |
|
process monitor only if it should run. It could be used for |
253 |
|
building simple cluster. You can use for example heartbeat |
254 |
|
to watch health of nodes and in the case of one machine |
255 |
|
failure start the service on secondary node. |
256 |
|
|
257 |
|
Appropriate scripts that can call monit to start/stop |
258 |
|
specific service are needed on both nodes - typical usage: |
259 |
|
|
260 |
|
FILE DESCRIPTION |
261 |
|
----------------------------------- |
262 |
|
/etc/inittab starts monit |
263 |
|
/etc/rcS.d/S41heartbeat execute "monit start heartbeat" |
264 |
|
/etc/init.d/monit-node1 execute "monit -g node1 start" |
265 |
|
/etc/init.d/monit-node2 execute "monit -g node2 start" |
266 |
|
|
267 |
|
so hearbeat can control easy the cluster state and if one |
268 |
|
node fails, hearbeat starts monit-xxxxx of the failing |
269 |
|
node => monit is instructed to start the services of the |
270 |
|
failing node and monitor them... |
271 |
|
|
272 |
|
|
273 |
=head1 ALERT MESSAGES |
=head1 ALERT MESSAGES |
274 |
|
|
275 |
monit will send an email alert if a program timed out, if monit |
monit will send an email alert if a program timed out, if monit |
605 |
|
|
606 |
host www.tildeslash.com port 80 protocol http |
host www.tildeslash.com port 80 protocol http |
607 |
|
|
608 |
At the moment monit knows how to speak I<HTTP>, I<SMPT>, I<FTP>, |
At the moment monit knows how to speak I<HTTP>, I<SMTP>, I<FTP>, |
609 |
I<POP>, I<IMAP> and I<NNTP>. If you have compiled monit with ssl |
I<POP>, I<IMAP> and I<NNTP>. If you have compiled monit with ssl |
610 |
support, monit can also speak I<HTTPS>, I<FTPS>, I<POPS> and |
support, monit can also speak I<HTTPS>, I<FTPS>, I<POPS> and |
611 |
I<IMAPS>. |
I<IMAPS>. |
1040 |
cycle. Usefull in daemon mode when the |
cycle. Usefull in daemon mode when the |
1041 |
poll-cycle is short and the program takes |
poll-cycle is short and the program takes |
1042 |
some time to start. |
some time to start. |
1043 |
autostart Must be followed by the keywords yes or no. |
mode Must be followed either by the keyword active, |
1044 |
If yes, monit will restart the program if |
passive or manual. If active, monit will restart |
1045 |
it is not running (the default behaviour). |
the program if it is not running (this is the |
1046 |
|
default behaviour). If passive, monit will not |
1047 |
|
(re)start the program if it is not running - it |
1048 |
|
will only monitor and send alerts (resource |
1049 |
|
related restart and stop options are ignored |
1050 |
|
in this mode also). If manual, monit will enter |
1051 |
|
active mode only if service was started under |
1052 |
|
monit's control otherwise the service isn't |
1053 |
|
monitored. |
1054 |
cpuusage Must be followed by a compare operator, a |
cpuusage Must be followed by a compare operator, a |
1055 |
floating point number, optionally a maximum |
floating point number, optionally a maximum |
1056 |
number of cycles and an action. This statement |
number of cycles and an action. This statement |
1083 |
I<port(number)>, I<unix(socket)>, I<type>, I<proto(col)>, I<tcp>, |
I<port(number)>, I<unix(socket)>, I<type>, I<proto(col)>, I<tcp>, |
1084 |
I<tcpssl>, I<udp>, I<alert>, I<mail-format>, I<restart>, |
I<tcpssl>, I<udp>, I<alert>, I<mail-format>, I<restart>, |
1085 |
I<timeout>, I<checksum>, I<resource>, I<expect>, I<mailserver>, |
I<timeout>, I<checksum>, I<resource>, I<expect>, I<mailserver>, |
1086 |
I<every>, I<autostart>, I<yes>, I<no>, I<host>, I<default>, |
I<every>, I<mode>, I<active>, I<passive>, I<manual>, I<host>, |
1087 |
I<http>, I<ftp>, I<smtp>, I<pop>, I<nntp>, I<imap>, I<request>, |
I<default>, I<http>, I<ftp>, I<smtp>, I<pop>, I<nntp>, I<imap>, |
1088 |
I<cpuusage>, I<memusage>, I<memkbyte> and I<loadavg>. |
I<request>, I<cpuusage>, I<memusage>, I<memkbyte> and I<loadavg>. |
1089 |
|
|
1090 |
And here is a complete list of B<noise keywords> ignored by |
And here is a complete list of B<noise keywords> ignored by |
1091 |
monit: |
monit: |
1185 |
every 2 cycle |
every 2 cycle |
1186 |
|
|
1187 |
Here is an example where we group together two database entries. |
Here is an example where we group together two database entries. |
1188 |
The autostart statement is also illustrated in the first entry and |
The mode statement is also illustrated in the first entry and |
1189 |
have the effect that monit will not try to (re)start this program |
have the effect that monit will not try to (re)start this program |
1190 |
if it is not running: |
if it is not running: |
1191 |
|
|
1192 |
check sybase with pidfile /var/run/sybase.pid |
check sybase with pidfile /var/run/sybase.pid |
1193 |
start program = "/etc/init.d/sybase start" |
start program = "/etc/init.d/sybase start" |
1194 |
stop program = "/etc/init.d/sybase stop" |
stop program = "/etc/init.d/sybase stop" |
1195 |
autostart no |
mode passive |
1196 |
group database |
group database |
1197 |
|
|
1198 |
check oracle with pidfile /var/run/oracle.pid |
check oracle with pidfile /var/run/oracle.pid |
1199 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1200 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1201 |
autostart yes # Not necessary really, since this is the default |
mode active # Not necessary really, since this is the default |
1202 |
port 9001 |
port 9001 |
1203 |
alert bofh@foo.bar |
alert bofh@foo.bar |
1204 |
group database |
group database |
1314 |
alert bofh@bar on { restart, timeout } with |
alert bofh@bar on { restart, timeout } with |
1315 |
mail-format { from: monit@foo.bar.no } |
mail-format { from: monit@foo.bar.no } |
1316 |
every 2 cycles |
every 2 cycles |
1317 |
autostart yes |
mode active |
1318 |
depend webfoo |
depend webfoo |
1319 |
|
|
1320 |
Note; only the B<check-> and B<pidfile statement> are mandatory, |
Note; only the B<check-> and B<pidfile statement> are mandatory, |