176 |
<P><STRONG>stop name</STRONG> |
<P><STRONG>stop name</STRONG> |
177 |
Stop the named service and disable its monitoring. |
Stop the named service and disable its monitoring. |
178 |
The name is a service entry name from the monitrc |
The name is a service entry name from the monitrc |
179 |
file.</P> |
file. available</P> |
180 |
<P><STRONG>restart all</STRONG> |
<P><STRONG>restart all</STRONG> |
181 |
Stop and start <EM>all</EM> services. If the group option |
Stop and start <EM>all</EM> services. If the group option |
182 |
is set, only restart the services in the named group.</P> |
is set, only restart the services in the named group.</P> |
1060 |
<DD> |
<DD> |
1061 |
</DL> |
</DL> |
1062 |
<P><STRONG>host:HOST hostname</STRONG>. Optionally specify the host to connect |
<P><STRONG>host:HOST hostname</STRONG>. Optionally specify the host to connect |
1063 |
to. If the host is not given, localhost is assumed. Although |
to. If the host is not given then localhost is assumed if this |
1064 |
<EM>host</EM> is intended for testing name based virtual host in a HTTP |
test is used inside a process entry. If this test was used inside |
1065 |
server running on localhost, it does allow the connection |
a remote host entry then the entry's remote host is assumed. |
1066 |
statement to be used to test a server running on another |
Although <EM>host</EM> is intended for testing name based virtual host |
1067 |
machine. This may be useful; For instance if you use Apache httpd |
in a HTTP server running on local or remote host, it does allow |
1068 |
as a front-end and an application-server as the back-end running |
the connection statement to be used to test a server running on |
1069 |
on another machine, this statement may be used to test that the |
another machine. This may be useful; For instance if you use |
1070 |
back-end server is running and if not raise an alert.</P> |
Apache httpd as a front-end and an application-server as the |
1071 |
|
back-end running on another machine, this statement may be used |
1072 |
|
to test that the back-end server is running and if not raise an |
1073 |
|
alert.</P> |
1074 |
<P><STRONG>port:PORT number</STRONG>. The port number to connect to</P> |
<P><STRONG>port:PORT number</STRONG>. The port number to connect to</P> |
1075 |
<P><STRONG>unixsocket:UNIXSOCKET PATH</STRONG>. Specifies the path to a Unix |
<P><STRONG>unixsocket:UNIXSOCKET PATH</STRONG>. Specifies the path to a Unix |
1076 |
socket. Servers based on Unix sockets, always runs on the local |
socket. Servers based on Unix sockets, always runs on the local |
1116 |
connect to the port, use the following statement:</P> |
connect to the port, use the following statement:</P> |
1117 |
<PRE> |
<PRE> |
1118 |
if failed port 80 then alert</PRE> |
if failed port 80 then alert</PRE> |
1119 |
<P>In this case the machine in question is assumed to be |
<P>In this case the machine in question is assumed to be the default |
1120 |
<EM>localhost</EM> and monit will conduct a tcp connection to localhost |
host. For a process entry it's <EM>localhost</EM> and for a remote host |
1121 |
at port 80. Monit will use tcp by default, if you want to connect |
entry it's the <EM>address</EM> of the remote host. Monit will conduct |
1122 |
with udp, you can specify this after the port-statement;</P> |
a tcp connection to the host at port 80 and tcp by default. If |
1123 |
|
you want to connect with udp, you can specify this after the |
1124 |
|
port-statement;</P> |
1125 |
<PRE> |
<PRE> |
1126 |
if failed port 53 type udp then alert</PRE> |
if failed port 53 type udp then alert</PRE> |
1127 |
<P>Monit will stop trying to connect to the port after 5 seconds and |
<P>Monit will stop trying to connect to the port after 5 seconds and |
1147 |
if failed host 80.69.226.133 port 443 then alert |
if failed host 80.69.226.133 port 443 then alert |
1148 |
if failed host kvasir.sol.no port 80 then alert</PRE> |
if failed host kvasir.sol.no port 80 then alert</PRE> |
1149 |
<P>And as mentioned above, if you do not specify a host-statement, |
<P>And as mentioned above, if you do not specify a host-statement, |
1150 |
<EM>localhost</EM> is assumed.</P> |
<EM>localhost</EM> or <EM>address</EM> is assumed.</P> |
1151 |
<P>Monit also knows how to speak some of the more popular Internet |
<P>Monit also knows how to speak some of the more popular Internet |
1152 |
protocols. So, besides testing for connections, monit can also |
protocols. So, besides testing for connections, monit can also |
1153 |
speak with the server in question to verify that the server |
speak with the server in question to verify that the server |
1182 |
CERTMD5 12-34-56-78-90-AB-CD-EF-12-34-56-78-90-AB-CD-EF |
CERTMD5 12-34-56-78-90-AB-CD-EF-12-34-56-78-90-AB-CD-EF |
1183 |
protocol http |
protocol http |
1184 |
then restart</PRE> |
then restart</PRE> |
1185 |
<P>When a connection test is used in a check host entry, the host |
<P>Here's an example where a connection test is used inside a |
1186 |
name can <STRONG>not</STRONG> be used in the if-test since the host name is |
process entry:</P> |
|
bound to the entry itself.</P> |
|
|
<P>E.g. this is legal:</P> |
|
|
<PRE> |
|
|
check HOST ftp.redhat.com |
|
|
if failed port 21 then exec |
|
|
"/usr/X11R6/bin/xmessage -display :0 RedHat is down as usual!"</PRE> |
|
|
<P>this is not, and will lead to a parse error:</P> |
|
1187 |
<PRE> |
<PRE> |
1188 |
check host ftp.redhat.com |
check process apache with pidfile /var/run/apache.pid |
1189 |
if failed HOST ftp.suse.com port 21 then ...</PRE> |
start program = "/etc/init.d/httpd start" |
1190 |
|
stop program = "/etc/init.d/httpd stop" |
1191 |
|
if failed host www.tildeslash.com port 80 then restart |
1192 |
|
alert foo@bar.baz</PRE> |
1193 |
|
<P>Here, a connection test is used in a remote host entry:</P> |
1194 |
|
<PRE> |
1195 |
|
check host up2date with address ftp.redhat.com |
1196 |
|
if failed port 21 and protocol ftp then alert |
1197 |
|
alert foo@bar.baz</PRE> |
1198 |
|
<P>Since we did not explicit specify a host in the above test, monit |
1199 |
|
will connect to port 21 at ftp.redhat.com. Aprops, the host |
1200 |
|
address can be specified as a dotted IP address string or as |
1201 |
|
hostname in the DNS. The following is excately[*] the same test, |
1202 |
|
but using an ip address instead:</P> |
1203 |
|
<PRE> |
1204 |
|
check host up2date with address 66.187.232.30 |
1205 |
|
if failed port 21 and protocol ftp then alert |
1206 |
|
alert foo@bar.baz</PRE> |
1207 |
|
<P>[*] Well, not quite, since we specify an ip-address directly we |
1208 |
|
will bypass any DNS round-robin setup, but that's another story.</P> |
1209 |
<P>For more examples, see the example section below.</P> |
<P>For more examples, see the example section below.</P> |
1210 |
<P> |
<P> |
1211 |
<HR> |
<HR> |
1554 |
mode or the start methods is not defined, monit will just send |
mode or the start methods is not defined, monit will just send |
1555 |
alerts on errors. |
alerts on errors. |
1556 |
<P></P> |
<P></P> |
1557 |
<LI><STRONG><A NAME="item_CHECK_HOST_%3Cunique_host_address%3E">CHECK HOST <unique host address></A></STRONG><BR> |
<LI><STRONG><A NAME="item_CHECK_HOST_%3Cunique_name%3E_ADDRESS_%3Chost_addre">CHECK HOST <unique name> ADDRESS <host address></A></STRONG><BR> |
1558 |
|
|
1559 |
The host address can be specified as a hostname string or as an |
The host address can be specified as a hostname string or as an |
1560 |
ip-address string on a dotted decimal format. Such as, |
ip-address string on a dotted decimal format. Such as, |
1561 |
tildeslash.com or ``64.87.72.95'' |
tildeslash.com or ``64.87.72.95''. |
1562 |
<P></P></OL> |
<P></P></OL> |
1563 |
<P>You can use noise keywords like 'if', `and', `with(in)', `has', |
<P>You can use noise keywords like 'if', `and', `with(in)', `has', |
1564 |
`using', 'use', 'on(ly)', `usage' and `program(s)' anywhere in an |
`using', 'use', 'on(ly)', `usage' and `program(s)' anywhere in an |
1830 |
programs that does not (e.g. java programs), monit's ability to |
programs that does not (e.g. java programs), monit's ability to |
1831 |
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 |
1832 |
example we start the Tomcat Java Servlet Engine as the standard |
example we start the Tomcat Java Servlet Engine as the standard |
1833 |
<EM>nobody</EM> user and group. Please note that monit will only change |
<EM>nobody</EM> user and group. Please note that monit will only switch |
1834 |
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, |
1835 |
otherwise monit will simply ignore the request to change uid and |
otherwise monit will simply ignore the request to change uid and |
1836 |
gid.</P> |
gid.</P> |
1837 |
<PRE> |
<PRE> |
1838 |
check tomcat with pidfile /var/run/tomcat.pid |
check process tomcat with pidfile /var/run/tomcat.pid |
1839 |
start program = "/etc/init.d/tomcat start" |
start program = "/etc/init.d/tomcat start" |
1840 |
as uid nobody and gid nobody |
as uid nobody and gid nobody |
1841 |
stop program = "/etc/init.d/tomcat stop" |
stop program = "/etc/init.d/tomcat stop" |
1842 |
# You can also use id numbers instead and write: |
# You can also use id numbers instead and write: |
1843 |
as uid 99 and with gid 99 |
as uid 99 and with gid 99 |
1844 |
if failed port 8080 then alert</PRE> |
if failed port 8080 then alert</PRE> |
1845 |
<P>In this example we use udp for connection testing to check if the |
<P>In this example we use udp for connection testing to check if the |
2067 |
if inode usage > 94 % then stop |
if inode usage > 94 % then stop |
2068 |
alert root@localhost</PRE> |
alert root@localhost</PRE> |
2069 |
<PRE> |
<PRE> |
2070 |
check host ftp.redhat.com |
check host ftp.redhat.com with address ftp.redhat.com |
2071 |
if failed port 21 protocol ftp |
if failed port 21 protocol ftp |
2072 |
then exec "/usr/X11R6/bin/xmessage -display |
then exec "/usr/X11R6/bin/xmessage -display |
2073 |
:0 ftp connection failed" |
:0 ftp connection failed" |
2074 |
alert hauk@tildeslash.com</PRE> |
alert hauk@tildeslash.com</PRE> |
2075 |
<P>Note; only the <STRONG>check type</STRONG>, <STRONG>pidfile/path</STRONG> statements are |
<P>Note; only the <STRONG>check type</STRONG>, <STRONG>pidfile/path/address</STRONG> statements |
2076 |
mandatory, the other statements are optional and the order of the |
are mandatory, the other statements are optional and the order of |
2077 |
optional statements is not important.</P> |
the optional statements is not important.</P> |
2078 |
<P> |
<P> |
2079 |
<HR> |
<HR> |
2080 |
<H1><A NAME="monit with heartbeat">MONIT WITH HEARTBEAT</A></H1> |
<H1><A NAME="monit with heartbeat">MONIT WITH HEARTBEAT</A></H1> |