Install the agent on a NAS

Learn how to install the agent on almost every Linux, suitable for Synology, Qnap and many more.

Preface

NAS appliances are mainly based on the Linux operating system, but they don't use a fully featured distribution like Debian, CentOs or Ubuntu. But even on a very limited Linux system the cloudradar agent can be installed.

At the moment vendor specific packages are not available yet. But using the generic Linux packages you can monitor your NAS with ease.

This manual assumes you have SSH access to your NAS and you know how to use SSH.

Download the right version

Login to your NAS using the root or admin user and type in the command uname -a Determine the architecture of your system. In other words: Find out which CPU you have. The output might look similar to the following example.

Linux Synology-DS218j 3.10.105 #24922 SMP Fri May 10 02:48:35 CST 2019 armv7l GNU/Linux synology_armada38x_ds218j

Note the part armv7l. This is CPU architecture.

Point your browser to https://github.com/cloudradar-monitoring/cagent/releases/latest/ and look for the download link for your architecture. For the above example, it would be cagent_<VERSION>_Linux_armv7.tar.gz

Start the download on the command line of your NAS using the curl command. Unpack the archive after the download. For example

cd /tmp/
curl -L -O https://github.com/cloudradar-monitoring/cagent/releases/download/1.1.4/cagent_1.1.4_Linux_armv7.tar.gz
tar xvzf cagent_1.1.4_Linux_armv7.tar.gz cagent

Install the agent

Move the agent binary to the eligible folder. On a Synology NAS the home-dir of the admin user is an acceptable location.

mkdir ~/bin/
mv cagent ~/bin/

Verify you downloaded the right version by executing cagent once. ~/bin/cagent -version

Circumvent issues with cagent 1.1.4 on minimalistic Linux systems. Cagent expects some commands to exist.

which dmidecode || sudo ln -s /bin/true /usr/sbin/dmidecode
which service || sudo ln -s /bin/true /usr/sbin/service
sudo sh -c 'echo "admin ALL= NOPASSWD: /usr/sbin/dmidecode">/etc/sudoers.d/cagent'

Create a config file

You can use any editor like vi or nanoand you can place the config file anywhere on your NAS. If you are not familiar with command line editors, you can use a GUI based editor. Via the web-interface of your NAS search the package center for text editor applications and install some.

Install an editor on a Synology NAS

Open the editor and create a config file with the values you copy from my.cloudradar.io. After creating a host with "inside monitoring with agent" enabled the installation instructions are displayed. Select "other (manual installation)". This will display the settings for your host.

Create a new file called cagent.conf on your NAS with the settings of the host. On a Synology NAS you can create a new folder called cloudradar under the homes section and put cagent.conf there.

Always append the following lines to the config file

log = "/tmp/cagent.log" log_level = "error"

Start the agent

After having created the config file, go back to your SSH console and start the agent.

~/bin/cagent -c /volume1/homes/cloudradar/cagent.conf -d

The path to the config file may vary depending on where you've saved it. The my.cloduradar.io should indicate the agent is running.

The agent is connected

Enable the auto-start of the agent

The agent should start automatically every time your NAS starts. On a Synology NAS this is managed by upstart.

Open the editor again and create a file called cagent-start.conf in the same folder where you have created the cagent.conf file before.

The upstart config file

Copy the file to the folder where all upstart-scripts are located. (Requires the admin-password)

sudo cp /volume1/homes/cloudradar/cagent-start.conf /etc/init
/etc/init/cagent-start.conf
description "start cloudradar monitoring"
console log
start on syno.network.ready
stop on runlevel [06]
setuid admin
exec /var/services/homes/admin/bin/cagent -c /volume1/homes/cloudradar/cagent.conf -d

After a reboot the monitoring agent starts automatically.