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/plugins
on 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).
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
String. The password of the |
unset |
|
String. The address of the Icinga2 master API. This is required to schedule a downtime for Windows hosts. |
unset |
|
String. The Icinga2 API user. This is required to schedule a downtime for Windows hosts. Therefore, it needs to have the following permissions: |
unset |
|
String. The common name / host name. Will be used to schedule a downtime for Windows hosts. |
|
|
String. The user running the Monitoring Plugins. The role installs the pip packages from the requirements.yml for this user. Only relevant if |
|
|
String. Which variant 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 |
|
|
String. Which version 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__icinga2_cn: 'windows1.example.com'
monitoring_plugins__icinga_user: 'icinga'
monitoring_plugins__install_method: 'source'
monitoring_plugins__skip_notification_plugins__host_var: true
monitoring_plugins__skip_package_versionlock: false
monitoring_plugins__version: 'stable'
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'
.