mon(8) – Linux man web page


mon – monitor companies for availability, sending alarms upon failures.


mon [-dfhlMSv] [-a ] [-A ] [-b
] [-B ] [-c ] [-D ] [-i ] [-k ] [-l
statetype] [-L ] [-m ] [-p ] [-P ] [-r ] [-s


mon is a general-purpose scheduler for monitoring service availability and triggering
alerts upon detecting failures. mon was designed to be open within the sense that it helps arbitrary monitoring amenities and alert strategies by way of a typical
interface, that are simply carried out by applications (in C, Perl, shell, and so on.), SNMP traps, and particular Mon (UDP packet) traps.


A program which checks for a sure situation, returns both true or false, and optionally produces output to be handed again to the scheduler. Widespread
displays detect host reachability by way of ICMP echo messages, or connection to TCP companies.
A interval in time as interpreted by the Time::Interval module.
A program which sends a message when invoked by the scheduler. The scheduler calls upon an alert when it detects a failure from a monitor. An alert program
accepts a set of command-line arguments from the scheduler, along with information by way of normal enter.
A single host or checklist of hosts, specified as names or IP addresses.
A group of parameters used to cope with monitoring a selected useful resource which is supplied by a bunch. Providers are often modeled after issues such
as an SMTP server, ICMP echo functionality, server disk house availability, or SNMP occasions.
A group of hostgroups, used to filter mon output for shopper show. i.e. a ‘network-services’ view is perhaps outlined so your community workers can see
simply the hostgroups which matter to them, with out having to see all hostgroups outlined in Mon.
A group of companies which apply to a selected group.


When the mon scheduler begins, it reads a configuration file to find out the companies it
wants to watch. The configuration file defaults to , and might be specified utilizing the -c parameter. If the -M possibility is
specified, then the configuration file is pre-processed with . If the configuration file ends with .m4, the file can also be processed by m4

The scheduler enters a loop which handles shopper connections, monitor invocations, and failure alerts. Every service has a timer, specified within the
configuration file because the interval variable, which tells the scheduler how often to invoke a monitor course of. The scheduler could also be briefly
stopped. Whereas it’s stopped, shopper entry nonetheless capabilities, however it simply does not schedule issues. That is helpful in conjunction whereas resetting the server,
as a result of you are able to do this: save the hosts and companies that are disabled, reset the server with the scheduler stopped, re-disabled these hosts and companies,
then begin the scheduler. It additionally permits making atomic adjustments throughout a number of shopper connections. See the moncmd man web page for extra info.

Monitor Applications

Monitor processes are invoked with the arguments specified within the configuration file,
appended by the hosts from the relevant host group. For instance, if the watch group is “servers”, which include the hostnames “smtp”, “nntp”, and “ns”, and
the monitor line reads as follows,
monitor fping.monitor -t 4000 -r 2
then the exectuable “fping.monitor” might be executed with these parameters:
MONITOR_DIR/fping.monitor -t 4000 -r 2 smtp nntp ns

MONITOR_DIR is definitely a search path, by default then , however it may be overridden by the -s
possibility or within the configuration file. If all hosts within the hostgroup have been disabled, then a warning is distributed to syslog and the monitor is just not run. This
conduct could also be overridden with the “allow_empty_group” possibility within the service definition. If the ultimate argument to the “monitor” line is “;;” (it have to be
preceded by whitespace), then the host checklist won’t be appended to the parameter checklist.

Along with surroundings variables outlined by the person within the service definition, mon passes sure variables to watch course of.

See also  Visual Basic

“fping.monitor” ought to return an exit standing of 0 if it accomplished efficiently (discovered no issues), or nonzero if an issue was detected. The primary line of
output from the monitor script has a particular that means: it’s used as a short abstract of the precise failure which was detected, and is handed to the alert
program. All remaining output can also be handed to the alert program, however it has no required interpretation.

If a monitor for a selected service remains to be working, and the time comes for mon to run one other monitor for that service, it won’t begin one other
monitor. For instance, if the is 10s, and the monitor doesn’t end working inside 10 seconds, then mon will wait till the primary
monitor exits earlier than working one other one.

Alert Determination Logic

Upon a non-zero or zero exit standing, the related alert or upalert program
(respectively) is began, pending the next circumstances: If an alert for a selected service is disabled, don’t ship an alert. If dep_behavior is
set to , or alertdepend is about, and a mother or father dependency is failing, then suppress the alert. If the alert has beforehand been acknowledged, do
not ship the alert, until it’s an upalert. If an alert is just not throughout the specified interval, document the failure by way of and don’t ship an alert.
If the failure doesn’t fall inside an outlined interval, don’t ship an alert. No upalerts are despatched with out corresponding down alerts, until
no_comp_alerts is outlined within the interval part. An upalert will solely be despatched if the earlier state is a failure. If an alert was already despatched inside
the final alertevery interval, don’t ship one other alert, the abstract output from the present monitor program differs from the final monitor
course of. In any other case, ship an alert utilizing every alert program listed for that interval. The observe_detail argument to alertevery impacts this
conduct by observing the adjustments within the element a part of the output along with the abstract line. If a monitor has successive failures and the abstract output
adjustments in every of them, alertevery won’t suppress a number of consecutive alerts. The reasoning is that if the abstract output adjustments, then a
important occasion occurred and the person ought to be alerted. The “strict” argument to alertevery will suppress each evaluating the output from the earlier
monitor run to the present and forestall a profitable return worth of the monitor from resetting the alertevery timer. For instance, “alertevery 24h strict” will
solely ship out an alert as soon as each 24 hours, no matter whether or not the monitor output adjustments, or if the service stops after which begins failing.

Alert Applications

Alert applications are discovered within the path equipped with the -a parameter, or within the
and directories if not specified. They’re invoked with the next command-line parameters:

The primary line of the output from the final time the monitor exited.
Your complete output of the monitor from the final time it exited.
The of the final failure for this service.
The of the primary time this service failed.
The of the final time this service handed.
The outline of this service, as outlined within the configuration file utilizing the tag.
The watch group which triggered this alarm

The service heading which generated this alert

The exit worth of the failed monitor program, or return worth as accepted from a entice.
The operational standing of the service.
Has one of many following values: “failure”, “up”, “startup”, “trap”, or “traptimeout”, and signifies the kind of alert which was triggered.
That is solely set when an unknown mon entice is acquired and caught by the default/defaut watch/service. This accommodates colon separated entries of the entice’s
meant watch group and repair title.
The listing log recordsdata ought to be positioned, as indicated by the world configuration variable.
The listing the place state recordsdata ought to be stored, as indicated by the world configuration variable.
The listing the place configuration recordsdata ought to be stored, as indicated by the world configuration variable.

The primary line from normal enter have to be used as a short abstract of the issue, usually equipped as the topic line of an e-mail, or textual content despatched to an
alphanumeric pager. Interpretation of all subsequent strains learn from stdin is left as much as the alerting program. The same old parameters are a listing of recipients to
ship the notification to. The interpretation of the recipients is just not specified, and is as much as the alert program.

Configuration File

The configuration file consists of zero or extra world variable definitions, zero or
extra hostgroup definitions, and a number of watch definitions. Every watch definition might have a number of service definitions. A watch definition is terminated
by a clean line, one other definition, or the tip of the file. A line starting with non-obligatory main whitespace and a pound (“#”) is thought to be a remark, and
is ignored.

Traces are parsed as they’re learn. Lengthy strains could also be continued by ending them with a backslash (“). If a line is sustained, then the backslash, the
trailing whitespace after the backslash, and the main whitespace of the next line are eliminated. The top result’s assembled right into a single line.

Usually the configuration file has the next format:

1. International variable definitions

2. Hostgroup definitions

3. Watch


See the “etc/” file which comes for the distribution for an instance.

International Variables

The next variables could also be set to override compiled-in defaults. Command-line
choices may have a better priority than these definitions.

See also  7 Best FLV to AVI Converters to Convert FLV to AVI Easily

Hostgroup Entries

Hostgroup entries start with the key phrase hostgroup, and are adopted by a hostgroup tag and a number of hostnames or IP addresses, separated by
whitespace. The hostgroup tag have to be composed of alphanumeric characters, a touch (“-“), a interval (“.”), or an underscore (“_”). Non-blank strains following the
first hostgroup line are interpreted as extra hostnames. The hostgroup definition ends with a clean line. For instance:

hostgroup servers nameserver smtpserver nntpserver
    nfsserver httpserver smbserver
hostgroup router_group cisco7000 agsplus

View Entries

View entries start with the key phrase view, and are adopted by a view tag and the
names of a number of hostgroups. The view tag have to be composed of alphanumeric characters, a touch (“-“), a interval (“.”), or an underscore (“_”). Non-blank
strains following the primary view line are interpreted as extra hostgroup names. The view definition ends with a clean line. For instance:

view servers dns-servers web-servers file-servers
view network-services routers switches vpn-servers

Watch Group Entries

Watch entries start with a line that begins with the key phrase watch, adopted by whitespace and a single phrase which usually refers to a pre-defined
hostgroup. If the second phrase is just not acknowledged as a hostgroup tag, a brand new hostgroup is created whose tag is that phrase, and that phrase is its solely member.

Watch entries encompass a number of service definitions.

A watch group is terminated by a clean line, the tip of the file, or by a subsequent definition, “watch”, “hostgroup”, or in any other case.

There could also be a particular watch group entry referred to as “default”. If a default watch group is outlined with a service entry named “default”, then this definition
might be utilized in dealing with traps acquired for an unrecognized watch and repair.

See also  IPvanish VPN Free Premium Accounts 2021 •

Service Definitions

Leave a Reply

Your email address will not be published.