Stumbled across this awesome system statistics utility that simply requires an executable be running on the device (or via docker) but I am not sure how to set it up on OPNsense.
Beszel - github (https://github.com/henrygd/beszel)
linux only. OPNsense is not based on linux but freeBSD so you need to ask them to provide you with an agent for freeBSD if you want to run it (presumably is what you want) on your OPN firewall.
Quote from: cookiemonster on February 04, 2025, 03:08:41 PMlinux only. OPNsense is not based on linux but freeBSD so you need to ask them to provide you with an agent for freeBSD if you want to run it (presumably is what you want) on your OPN firewall.
Not quite Partly correct:
https://github.com/henrygd/beszel/releases/tag/v0.9.1
Quotebeszel-agent_freebsd_amd64.tar.gz
Since it is written in plain Golang, it should be easy to create an official port.
EDIT: this is only the agent. The hub/UI still needs to be run on Linux.
right you are. I missed it in the quick scan of the release assets list.
Quote from: cookiemonster on February 04, 2025, 11:53:23 PMright you are. I missed it in the quick scan of the release assets list.
Any luck with this? I'd like to do this myself, wondering if you found a guide for setting it up as a service on freebsd.
I was only trying to gude the OP. Similarly for you, the asset list has what seems a binary asset, packaged in a tar.gz format. That if you are familiar with linux is a precompiled and compressed package. Inside it if it was linux there could be an rpm or deb package. You download it, decompress it and then proceed to install it with the distro (OS) usual tool. In freeBSD's case that is normally pkg. So you would do "#pkg install /path/to/uncompressed/package".
If it needs dependencies you have to resolve them of course.
Then proceed to configure it.
I don't need it/want it so haven't looked inside. These are broad strokes of what it would normally entail.
I took a peek at it, seems it's just a binary was able to extract the agent and run it. Complained that I didn't have my `KEY` environment variable set. So seems to run just fine, would just need to do some manual work to set it up as a service.
It looks like their documentation has a guide for setting it up manually on linux (you'd be looking at step 2 not step 1):
https://beszel.dev/guide/agent-installation#binary
However their guide for setting up the service is using systemd, which would not work on freebsd so you'd have to read up on setting up a freebsd service and do that instead.
I'm not sure what the implications are of copying a binary to `/bin` on opnsense, I've never had to do it before and am unsure if such things will survive updates though.
Welp I set this up today here's a write up of what I did.
1. Download beszel_agent to `/usr/local/bin`
2. Create `beszel_agent` in `/usr/local/etc/rc.d/` with the following contents:
#!/bin/sh
#
# PROVIDE: beszel_agent
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# This script starts bezel-agent at system boot.
#
. /etc/rc.subr
name="beszel_agent"
rcvar=beszel_agent_enable
command="/usr/local/bin/beszel-agent"
command_args=""
pidfile="/var/run/${name}.pid"
load_rc_config $name
: ${beszel_agent_enable:="NO"}
# Ensure required environment variables are set.
if [ -z "${beszel_agent_key}" ] || [ -z "${beszel_agent_port}" ]; then
echo "ERROR: beszel_agent_key and beszel_agent_port must be set in /etc/rc.conf.d/beszel_agent"
exit 1
fi
beszel_agent_start() {
echo "Starting beszel-agent..."
# Launch the command with the required environment variables.
env KEY="${beszel_agent_key}" PORT="${beszel_agent_port}" ${command} ${command_args} &
echo $! > ${pidfile}
}
beszel_agent_stop() {
echo "Stopping beszel-agent..."
if [ -f ${pidfile} ]; then
kill "$(cat ${pidfile})" && rm -f ${pidfile}
fi
}
beszel_agent_status() {
if [ -f "${pidfile}" ]; then
pid=$(cat "${pidfile}")
if kill -0 "${pid}" 2>/dev/null; then
echo "beszel-agent is running (pid: ${pid})."
return 0
else
echo "beszel-agent is not running (stale pid file)."
return 1
fi
else
echo "beszel-agent is not running."
return 1
fi
}
start_cmd="beszel_agent_start"
stop_cmd="beszel_agent_stop"
status_cmd="beszel_agent_status"
run_rc_command "$1"
3. Create `beszel_agent` in `/etc/rc.conf.d/` with the following contents:
beszel_agent_enable="YES"
beszel_agent_key=""
beszel_agent_port=""
4. Be sure to put the correct ssh key and port here given to you by beszel.
5. Run `service beszel_agent start`
Hello Arimil.
I've tried to use your instructions, but when I start the service, I always get the answer
env: /usr/local/etc/rc.d/beszel_agent: No such file or directory
I've double-checked and the file exists on the folder
nuno@OPNsense:/usr/local/etc/rc.d $ ll beszel_agent
-rwxr-xr-x 1 root wheel uarch 1535 May 25 01:44 beszel_agent*
nuno@OPNsense:/usr/local/etc/rc.d $
When I run the agent manually with the command
sudo ./beszel-agent -listen "45876" -key "ssh key" in the folder /usr/local/bin, it works correctly and I get the status in my Beszel Hub.
Thank you for your help
Nuno Lopes
Quote from: nsl_94 on May 25, 2025, 04:52:28 AMI've tried to use your instructions, but when I start the service, I always get the answer
env: /usr/local/etc/rc.d/beszel_agent: No such file or directory
I had to chmod +x /usr/local/etc/rc.d/beszel_agent , after that the service beszel_agent start command works for me.
"no such file or directory" can be caused by a command interpreter not being installed. What is the first line of that rc.d script?
I had it working and then i woke up the next day and the connection was down. 🤷�♂️
Quote from: anibis on June 01, 2025, 04:36:11 AMQuote from: nsl_94 on May 25, 2025, 04:52:28 AMI've tried to use your instructions, but when I start the service, I always get the answer
env: /usr/local/etc/rc.d/beszel_agent: No such file or directory
I had to chmod +x /usr/local/etc/rc.d/beszel_agent , after that the service beszel_agent start command works for me.
Hello anibis.
It worked.
After I did chmod +x to the file, the service started.
Then I enabled the service using
service beszel_agent enable, so that the service now restarts after the firewall reboots.
Thank you very much
Nuno Lopes
Hi All,
I was able to make Beszel service work with Arimil's approach
https://forum.opnsense.org/index.php?msg=229919
The only issue is that I could not get any CPU temperature data displayed on Beszel Hub.
Anybody knows how to get it ?
I'm running OPNSesne on a N150 Intel CPU with coretemp enabled in System->Settings->Miscellaneous
=Intel Core CPU on-die thermal sensor (coretemp)
Beszel Agent is version 0.11.1
and other agents installed on Debian/Synology are correctly displaying the info on Beszel.
On OPNSense box, with the command: sysctl -a | grep temperature
I get:
hw.acpi.thermal.tz0.temperature: 27.9C
dev.cpu.3.temperature: 34.0C
dev.cpu.2.temperature: 32.0C
dev.cpu.1.temperature: 31.0C
dev.cpu.0.temperature: 30.0C
And the widget on the Dashboard of OPNSense is correctly working.
Any hint ?
Thanks in advance for your help.