Port the live LibreNMS monitoring patterns from the legacy
KNELServerBuild repo into oam/librenms-agent/, joining the existing
OAM tooling (oxidized, unpoller, smokeping, netdisco):
- agent/ — upstream check_mk agent + snmp-extend scripts (dmi, dpkg,
mysql, ntp-client, ntp-server, os-updates, postfix, raspberry, smart,
ss, ups-nut), copied verbatim (md5-verified), never to be edited here
- setup.sh — deploy module ported from ProjectCode/Modules/OAM/
oam-librenms.sh; only the legacy framework bootstrap was replaced
with plain bash (path constants + print_info -> echo)
- snmp-sudo.conf — Debian snmpd sudo rule the extends require
(Debian-snmp NOPASSWD /bin/cat); carried as a file only, sudoers
install is a policy decision per AGENTS.md
Lint gates: extend the existing upstream-skip mechanism for the
verbatim agent scripts (tests/shellcheck.sh + check-rules.sh prune,
same precedent as archive/provisioning/Agents/librenms), and fix the
stale skip path there (provisioning/ moved to archive/provisioning in
6244c1c; the bash extends have been failing the whole-repo shellcheck
gate since).
💘 Generated with Crush
Assisted-by: Crush:glm-5.2
43 lines
1.9 KiB
Bash
43 lines
1.9 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# Deploy the LibreNMS check_mk agent on a monitored host.
|
|
# Ported from KNELServerBuild ProjectCode/Modules/OAM/oam-librenms.sh [#474].
|
|
# Upstream agent scripts live in ./agent/ (kept verbatim, do not edit).
|
|
# snmpd sudo rules for the extends live in ./snmp-sudo.conf (install via
|
|
# sudoers policy separately — see AGENTS.md security-change rules).
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
AGENTS_PATH="$SCRIPT_DIR/agent"
|
|
|
|
echo "Setting up librenms agent..."
|
|
|
|
cat "$AGENTS_PATH/distro" > /usr/local/bin/distro
|
|
chmod +x /usr/local/bin/distro
|
|
|
|
mkdir -p /usr/lib/check_mk_agent/plugins
|
|
mkdir -p /usr/lib/check_mk_agent/local
|
|
|
|
cat "$AGENTS_PATH/check_mk_agent" > /usr/bin/check_mk_agent
|
|
chmod +x /usr/bin/check_mk_agent
|
|
|
|
cat "$AGENTS_PATH/check_mk@.service" > /etc/systemd/system/check_mk@.service
|
|
cat "$AGENTS_PATH/check_mk.socket" > /etc/systemd/system/check_mk.socket
|
|
|
|
systemctl enable check_mk.socket
|
|
systemctl start check_mk.socket
|
|
|
|
#Modules commented out below, we will roll out on systems that use them, most of the fleet doesn't use those modules
|
|
|
|
cat "$AGENTS_PATH/dmi.sh" > /usr/lib/check_mk_agent/local/dmi.sh
|
|
cat "$AGENTS_PATH/dpkg.sh" > /usr/lib/check_mk_agent/local/dpkg.sh
|
|
#cat "$AGENTS_PATH/mysql.sh" > /usr/lib/check_mk_agent/local/mysql.sh
|
|
cat "$AGENTS_PATH/ntp-client" > /usr/lib/check_mk_agent/local/ntp-client
|
|
#cat "$AGENTS_PATH/ntp-server.sh" > /usr/lib/check_mk_agent/local/ntp-server.sh
|
|
cat "$AGENTS_PATH/os-updates.sh" > /usr/lib/check_mk_agent/local/os-updates.sh
|
|
cat "$AGENTS_PATH/postfixdetailed" > /usr/lib/check_mk_agent/local/postfixdetailed
|
|
cat "$AGENTS_PATH/postfix-queues" > /usr/lib/check_mk_agent/local/postfix-queues
|
|
#cat "$AGENTS_PATH/smart.sh" > /usr/lib/check_mk_agent/local/smart
|
|
#cat "$AGENTS_PATH/smart.sh.config" > /usr/lib/check_mk_agent/local/smart.config
|
|
|
|
chmod +x /usr/lib/check_mk_agent/local/*
|