#!/bin/bash # KNEL LibreNMS Agent Module # Deploys and configures LibreNMS monitoring agent set -euo pipefail echo "Running LibreNMS agent module..." # Check if this is a LibreNMS server if [[ $LIBRENMS_CHECK -eq 1 ]]; then echo "This is a LibreNMS server, skipping agent setup" exit 0 fi # Deploy LibreNMS agent configuration if [[ -f ./configs/librenms-agent.conf ]]; then # Create agent directory if needed mkdir -p /etc/librenms-agent # Copy agent configuration cp ./configs/librenms-agent.conf /etc/librenms-agent/ # Start the agent service if available if systemctl list-unit-files | grep -q librenms-agent; then systemctl enable librenms-agent systemctl restart librenms-agent fi fi echo "LibreNMS agent module completed"