867 |
watches whether the value will change again. You can use it just |
watches whether the value will change again. You can use it just |
868 |
for alert or to involve some automatic action, as for example to |
for alert or to involve some automatic action, as for example to |
869 |
reload monitored process after its configuration file was changed. |
reload monitored process after its configuration file was changed. |
870 |
Variable tests are supported for 'checksum', 'size' and 'timestamp' |
Variable tests are supported for 'checksum', 'size', 'pid, 'ppid' |
871 |
tests only, if you consider that other tests can be useful in |
and 'timestamp' tests only, if you consider that other tests can |
872 |
variable form too, please let us know. |
be useful in variable form too, please let us know. |
873 |
|
|
874 |
=over 4 |
=over 4 |
875 |
|
|
1481 |
|
|
1482 |
|
|
1483 |
|
|
1484 |
|
=head2 PID TESTING |
1485 |
|
|
1486 |
|
monit tests the process id (pid) of processes for change. This test |
1487 |
|
is implicit and monit will send alert in the case of failure by |
1488 |
|
default. |
1489 |
|
|
1490 |
|
You may override the default action using below rule (it may only |
1491 |
|
be used within a process service entry in the monit control file). |
1492 |
|
|
1493 |
|
The syntax for the pid statement is: |
1494 |
|
|
1495 |
|
=over 4 |
1496 |
|
|
1497 |
|
=item IF CHANGED PID THEN action |
1498 |
|
|
1499 |
|
=back |
1500 |
|
|
1501 |
|
I<action> is a choice of "ALERT", "RESTART", "START", "STOP", |
1502 |
|
"EXEC" or "UNMONITOR". |
1503 |
|
|
1504 |
|
This test is useful to detect possible process restarts which |
1505 |
|
has occured in the timeframe between two monit testing cycles. |
1506 |
|
In the case that the restart was fast and the process provides |
1507 |
|
expected service (i.e. all tests passed) you will be notified |
1508 |
|
that the process was replaced. |
1509 |
|
|
1510 |
|
For example sshd daemon can restart very quickly, thus if someone |
1511 |
|
changes its configuration and do sshd restart outside of monit |
1512 |
|
control, you will be notified that the process was replaced by |
1513 |
|
new instance (or you can optionaly do some other action such as |
1514 |
|
preventively stop sshd). |
1515 |
|
|
1516 |
|
Another example is MySQL Cluster which has its own watchdog with |
1517 |
|
process restart ability. You can use monit for redundant monitoring. |
1518 |
|
Monit will just send alert in the case that the MySQL cluster |
1519 |
|
restarted the node quickly. |
1520 |
|
|
1521 |
|
Example: |
1522 |
|
|
1523 |
|
check process sshd with pidfile /var/run/sshd.pid |
1524 |
|
if changed pid then exec "/my/script" |
1525 |
|
alert root@localhost |
1526 |
|
|
1527 |
|
|
1528 |
|
|
1529 |
|
=head2 PPID TESTING |
1530 |
|
|
1531 |
|
monit tests the process parent id (ppid) of processes for change. |
1532 |
|
This test is implicit and monit will send alert in the case of |
1533 |
|
failure by default. |
1534 |
|
|
1535 |
|
You may override the default action using below rule (it may only |
1536 |
|
be used within a process service entry in the monit control file). |
1537 |
|
|
1538 |
|
The syntax for the ppid statement is: |
1539 |
|
|
1540 |
|
=over 4 |
1541 |
|
|
1542 |
|
=item IF CHANGED PPID THEN action |
1543 |
|
|
1544 |
|
=back |
1545 |
|
|
1546 |
|
I<action> is a choice of "ALERT", "RESTART", "START", "STOP", |
1547 |
|
"EXEC" or "UNMONITOR". |
1548 |
|
|
1549 |
|
This test is useful to detect possible process parent change. |
1550 |
|
This may happen normaly only in the case that the process parent |
1551 |
|
exited. |
1552 |
|
|
1553 |
|
Example: |
1554 |
|
|
1555 |
|
check process myproc with pidfile /var/run/myproc.pid |
1556 |
|
if changed ppid then exec "/my/script" |
1557 |
|
alert root@localhost |
1558 |
|
|
1559 |
|
|
1560 |
|
|
1561 |
=head2 CONNECTION TESTING |
=head2 CONNECTION TESTING |
1562 |
|
|
1563 |
Monit is able to perform connection testing via networked ports |
Monit is able to perform connection testing via networked ports |
2519 |
stop The program used to stop the specified |
stop The program used to stop the specified |
2520 |
service. Full path is required. This |
service. Full path is required. This |
2521 |
statement is optional, but recommended. |
statement is optional, but recommended. |
2522 |
|
pid and ppid These keywords may be used as standalone |
2523 |
|
statements in a process service entry to |
2524 |
|
override the alert action for change of |
2525 |
|
process pid and ppid. |
2526 |
uid and gid These keywords are either 1) an optional part of |
uid and gid These keywords are either 1) an optional part of |
2527 |
a start, stop or exec statement. They may be |
a start, stop or exec statement. They may be |
2528 |
used to specify a user id and a group id the |
used to specify a user id and a group id the |
2678 |
I<ftp>, I<smtp>, I<pop>, I<nntp>, I<imap>, I<ssh>, I<dwp>, |
I<ftp>, I<smtp>, I<pop>, I<nntp>, I<imap>, I<ssh>, I<dwp>, |
2679 |
I<ldap2>, I<ldap3>, I<request>, I<cpu>, I<mem>, I<totalmem>, |
I<ldap2>, I<ldap3>, I<request>, I<cpu>, I<mem>, I<totalmem>, |
2680 |
I<children>, I<loadavg>, I<timestamp>, I<changed>, I<second(s)>, |
I<children>, I<loadavg>, I<timestamp>, I<changed>, I<second(s)>, |
2681 |
I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, I<inode>, |
I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, I<inode>, I<pid>, |
2682 |
I<perm(ission)>, I<process>, I<file>, I<directory>, I<device>, |
I<ppid>, I<perm(ission)>, I<process>, I<file>, I<directory>, |
2683 |
I<size>, I<unmonitor>, I<rdate>, I<rsync>, I<data>, I<invalid>, |
I<device>, I<size>, I<unmonitor>, I<rdate>, I<rsync>, I<data>, |
2684 |
I<exec>, I<nonexist> and I<failed> |
I<invalid>, I<exec>, I<nonexist> and I<failed> |
2685 |
|
|
2686 |
And here is a complete list of B<noise keywords> ignored by |
And here is a complete list of B<noise keywords> ignored by |
2687 |
monit: |
monit: |