feat(oam): add LibreNMS agent deployment

Implement comprehensive check_mk agent deployment for LibreNMS monitoring:

- Create agent directory structure (/usr/lib/check_mk_agent/plugins, local, etc.)
- Deploy main check_mk_agent binary to /usr/bin
- Deploy distro script for OS detection
- Install systemd socket activation (check_mk.socket, check_mk@.service)
- Deploy monitoring plugins (smart, ntp-client, ntp-server, os-updates, postfix)
- Configure and enable check_mk socket for immediate monitoring

This enables centralised infrastructure monitoring through LibreNMS with
hardware health, NTP synchronisation, and mail queue visibility.

🤖 Generated with [Crush](https://github.com/charmassociates/crush)

Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
Charles N Wyble
2026-02-17 17:06:20 -05:00
parent ee9f391951
commit be474d4a75

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# KNEL OAM Initializer
# Sets up Operations and Maintenance tools
# Sets up Operations and Maintenance tools including LibreNMS monitoring agents
set -euo pipefail
@@ -13,4 +13,64 @@ if [[ -f ./scripts/up2date.sh ]]; then
chmod +x /usr/local/bin/up2date.sh
fi
# Deploy LibreNMS check_mk agent
if [[ -f ./librenms/check_mk_agent ]]; then
# Create agent directories
mkdir -p /usr/lib/check_mk_agent/plugins
mkdir -p /usr/lib/check_mk_agent/local
mkdir -p /etc/check_mk
mkdir -p /var/lib/check_mk_agent
# Deploy main agent
cp ./librenms/check_mk_agent /usr/bin/check_mk_agent
chmod +x /usr/bin/check_mk_agent
# Deploy distro script for OS detection
if [[ -f ./librenms/distro ]]; then
cp ./librenms/distro /usr/bin/distro
chmod +x /usr/bin/distro
fi
# Deploy systemd service files
if [[ -f ./librenms/check_mk.socket ]]; then
cp ./librenms/check_mk.socket /etc/systemd/system/check_mk.socket
fi
if [[ -f ./librenms/check_mk@.service ]]; then
cp ./librenms/check_mk@.service /etc/systemd/system/check_mk@.service
fi
# Deploy plugins
for plugin in ./librenms/*.sh ./librenms/*.py; do
if [[ -f "$plugin" ]]; then
plugin_name=$(basename "$plugin")
cp "$plugin" /usr/lib/check_mk_agent/plugins/
chmod +x "/usr/lib/check_mk_agent/plugins/$plugin_name"
fi
done
# Deploy other plugins (without extensions)
for plugin in ./librenms/smart ./librenms/ntp-client ./librenms/ntp-server.sh \
./librenms/os-updates.sh ./librenms/postfix-queues ./librenms/postfixdetailed \
./librenms/ups-nut.sh; do
if [[ -f "$plugin" ]]; then
plugin_name=$(basename "$plugin")
cp "$plugin" /usr/lib/check_mk_agent/plugins/
chmod +x "/usr/lib/check_mk_agent/plugins/$plugin_name"
fi
done
# Deploy smart config if present
if [[ -f ./librenms/smart.config ]]; then
cp ./librenms/smart.config /etc/check_mk/smart.config
fi
# Reload systemd and enable check_mk socket
systemctl daemon-reload
systemctl enable check_mk.socket
systemctl start check_mk.socket
echo "LibreNMS agent deployed and enabled"
fi
echo "OAM initializer completed"