Here's a quick guide to daemonize and ensure your v2 agent starts when your FreeBSD system boots up. We assume nano is your text editor and that the sd-agent files are located at /root/.sd-agent/ in this tutorial.
Download and install the agent by following these instructions
Copy rc.d file
sudo cp /root/.sd-agent/agent/packaging/source/freebsd-agent /etc/rc.d/sd-agent
You may not have the freebsd-agent file locally if you're not using the latest agent version, in which case you can use the following:
sudo curl -L -o /etc/rc.d/sd-agent https://raw.githubusercontent.com/serverdensity/sd-agent/master/packaging/source/freebsd-agent
Allow execution
sudo chmod +x /etc/rc.d/sd-agent
Disable nodaemon
sudo sed -i -e "s/nodaemon = true/nodaemon = false/" /root/.sd-agent/agent/supervisor.conf
Add rc.d configuration variable
sudo sysrc sdagent_enable="YES"
You can confirm this variable is set correctly with this command:
sysrc -v sdagent_enable
Starting/stopping the agent
You can start/stop the agent using these commands:
service sd-agent start
service sd-agent stop
Use these service commands to control the agent, once started head back to your UI to see the metrics. We suggest scheduling a reboot to ensure that the sd-agent starts on boot.
Comments