Build a Small Office Network Monitoring Stack with LibreNMS, Syslog, and Alert Routing
A practical setup for a small office network monitoring stack using LibreNMS for network visibility, syslog for log management, and alert routing for notifications.
Expected Outcome
A working network monitoring system that provides visibility into network performance, logs network events, and routes alerts for proactive management.
Assumptions
- Basic knowledge of Linux command line
- A server or virtual machine (VM) running Ubuntu 20.04 or later
- Access to the office network and devices to monitor
- Administrative access to the router and switches
Bill of Materials
- Ubuntu 20.04 server or VM
- LibreNMS installation files
- Syslog server (e.g., rsyslog)
- Alert routing tool (e.g., Alertmanager)
- Network devices (routers, switches, etc.)
Build Steps
- Prepare the Server
Set up your Ubuntu server with the necessary updates and dependencies.
Changes system state: review before running
sudo apt update && sudo apt upgrade -y sudo apt install software-properties-common -y sudo add-apt-repository ppa:librenms/librenms -y sudo apt update
- Install LibreNMS
Install LibreNMS and its dependencies.
Changes system state: review before running
sudo apt install libapache2-mod-php php php-mysql php-mbstring php-xml php-curl php-gd php-zip php-json php-bcmath php-xmlrpc -y sudo apt install mariadb-server mariadb-client -y sudo mysql_secure_installation sudo mysql -u root -p -e "CREATE DATABASE librenms;" sudo mysql -u root -p -e "CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'your_password';" sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';" sudo mysql -u root -p -e "FLUSH PRIVILEGES;" sudo apt install git -y cd /opt && sudo git clone https://github.com/librenms/librenms.git cd librenms && sudo chown -R www-data:www-data . && sudo chmod -R 755 .
- Configure LibreNMS
Set up the LibreNMS configuration and web interface.
Changes system state: review before running
sudo cp /opt/librenms/config.php.default /opt/librenms/config.php sudo nano /opt/librenms/config.php sudo systemctl restart apache2 sudo /opt/librenms/scripts/create_schema.php
- Install and Configure Syslog
Set up a syslog server to collect logs from network devices.
Changes system state: review before running
sudo apt install rsyslog -y sudo nano /etc/rsyslog.conf sudo systemctl restart rsyslog
- Set Up Alert Routing
Configure alert routing to manage notifications effectively.
Changes system state: review before running
sudo apt install prometheus-alertmanager -y sudo nano /etc/alertmanager/config.yml sudo systemctl restart alertmanager
- Add Devices to LibreNMS
Discover and add network devices to the LibreNMS monitoring stack.
Changes system state: review before running
/opt/librenms/addhost.php -h <device_ip> -d <device_description> sudo /opt/librenms/poller.php -h all
- Validate the Setup
Ensure that the monitoring stack is functioning correctly.
Safe to run: read-only
curl -I http://<your_librenms_url> sudo tail -f /var/log/syslog
Validation
- Check the LibreNMS web interface for device status.
- Verify that syslog is receiving logs from network devices.
- Test alert routing by simulating an alert.
Troubleshooting
- If a step fails, capture the exact command, exit code, and log line before retrying or changing the design.
- Check route tables, DNS resolution, firewall rules, and peer status from both sides of the connection.
Cleanup or Rollback
- Keep a copy of working configuration, compose files, scripts, and service credentials before removing containers, packages, or data directories.
- Export current network, DNS, VPN, and firewall settings before changing routes, peers, or resolver configuration.
- Rollback by restoring the prior route, peer, DNS, or firewall configuration and restarting only the affected service.
Next Improvements
- Explore additional features of LibreNMS such as VLAN-aware monitoring.
- Set up dashboards for visualizing network performance.
- Configure advanced alerting rules in Alertmanager.