Deploy System Monitoring
This role deploys comprehensive system monitoring infrastructure including NRPE (Nagios Remote Plugin Executor), custom monitoring scripts, and Centreon plugins.
Overview
This role deploys comprehensive system monitoring infrastructure including NRPE (Nagios Remote Plugin Executor), custom monitoring scripts, and Centreon plugins. It handles host-specific configurations for Docker containers, Proxmox hypervisor, OPNsense firewall, and Centreon monitoring server. The role installs packages, deploys custom check scripts, configures NRPE daemon with appropriate permissions, and sets up service integrations like Centreon Apache HTTPS and Proxmox PBS storage scheduling.
What This Role Does
For All Monitored Hosts
- Installs monitoring packages (NRPE, Nagios plugins)
- Configures NRPE to bind to VLAN12 IP
- Sets allowed_hosts to permit Centreon server
- Creates
/etc/nrpe.d/directory for host-specific commands - Deploys custom monitoring scripts to appropriate directories
- Enables and starts NRPE service
For Docker Host
- Installs RedHat packages (nrpe, nagios-plugins, cpanminus)
- Deploys
check_docker.pyscript to/usr/lib64/nagios/plugins/ - Deploys Docker NRPE commands configuration to
/etc/nrpe.d/docker_commands.cfg - Adds nrpe user to docker group for container access
- Restarts NRPE service to apply changes
Docker NRPE Commands:
check_docker_containers: Check container statuscheck_docker_uptime: Check container uptime
For Proxmox Host
- Installs Debian packages (monitoring-plugins, nagios-nrpe-server, cpanminus)
- Installs Perl modules (Config::Tiny) via cpanm
- Deploys
check_temp.shscript to/usr/lib/nagios/plugins/ - Deploys
check_smart.plscript to/usr/lib/nagios/plugins/ - Deploys Proxmox NRPE commands configuration to
/etc/nrpe.d/proxmox_commands.cfg - Configures sudoers for nagios user to run
smartctlwithout password - Creates PBS enable/disable scripts and cron schedules
- Restarts NRPE service to apply changes
Proxmox NRPE Commands:
check_cpu_temp: Monitor CPU temperaturecheck_smart_sda: Check SMART health for /dev/sdacheck_smart_sdb: Check SMART health for /dev/sdbcheck_smart_sdc: Check SMART health for /dev/sdc
For Centreon Server
- Installs Centreon NRPE plugin (centreon-nrpe3-plugin)
- Deploys Centreon custom scripts to
/usr/lib/centreon/plugins/ - Configures Apache for HTTPS with SSL certificates
- Configures PHP settings (session, memory, time limits, CA certificate)
- Disables Apache autoindex module (security)
- Restarts httpd and php-fpm services
For OPNsense Firewall
- Deploys custom monitoring scripts to
/usr/local/libexec/nagios/
Note: OPNsense uses built-in NRPE, role only deploys scripts.
Role Variables
| Variable | Description |
|---|---|
deploy_system_monitoring_centreon_ip | Centreon server IP for NRPE allowed_hosts |
deploy_system_monitoring_docker_uptime_warning | Container uptime warning threshold (seconds) |
deploy_system_monitoring_docker_uptime_critical | Container uptime critical threshold (seconds) |
deploy_system_monitoring_proxmox_cpu_temp_warning | CPU temperature warning (°C) |
deploy_system_monitoring_proxmox_cpu_temp_critical | CPU temperature critical (°C) |
deploy_system_monitoring_proxmox_cpu_sensor | CPU sensor identifier |
deploy_system_monitoring_proxmox_smart_disks | Disks for SMART monitoring (device + interface) |
deploy_system_monitoring_proxmox_pbs_storage_name | PBS storage name in Proxmox |
deploy_system_monitoring_proxmox_pbs_enable_hour | Hour to enable PBS storage |
deploy_system_monitoring_proxmox_pbs_enable_minute | Minute to enable PBS storage |
deploy_system_monitoring_proxmox_pbs_disable_hour | Hour to disable PBS storage |
deploy_system_monitoring_proxmox_pbs_disable_minute | Minute to disable PBS storage |
deploy_system_monitoring_centreon_ssl_cert_path | Centreon SSL certificate path |
deploy_system_monitoring_centreon_ssl_key_path | Centreon SSL key path |
Notes
- Role auto-detects host type from inventory groups and applies appropriate configuration
- NRPE binds to the VLAN12 IP address for Centreon communication on port 5666
- Proxmox hosts require
lm-sensorsandsmartmontools(installed by the role) - PBS scheduling creates cron jobs to enable/disable storage during and outside of backup windows