Monitor your devices with LibreNMS on FreeBSD

A guide on how to set up LibreNMS inside a FreeBSD jail.

https://it-notes.dragas.net/2026/05/07/monitor-your-services-with-librenms-on-freebsd/

#ITNotes #FreeBSD #Monitoring #Server #OwnYourData #Alerting #IT #SysAdmin #LibreNMS

Monitor your devices with LibreNMS on FreeBSD

A guide on how to set up LibreNMS inside a FreeBSD jail.

IT Notes
Monitor your devices with LibreNMS on FreeBSD

LibreNMS (https://www.librenms.org) has been a faithful companion for years now. It quietly handles the monitoring of my servers, devices, and services without demanding much in return - exactly what you want from a tool whose job is to watch over everything else. It's a solid alternative to heavier solutions like Zabbix, and it gives you alerts, data, and graphs on virtually anything reachable over SNMP.

I usually install it on a host that is not reachable from the outside, then let it poll all the devices through a VPN: a single observation point, clean perimeter. The ability to create multiple dashboards - and to filter them by user - has also let me give clients a transparent window onto their own servers. Transparency, in my experience, is always the better long-term bet.

Together with Uptime-Kuma (https://it-notes.dragas.net/2024/07/22/install-uptime-kuma-freebsd-jail/) (and the good old Nagios/Munin pair), LibreNMS lives in a FreeBSD jail on my monitoring servers and just does its job.

This post walks through a plain installation of LibreNMS on FreeBSD: package-based, no reverse proxy, no HTTPS, no fancy hardening. The goal is to get to a working setup you can build on top of.

Assumptions

  • FreeBSD 15.0-RELEASE, in a jail or on a dedicated VM/host
  • nginx + php-fpm + MySQL 8.4
  • LibreNMS installed from the official package — not via git clone
One note before we start: in this guide I use plain HTTP just to reach the first-time setup. If your LibreNMS instance won't stay confined to a private network or behind a VPN, configuring HTTPS is mandatory, not optional.

Installation

pkg install librenms mysql84-server python3 nginx
LibreNMS currently depends on PHP 8.4. If you want to speed PHP up, install OPcache too:

pkg install php84-opcache

MySQL

Two settings need to be in place before MySQL starts for the first time. After the first start they cannot be changed without reinitializing the data directory, so it's worth getting them right now.

cd /usr/local/etc/mysql
cp my.cnf.sample my.cnf
In the [mysqld] section, add:

innodb_file_per_table=1
lower_case_table_names=0
Now start MySQL:

service mysql-server enable
service mysql-server start
On a fresh FreeBSD install, the local root user can connect to MySQL without a password from the command line. Connect and create the database and user. I'm using password here as a placeholder - don't.

mysql
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
exit

php-fpm

Edit /usr/local/etc/php-fpm.d/www.conf and adjust the listen directives:

listen = /var/run/php-fpm-librenms.sock
listen.owner = www
listen.group = www
listen.mode = 0660
Then create php.ini from the production sample:

cd /usr/local/etc
cp php.ini-production php.ini
And set the timezone in php.ini:

date.timezone = Europe/Rome

nginx

Since this jail (or host) is dedicated to LibreNMS, we can rewrite the server block in /usr/local/etc/nginx/nginx.conf directly:

server {
listen 80;
#server_name yourServerName
root /usr/local/www/librenms/html;
index index.php;

charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location /api/v0 {
try_files $uri $uri/ /api_v0.php?$query_string;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SERVER_SOFTWARE "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php-fpm-librenms.sock;
fastcgi_buffers 256 4k;
fastcgi_intercept_errors on;
fastcgi_read_timeout 14400;
}

location ~ /\.(?!well-known).* {
deny all;
}
}
Now start nginx and php-fpm:

service nginx enable
service nginx start

service php_fpm enable
service php_fpm start

LibreNMS configuration

Copy the default config:

cp /usr/local/www/librenms/config.php.default /usr/local/www/librenms/config.php
Because we installed from the package, this file already has the right commands and paths for FreeBSD - no need to hunt down mtr, fping, snmpwalk and friends one by one.

Create the directory for RRD graphs and set ownership:

mkdir -p /var/db/librenms/rrd
chown -R www:www /var/db/librenms
chmod 775 /var/db/librenms/rrd
Then the .env file:

cd /usr/local/www/librenms
cp .env.example .env
chown www .env
Edit .env and set at least:

  • DB_DATABASE - librenms
  • DB_USERNAME - librenms
  • DB_PASSWORD - the one you actually used (not password, please)
Then add this line, which tells LibreNMS we still need to run the web installer:

INSTALL=true
A note on permissions. The official LibreNMS documentation suggests chown -R www:www over the entire application tree, but on FreeBSD the package already lays down sane ownership, with storage/ and bootstrap/cache/ writable by www. There's no reason to widen the rest of the codebase. If validate.php complains later about something write-related, the first place to check is:

ls -la /usr/local/www/librenms/storage /usr/local/www/librenms/bootstrap/cache
Now generate the app key as www, since the file is owned by www:

su -m www -c "php artisan key:generate"
And tighten .env:

chmod 600 .env
Refresh the configuration cache:

su -m www -c "lnms config:clear"
su -m www -c "lnms config:cache"

Web installer

Open http://host/install and follow the steps. The validation process may fail. Refreshing the cache picks up the values written to config.php during the install:

su -m www -c "lnms config:clear"
su -m www -c "lnms config:cache"
When the web installer is done, edit .env again and remove the INSTALL=true line if it's still there. Leaving it in place re-exposes the installer to anyone who can reach the URL.

Polling service

LibreNMS needs something to actually run the polls. On FreeBSD, the package ships an rc service that runs the LibreNMS dispatcher, so there's no need to manage cron entries by hand the way most Linux guides assume.

service librenms enable
service librenms start

Validate

cd /usr/local/www/librenms
su -m www -c './validate.php'
You may see a couple of complaints right after starting the service - usually scheduler-related and self-resolving within a few minutes. Re-run validate.php once the dispatcher has had time to settle. Anything still red after that is worth investigating.

Next steps

At this point you can log into the web interface and start adding devices, configuring SNMP, and building dashboards. For that, the official LibreNMS documentation (https://docs.librenms.org/) is excellent, and there's no point in me paraphrasing it here.

https://it-notes.dragas.net/2026/05/07/monitor-your-services-with-librenms-on-freebsd/

#ITNotes #NoteHUB #freebsd #hosting #jail #monitoring #networking #ownyourdata #security #server #tutorial
LibreNMS

LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.

LibreNMS

Repost to celebrate the 0.40.0 release:

Launching BSSG - My Journey from Dynamic CMS to Bash Static Site Generator

Announcing the public release of BSSG, a Bash Static Site Generator born from a personal journey away from complex dynamic CMS. Discover a simple, portable alternative for your blog.

https://it-notes.dragas.net/2025/04/07/launching-bssg-my-journey-from-dynamic-cms-to-bash-static-site-generator/

#BSSG #SSG #ITNotes #StaticSite #StaticSiteGenerator

Launching BSSG - My Journey from Dynamic CMS to Bash Static Site Generator

Announcing the public release of BSSG, a Bash Static Site Generator born from a personal journey away from complex dynamic CMS. Discover a simple, portable alternative for your blog.

IT Notes

Thank you for the reaction Alan. Now I know a bit more from that part of History

@alanc @JdeBP

#freeBSD #Linux #ifconfig #ip #win64 #mac #aurum #IT #notes #ITNotes #dragas #programming #OpenSource #no #Linux #logic #analysis

Your reader, your couch, your rules.

Starting today, both my-notes.dragas.net and it-notes.dragas.net are changing the way they distribute content - on RSS and on the Fediverse alike.

No more excerpts. No more "read more" links. Full posts, delivered directly to you, wherever you choose to read them.

Here's why:
I don't run ads. I don't have paywalls. I don't sell attention, or measure success in page views. I never have, and I have no intention of starting. My blogs exist because I enjoy writing, and because
some of what I write might be useful - or simply enjoyable - to someone else.
That's the whole business model. There isn't one.

When that's the case, there's no reason to keep content behind a click.
Sending you a teaser and asking you to visit my site would only make sense if I needed you *on my site* - for an impression, for a conversion, for something. I don't. So why would I make you leave your reader, your client, your comfortable corner of the internet, just to come to mine?

What I want instead is simple: that you can read what I write the way you'd read a book on a cold winter evening, wrapped in a warm blanket. Privately.
Quietly. On your own terms, in your own space, without anything tracking your eyes or nudging you toward something else.

Your RSS reader is yours. Your Fediverse instance is yours. The content should be yours too.

If you're on the Fediverse, you can follow both accounts directly:

- my-notes → @mynotes

- it-notes → @itnotes

These are low-traffic accounts. If you don't want them to get lost in your timeline, feel free to hit the notification bell. I promise it won't make much noise.

So from now on, it will be.

#ITNotes #MyNotes #Blogging #Fediverse

EnshittifAIcation

Three episodes, one week. AI bots that hallucinate VPN requirements, recommend Apache configs on nginx servers, and suggest replacing 128 GB of RAM with a cloud VPS. A field note on the cost of mistaking confidence for competence.

https://it-notes.dragas.net/2026/03/20/enshittifaication/

#ITNotes #NoteHUB #AI #Hosting #Server #SysAdmin #IT

EnshittifAIcation

Three episodes, one week. AI bots that hallucinate VPN requirements, recommend Apache configs on nginx servers, and suggest replacing 128 GB of RAM with a cloud VPS. A field note on the cost of mistaking confidence for competence.

IT Notes
EnshittifAIcation

Three episodes, one week. AI bots that hallucinate VPN requirements, recommend Apache configs on nginx servers, and suggest replacing 128 GB of RAM with a cloud VPS. A field note on the cost of mistaking confidence for competence.

IT Notes

Why I love freeBSD

Additional data

I love FreeBSD because it doesn't rename my network interfaces after a reboot or an upgrade.

I shall dwell on what Stefano may mean as I have experienced this nightmare on the Linux path countless times

  • using the if tools ifconfig ifup ifdown route and others on a LAN local network I repeat on a LOCAL network
  • these tools were depreciated due to many issues with them, decades later (IIRC)
  • no linux distro ever told me as a user that I needed to use replacements like ip
  • I install a new version of a random distro (was on an ESR) and could not address the NIC's no iftools
  • names of the NIC's were also replaced with cumbersome cryptic names, again, no fucks given no warning, I should have read the remarks in the GNU tool sources?
  • WTF?!?

In that period I needed to enter the world of freeBSD
it was a chilibox experience with three main factors. Great docs, consistent tools logic and control governed by a central body of all, no guerilla tool changes which could disrupt server up keep flow. Just rest, ease and stability

Mind you I know BSD from before the chilibox, in fact I've played with BSD way before even Linux was in the balls of though of Torvalds

TLDR;

  • choose BSD for your servers if you need consistent OS behaviour for decades
  • choose Linux for bleeding edge changes and chances of breaking server (VMs) at regular updates
  • choose win64 for love of being tortured
  • choose mac to give away your aurum to the mac overlords
  • choose the abacus for absolute stability

#freeBSD #Linux #ifconfig #ip #win64 #mac #aurum #IT #notes #ITNotes #dragas #programming #OpenSource #no #Linux #logic #analysis

Why I Love freeBSD

freeBSD

Processing

I've only skimmed this nice post.
Thorough reading will follow later

Some highlights which resonate with me *as flageolets on a string instrument* are captured here in screenshots I've made on an Android

  • Many tools still work exactly as they did (decades ago)

  • The feeBSD handbook taught me an enormous ammount, more than many of my University courses, including things that had nothing to do with freeBSD specifically

  • This is vital

  • The handbook taught me the right approach

    understand first, act second

This is a principle I use since I've been a peuter (NL).

  • Analyze what occured
  • understand why it occured
  • find out under what circumstances it can occur
  • close or limit those conditions
  • fix the problem by repairing, cooling, modifying the break
  • analyse the proposed fix before implementing
  • Only replace when all other methods fail or repair is more expensive than replacement

Sources

https://it-notes.dragas.net/2026/03/16/why-i-love-freebsd/

#freeBSD #IT #notes #ITNotes #dragas #programming #OpenSource #no #Linux #logic #analysis

Why I love FreeBSD

A personal reflection on my first encounter with FreeBSD in 2002, how it shaped the way I design and run systems, and why its philosophy, stability, and community still matter to me more than twenty years later.

https://it-notes.dragas.net/2026/03/16/why-i-love-freebsd/

#FreeBSD #ITNotes #RunBSD #IT #SysAdmin #OS #OpenSource

Why I Love FreeBSD

A personal reflection on my first encounter with FreeBSD in 2002, how it shaped the way I design and run systems, and why its philosophy, stability, and community still matter to me more than twenty years later.

IT Notes