Ansible Role monitoring_plugins¶
This role deploys the Linuxfabik Monitoring Plugins, allowing them to be easily executed by a monitoring system.
Notes:
Best practice is to put the affected hosts into downtime or disable them in Icinga before applying this role. This role can do that for you.
This role allows you to deploy custom plugins which are placed under
{{ inventory_dir }}/host_files/{{ inventory_hostname }}/usr/lib64/nagios/pluginson the Ansible control node.
Installation Methods¶
Taken from the Linuxfabrik Monitoring Plugins INSTALL document:
Platform |
Install |
Implemented by |
Mandatory Requirements |
|---|---|---|---|
Linux |
Binaries from rpm/deb package (default) |
|
Deploy the Repository for the Monitoring Plugins. This can be done using the linuxfabrik.lfops.repo_monitoring_plugins role. If you use the monitoring_plugins Playbook, this is automatically done for you. |
Linux |
Binaries from zip |
Currently not supported by this role |
|
Linux |
Source Code |
|
Ensure that Python 3.9+ including associated pip is installed and activated by default. On Debian 12, a virtual environment is mandatory. |
Windows |
Binaries from msi (default) |
|
Icinga2 Agent is required. |
Windows |
Binaries from zip |
|
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. |
Windows |
Source Code |
Currently not supported by this role |
Mandatory Requirements¶
See table above (depends on the use case).
Mandatory Role Variables¶
monitoring_plugins__version
Which version of the monitoring plugins should be deployed? Possible options:
A specific release, for example
2.2.1. See the Releases.dev: The development version (main branch). Use with care. Only works withmonitoring_plugins__install_method: 'source'.
Defaults to
lfops__monitoring_plugins_versionfor convenience.Type: String.
Example:
# mandatory
monitoring_plugins__version: '2.2.1'
Optional Role Variables¶
monitoring_plugins__icinga2_api_password
The password of the
monitoring_plugins__icinga2_api_user. This is required to schedule a downtime for Windows hosts.Type: String.
Default: unset
monitoring_plugins__icinga2_api_url
The address of the Icinga2 master API. This is required to schedule a downtime for Windows hosts.
Type: String.
Default: 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" ]Type: String.
Default: unset
monitoring_plugins__icinga2_cn
The common name / host name. Will be used to schedule a downtime for Windows hosts.
Type: String.
Default:
'{{ ansible_facts["nodename"] }}'
monitoring_plugins__icinga_user
The user running the Monitoring Plugins. The role installs the pip packages from the requirements.yml for this user. Only relevant if
monitoring_plugins__install_method: 'source'.Type: String.
Default:
'icinga'on RHEL,'nagios'on Debian
monitoring_plugins__install_method
Which variant of the monitoring plugins should be deployed? Possible options:
package: Deploy the install package with the compiled checks. This does not require Python on the system.source: Deploy the plugins as source code. This requires Python to be installed. Currently for Linux only.archive: Deploy the compiled binaries from a zip file downloaded from download.linuxfabrik.ch. Currently for Windows only.
Type: String.
Default:
'package'
monitoring_plugins__skip_package_versionlock
By default, the version of the
linuxfabrik-monitoring-pluginsare locked after installation. Setting this totrueskips this step (and never unlocks the version pinning again).Type: Bool.
Default:
false
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__icinga2_cn: 'windows1.example.com'
monitoring_plugins__icinga_user: 'icinga'
monitoring_plugins__install_method: 'source'
monitoring_plugins__skip_package_versionlock: false
Troubleshooting¶
If you get No package linuxfabrik-monitoring-plugins-main available. msg: Failed to install some of the specified packages while setting monitoring_plugins__version: 'dev', you simply forgot to also set monitoring_plugins__install_method: 'source'.