1570 |
the moment only the HTTP protocol supports the request option. |
the moment only the HTTP protocol supports the request option. |
1571 |
See also below for an example. |
See also below for an example. |
1572 |
|
|
1573 |
|
In addition to the standard protocols, the I<APACHE-STATUS> |
1574 |
|
protocol is a test of a specific server type, rather than a |
1575 |
|
generic protocol. Server performance is examined using the status |
1576 |
|
page generated by Apache's mod_status, which is expected to be at |
1577 |
|
its default address of http://www.example.com/server-status. |
1578 |
|
Currently the I<APACHE-STATUS> protocol examines the percentage |
1579 |
|
of Apache child processes which are |
1580 |
|
|
1581 |
|
o logging (loglimit) |
1582 |
|
o closing connections (closelimit) |
1583 |
|
o performing DNS lookups (dnslimit) |
1584 |
|
o in keepalive with a client (keepalivelimit) |
1585 |
|
o replying to a client (replylimit) |
1586 |
|
o receiving a request (requestlimit) |
1587 |
|
o initialising (startlimit) |
1588 |
|
o waiting for incoming connections (waitlimit) |
1589 |
|
o gracefully closing down (gracefullimit) |
1590 |
|
o performing cleanup procedures (cleanuplimit) |
1591 |
|
|
1592 |
|
Each of these quantities can be compared against a percentage |
1593 |
|
value relative to the total number of active Apache child |
1594 |
|
processes. If the comparison expression is true the choosen |
1595 |
|
action is performed. |
1596 |
|
|
1597 |
|
The apache-status protocol statement is formally defined as |
1598 |
|
(keywords in uppercase): |
1599 |
|
|
1600 |
|
PROTO(COL) APACHE-STATUS {test}[|{test OR}+{test}] |
1601 |
|
|
1602 |
|
The codes in brackets above are used in the I<APACHE-STATUS> |
1603 |
|
protocol statement as shown below in an example using a |
1604 |
|
"loglimit" of 10 percent of processes. Further examples are |
1605 |
|
below. |
1606 |
|
|
1607 |
|
protocol apache-status |
1608 |
|
loglimit > 60% or |
1609 |
|
keepalivelimit > 50% or |
1610 |
|
waitlimit < 20% |
1611 |
|
then alert |
1612 |
|
|
1613 |
|
Obviously, do not use this test unless the httpd server you are |
1614 |
|
testing is Apache Httpd and mod_status is activated in the |
1615 |
|
server. |
1616 |
|
|
1617 |
|
|
1618 |
B<send/expect: {SEND|EXPECT} "string" ...>. If monit does not |
B<send/expect: {SEND|EXPECT} "string" ...>. If monit does not |
1619 |
support the protocol spoken by the server, you can write your own |
support the protocol spoken by the server, you can write your own |
1620 |
protocol-test using I<send> and I<expect> strings. The I<SEND> |
protocol-test using I<send> and I<expect> strings. The I<SEND> |
2700 |
expect "HTTP/[0-9\.]{3} 200 .*\r\n" |
expect "HTTP/[0-9\.]{3} 200 .*\r\n" |
2701 |
then alert |
then alert |
2702 |
|
|
2703 |
|
To make sure that Apache is logging successfully (i.e. no more |
2704 |
|
than 60 percent of child servers are logging), use its mod_status |
2705 |
|
page at www.sol.no/server-status with this special protocol test: |
2706 |
|
|
2707 |
|
check process apache with pidfile /var/run/httpd.pid |
2708 |
|
start "/etc/init.d/httpd start" |
2709 |
|
stop "/etc/init.d/httpd stop" |
2710 |
|
if failed host www.sol.no port 80 |
2711 |
|
protocol apache-status loglimit > 60% then restart |
2712 |
|
|
2713 |
|
This configuration can be used to alert you if 25 percent or more |
2714 |
|
of Apache child processes are stuck performing DNS lookups: |
2715 |
|
|
2716 |
|
check process apache with pidfile /var/run/httpd.pid |
2717 |
|
start "/etc/init.d/httpd start" |
2718 |
|
stop "/etc/init.d/httpd stop" |
2719 |
|
if failed host www.sol.no port 80 |
2720 |
|
protocol apache-status dnslimit > 25% then alert |
2721 |
|
|
2722 |
Here we use an icmp ping test to check if a remote host is up and |
Here we use an icmp ping test to check if a remote host is up and |
2723 |
if not send an alert: |
if not send an alert: |
2724 |
|
|