108 |
B<stop name> |
B<stop name> |
109 |
Stop the named service and disable its monitoring. |
Stop the named service and disable its monitoring. |
110 |
The name is a service entry name from the monitrc |
The name is a service entry name from the monitrc |
111 |
file. |
file. available |
112 |
|
|
113 |
|
|
114 |
B<restart all> |
B<restart all> |
115 |
Stop and start I<all> services. If the group option |
Stop and start I<all> services. If the group option |
1231 |
=back |
=back |
1232 |
|
|
1233 |
B<host:HOST hostname>. Optionally specify the host to connect |
B<host:HOST hostname>. Optionally specify the host to connect |
1234 |
to. If the host is not given, localhost is assumed in the case |
to. If the host is not given then localhost is assumed if this |
1235 |
that the test is used in process monitoring service, in the case |
test is used inside a process entry. If this test was used inside |
1236 |
that it is used in remote host monitoring service, specified |
a remote host entry then the entry's remote host is assumed. |
1237 |
address or hostname is assumed. Although I<host> is intended |
Although I<host> is intended for testing name based virtual host |
1238 |
for testing name based virtual host in a HTTP server running |
in a HTTP server running on local or remote host, it does allow |
1239 |
on local or remote host, it does allow the connection |
the connection statement to be used to test a server running on |
1240 |
statement to be used to test a server running on another |
another machine. This may be useful; For instance if you use |
1241 |
machine. This may be useful; For instance if you use Apache httpd |
Apache httpd as a front-end and an application-server as the |
1242 |
as a front-end and an application-server as the back-end running |
back-end running on another machine, this statement may be used |
1243 |
on another machine, this statement may be used to test that the |
to test that the back-end server is running and if not raise an |
1244 |
back-end server is running and if not raise an alert. |
alert. |
1245 |
|
|
1246 |
B<port:PORT number>. The port number to connect to |
B<port:PORT number>. The port number to connect to |
1247 |
|
|
1297 |
|
|
1298 |
if failed port 80 then alert |
if failed port 80 then alert |
1299 |
|
|
1300 |
In this case the machine in question is assumed to be |
In this case the machine in question is assumed to be the default |
1301 |
I<localhost> or I<address> of specified remote host and monit |
host. For a process entry it's I<localhost> and for a remote host |
1302 |
will conduct a tcp connection to that host at port 80. Monit |
entry it's the I<address> of the remote host. Monit will conduct |
1303 |
will use tcp by default, if you want to connect with udp, you |
a tcp connection to the host at port 80 and tcp by default. If |
1304 |
can specify this after the port-statement; |
you want to connect with udp, you can specify this after the |
1305 |
|
port-statement; |
1306 |
|
|
1307 |
if failed port 53 type udp then alert |
if failed port 53 type udp then alert |
1308 |
|
|
1374 |
protocol http |
protocol http |
1375 |
then restart |
then restart |
1376 |
|
|
1377 |
Example of connection test used in local process monitoring |
Here's an example where a connection test is used inside a |
1378 |
service: |
process entry: |
1379 |
|
|
1380 |
check process apache with path /var/run/apache.pid |
check process apache with pidfile /var/run/apache.pid |
1381 |
if failed host www.tildeslash.com port 80 then alert |
start program = "/etc/init.d/httpd start" |
1382 |
alert foo@bar.baz |
stop program = "/etc/init.d/httpd stop" |
1383 |
|
if failed host www.tildeslash.com port 80 then restart |
1384 |
Example of connection test used in remote host monitoring |
alert foo@bar.baz |
|
service: |
|
|
|
|
|
check host web with address 64.87.72.95 |
|
|
if failed host www.tildeslash.com port 80 then alert |
|
|
alert foo@bar.baz |
|
|
|
|
|
As mentioned above, if you don't specify the host option, |
|
|
specified address will be used. The address itself can be |
|
|
specified either as numeric address or as hostname, so |
|
|
this is legal equivalent: |
|
|
|
|
|
check host web with address www.tildeslash.com |
|
|
if failed port 80 then alert |
|
|
alert foo@bar.baz |
|
1385 |
|
|
1386 |
For more examples, see the example section below. |
Here, a connection test is used in a remote host entry: |
1387 |
|
|
1388 |
|
check host up2date with address ftp.redhat.com |
1389 |
|
if failed port 21 and protocol ftp then alert |
1390 |
|
alert foo@bar.baz |
1391 |
|
|
1392 |
|
Since we did not explicit specify a host in the above test, monit |
1393 |
|
will connect to port 21 at ftp.redhat.com. Aprops, the host |
1394 |
|
address can be specified as a dotted IP address string or as |
1395 |
|
hostname in the DNS. The following is excately[*] the same test, |
1396 |
|
but using an ip address instead: |
1397 |
|
|
1398 |
|
check host up2date with address 66.187.232.30 |
1399 |
|
if failed port 21 and protocol ftp then alert |
1400 |
|
alert foo@bar.baz |
1401 |
|
|
1402 |
|
[*] Well, not quite, since we specify an ip-address directly we |
1403 |
|
will bypass any DNS round-robin setup, but that's another story. |
1404 |
|
|
1405 |
|
For more examples, see the example section below. |
1406 |
|
|
1407 |
|
|
1408 |
|
|
2112 |
programs that does not (e.g. java programs), monit's ability to |
programs that does not (e.g. java programs), monit's ability to |
2113 |
start a program as a certain user can be very useful. In this |
start a program as a certain user can be very useful. In this |
2114 |
example we start the Tomcat Java Servlet Engine as the standard |
example we start the Tomcat Java Servlet Engine as the standard |
2115 |
I<nobody> user and group. Please note that monit will only change |
I<nobody> user and group. Please note that monit will only switch |
2116 |
uid and gid for a program if the super-user is running monit, |
uid and gid for a program if the super-user is running monit, |
2117 |
otherwise monit will simply ignore the request to change uid and |
otherwise monit will simply ignore the request to change uid and |
2118 |
gid. |
gid. |
2121 |
start program = "/etc/init.d/tomcat start" |
start program = "/etc/init.d/tomcat start" |
2122 |
as uid nobody and gid nobody |
as uid nobody and gid nobody |
2123 |
stop program = "/etc/init.d/tomcat stop" |
stop program = "/etc/init.d/tomcat stop" |
2124 |
# You can also use id numbers instead and write: |
# You can also use id numbers instead and write: |
2125 |
as uid 99 and with gid 99 |
as uid 99 and with gid 99 |
2126 |
if failed port 8080 then alert |
if failed port 8080 then alert |
2127 |
|
|
2362 |
if inode usage > 94 % then stop |
if inode usage > 94 % then stop |
2363 |
alert root@localhost |
alert root@localhost |
2364 |
|
|
2365 |
check host up2date with address ftp.redhat.com |
check host ftp.redhat.com with address ftp.redhat.com |
2366 |
if failed port 21 protocol ftp |
if failed port 21 protocol ftp |
2367 |
then exec "/usr/X11R6/bin/xmessage -display |
then exec "/usr/X11R6/bin/xmessage -display |
2368 |
:0 ftp connection failed" |
:0 ftp connection failed" |
2369 |
alert hauk@tildeslash.com |
alert hauk@tildeslash.com |
2370 |
|
|
2371 |
Note; only the B<check type>, B<pidfile/path> statements are |
Note; only the B<check type>, B<pidfile/path/address> statements |
2372 |
mandatory, the other statements are optional and the order of the |
are mandatory, the other statements are optional and the order of |
2373 |
optional statements is not important. |
the optional statements is not important. |
2374 |
|
|
2375 |
|
|
2376 |
=head1 MONIT WITH HEARTBEAT |
=head1 MONIT WITH HEARTBEAT |