Ansible Role monitoring_plugins
This role deploys the Linuxfabik Monitoring Plugins /usr/lib64/nagios/plugins/
, allowing them to be easily executed by a monitoring system.
There are three possible installation methods:
Linux only: Using the package manager (
monitoring_plugins__linux_variant == 'package'
):
This is the preferred variant for Linux, as the packages provide the plugins compiled, with batteries (libraries) included.
This means that Python does not have to be installed on the host.
Requires the repository to be set up on the server (see Mandatory Requirements below).
The role always installs the latest available package from the repository.
And (by default) enables version lock / version pinning for the installed package. This prevents automatic updates from causing inconsistencies between the installed plugins and the configuration of the monitoring system (e.g. outdated Icinga Director configuration). Updating plugins should be done in a controlled manner along with updating the monitoring server configuration. See
monitoring_plugins__skip_package_versionlock
for details.
Windows only: Deployment of the Nuitka-compiled plugins (
monitoring_plugins__windows_variant == 'nuitka'
):
This is the preferred variant for Windows, as the packages provide the plugins compiled, with batteries (libraries) included.
This means that Python does not have to be installed on the host.
By deploying the python source code from GitHub (
monitoring_plugins__linux_variant == 'python'
/monitoring_plugins__windows_variant == 'python'
):
This method should only be used if there is no package available, or for development / troubleshooting purposes.
Deploys the version given in
monitoring_plugins__repo_version
.Also deploys the Linuxfabrik Plugin Library as python source code.
Additionally, this role allows you to deploy custom plugins which are placed under {{ inventory_dir }}/host_files/{{ inventory_hostname }}/usr/lib64/nagios/plugins
on the Ansible control node.
Windows only: Since you cannot change files that are currently used by a process in Windows, when running against a Windows host, this role first stops the Icinga2 service, deploys the plugins and starts the service again. Optionally, it sets a downtime for each host. Have a look at the optional role variables below for this.
Mandatory Requirements
Either:
Deploy the Repository for the Monitoring Plugins. This can be done using the linuxfabrik.lfops.repo_monitoring_plugins role.
or:
Install Python 3 and any further requirements from INSTALL.
Optional Requirements
Round about 20 check plugins require the 3rd party psutil library. On RHEL-compatible systems, enable the EPEL repository (for example by using the linuxfabrik.lfops.repo_epel role), then install
python3-psutil
.Look at the individual requirements of each check in its README file on GitHub or on docs.linuxfabrik.ch to identify any dependencies on additional third-party libraries.
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
The password of the |
unset |
|
The address of the Icinga2 master API. This is required to schedule a downtime for Windows hosts. |
unset |
|
The Icinga2 API user. This is required to schedule a downtime for Windows hosts. Therefore, it needs to have the following permissions: |
unset |
|
String. Linux only. Which variant of the monitoring plugins should be deployed? Possible options:
|
|
|
Overwrite the automatically generated list of monitoring plugins that should be deployed. Note: This does not work for the compiled Nuitka plugins, (as they are all packaged in a single zip-file), nor with the RPM / DEB packages. |
unset |
|
String. Linux only: Which version of the monitoring plugins should be deployed? Possible options: |
|
|
Skips the deployment of the notification-plugins (in addition to the check-plugins). For the usage in |
|
|
By default, the version of the |
|
|
Windows only. Which variant of the monitoring plugins should be deployed? Possible options: |
|
Example:
# optional
monitoring_plugins__icinga2_api_password: 'linuxfabrik'
monitoring_plugins__icinga2_api_url: 'https://192.0.2.3:5665/v1'
monitoring_plugins__icinga2_api_user: 'downtime-api-user'
monitoring_plugins__linux_variant: 'python'
monitoring_plugins__plugin_list:
- 'about-me'
- 'cpu-usage'
monitoring_plugins__repo_version: 'latest'
monitoring_plugins__skip_notification_plugins__host_var: true
monitoring_plugins__windows_variant: 'nuitka'
Troubleshooting
If you get No package linuxfabrik-monitoring-plugins-main available. msg: Failed to install some of the specified packages
while setting monitoring_plugins__repo_version: 'main'
, you simply forgot to also set monitoring_plugins__linux_variant: 'python'
.