2024-07-19 22:01:34 +02:00
|
|
|
gomonop - Various monitoring plugins in golang
|
|
|
|
==============================================
|
2021-02-19 19:28:25 +01:00
|
|
|
|
2024-07-19 22:01:34 +02:00
|
|
|
This project is a collection of various monitoring plugins (such as Nagios,
|
|
|
|
Centreon, or Icinga) written in golang. All plugins are available through a
|
|
|
|
single executable, `gomonop`. The actual plugin can be selected either
|
|
|
|
by creating a symlink to the main executable with the appropriate name or by
|
|
|
|
calling the executable directly with the first argument being the name of the
|
|
|
|
plugin.
|
2021-02-19 19:28:25 +01:00
|
|
|
|
2024-07-19 22:01:34 +02:00
|
|
|
This project is distributed under the terms of the [GPLv3 license](LICENSE).
|
|
|
|
Its source code is available on the [Nocternity forge](https://git.nocternity.net/projects/gomonop).
|
2021-02-19 19:28:25 +01:00
|
|
|
|
|
|
|
Plugins
|
|
|
|
--------
|
|
|
|
|
|
|
|
### SSL certificate expiry
|
|
|
|
|
|
|
|
The `check_ssl_certificate` plugin can be used to check that the certificate
|
|
|
|
from a TLS service has not expired and is not going to expire shortly. It
|
|
|
|
supports the following command-line flags:
|
|
|
|
|
|
|
|
* `-H name`/`--hostname name`: the host name to connect to.
|
|
|
|
* `-P port`/`--port port`: the TCP port to connect to.
|
|
|
|
* `-W days`/`--warning days`: a threshold, in days, below which a warning will
|
|
|
|
be emitted for this service.
|
|
|
|
* `-C days`/`--critical days`: a threshold, in days, below which the plugin will
|
|
|
|
indicate that the service is in a critical state.
|
|
|
|
* `--ignore-cn-only`: do not cause errors if a certificate does not have SANs
|
|
|
|
and relies on the CN field.
|
|
|
|
* `-a names`/`--additional-names names`: a comma-separated list of DNS names
|
|
|
|
that the certificate should also have.
|
|
|
|
* `-s protocol`/`--start-tls protocol`: protocol to use before requesting a
|
2021-02-27 11:33:28 +01:00
|
|
|
switch to TLS. Supported protocols: `smtp`, `sieve`.
|
|
|
|
|
2023-11-02 10:24:00 +01:00
|
|
|
### DNS zone serials
|
2021-02-27 11:33:28 +01:00
|
|
|
|
2024-07-20 22:51:53 +02:00
|
|
|
The `check_zone_serial` plugin can be used to check that the version of a
|
|
|
|
zone served by a DNS is up-to-date compared to the same zone served by
|
|
|
|
another, "reference" DNS. It supports the following command-line flags:
|
2021-02-27 11:33:28 +01:00
|
|
|
|
|
|
|
* `-H name`/`--hostname name`: the host name or address of the server to
|
|
|
|
check.
|
|
|
|
* `-P port`/`--port port`: the port to use on the server to check (defaults
|
|
|
|
to 53).
|
|
|
|
* `-z zone`: the zone to check.
|
|
|
|
* `-r name`/`--rs-hostname name`: the host name or address of the reference
|
|
|
|
server.
|
|
|
|
* `-p port`/`--rs-port port`: the port to use on the reference server
|
2024-07-19 22:01:34 +02:00
|
|
|
(defaults to 53).
|
|
|
|
|
2024-07-20 22:51:53 +02:00
|
|
|
### Generic text match counter
|
|
|
|
|
|
|
|
The `check_output_matches` plugin can be used to count occurrences of strings
|
|
|
|
in a program's output or in a text file, and compute its final status based on
|
|
|
|
that.
|
|
|
|
|
|
|
|
It supports the following general command line flags:
|
|
|
|
|
|
|
|
* `-f` / `--is-file` indicates that the plugin will be reading from a text file
|
|
|
|
instead of running another program;
|
|
|
|
* `-s` / `--source` is either the name of the file to read, or the command to
|
|
|
|
execute. The command may include multiple arguments separated by single
|
|
|
|
spaces; it does not support any form of quoting.
|
|
|
|
* `-T` / `--timeout` can set a timeout for the command. It is disabled by
|
|
|
|
default.
|
|
|
|
* `-S` / `--strict` determines how unmatched lines are handled. By default they
|
|
|
|
are ignored, but setting this flag will cause the plugin to enter `CRITICAL`
|
|
|
|
mode if unmatched lines are found.
|
|
|
|
|
|
|
|
Other flags are available in order to configure the matches. The main flag is
|
|
|
|
`-m` / `--match`, which adds a new match string to the set of checks to run.
|
|
|
|
The checks are influenced by the following additional flags, which apply to all
|
|
|
|
subsequent matches.
|
|
|
|
|
|
|
|
* `-r` / `--regexp` indicates that new matches will be based on regular
|
|
|
|
expressions instead of substrings.
|
|
|
|
* `-R` / `--no-regexp` switches back to substring-based matches.
|
|
|
|
* `-w` / `--warn` can be used to set a warning range. It must be followed by
|
|
|
|
a Nagios range specification.
|
|
|
|
* `-W` / `--no-warn` clears the warning range.
|
|
|
|
* `-c` / `--critical` can be used to set the critical range. It must be followed
|
|
|
|
by a Nagios range specification.
|
|
|
|
* `-C` / `--no-critical` clears the critical range.
|
|
|
|
|
|
|
|
For example, the command below:
|
|
|
|
|
|
|
|
gomonop check_output_matches -s 'find /some/place' \
|
|
|
|
-w 4 -r -m '^.*\.warn$' \
|
|
|
|
-W -c 0 -R -m fatal
|
|
|
|
|
|
|
|
configures a warning if more than 4 files ending in `.warn` are found, and a
|
|
|
|
critical state if any file with `fatal` in its name is found.
|
2024-07-19 22:01:34 +02:00
|
|
|
|
|
|
|
Building from source
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
The plugin can be built for the current host OS and architecture using
|
|
|
|
`make build`. The actual executable will be created under the `bin` directory,
|
|
|
|
in a subdirectory named after the host OS and architecture (e.g.
|
|
|
|
`bin/linux-amd64`). The executable will be named `gomonop`, and a
|
|
|
|
symlink to the executable for the host OS and architecture will be created
|
|
|
|
under the `bin` directory.
|
|
|
|
|
|
|
|
It is possible to build for other architectures using `make build-cross`.
|