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:

  1. 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.

  1. 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.

  1. 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:

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.

Tags

Tag

What it does

monitoring_plugins

Deploys the monitoring plugins, including the Linuxfabrik Plugin Library and custom plugins

monitoring_plugins:custom

Only deploys the custom plugins

Optional Role Variables

Variable

Description

Default Value

monitoring_plugins__icinga2_api_password

The password of the monitoring_plugins__icinga2_api_user. This is required to schedule a downtime for Windows hosts.

unset

monitoring_plugins__icinga2_api_url

The address of the Icinga2 master API. This is required to schedule a downtime for Windows hosts.

unset

monitoring_plugins__icinga2_api_user

The Icinga2 API user. This is required to schedule a downtime for Windows hosts. Therefore, it needs to have the following permissions: permissions = [ "actions/schedule-downtime", "actions/remove-downtime" ]

unset

monitoring_plugins__linux_variant

String. Linux only. Which variant of the monitoring plugins should be deployed? Possible options:

  • package: Deploy the packages with the checks compiled by pyinstaller. This does not require Python on the system.
  • python: Deploy the plugins as source code. This requires Python to be installed.

'package'

monitoring_plugins__plugin_list

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

monitoring_plugins__repo_version

String. Linux only: Which version of the monitoring plugins should be deployed? Possible options:

  • latest: The latest stable release. See the Releases.
  • main: The development version. Use with care.
  • A specific release, for example 2022030201. See the Releases.

'{{ lfops__monitoring_plugins_version | default("latest") }}'

monitoring_plugins__skip_notification_plugins__host_var / monitoring_plugins__skip_notification_plugins__group_var

Skips the deployment of the notification-plugins (in addition to the check-plugins). For the usage in host_vars / group_vars (can only be used in one group at a time).

true

monitoring_plugins__skip_package_versionlock

By default, the version of the linuxfabrik-monitoring-plugins (and linuxfabrik-notification-plugins) is locked after installation. Setting this to true skips this step (and never unlocks the version pinning again).

false

monitoring_plugins__windows_variant

Windows only. Which variant of the monitoring plugins should be deployed? Possible options:
* nuitka: Deploy the nuitka-compiled checks (EXE files). This does not require Python on the system.
* python: Deploy the plain Python plugins. This requires Python to be installed on Windows.

'nuitka'

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'.

License

The Unlicense

Author Information

Linuxfabrik GmbH, Zurich