Automatic Linux Agent Installation
Automatic installation for Linux Agent Supported distributions: CentOS7, CentOS8, Debian 9.x, Ubuntu 18.x, Raspbian 9x and Raspberry OS 10.

Introduction
In the following guide we are going to automatically install the Pandora FMS agent in GNU/Linux in the supported distributions: 

 

 CentOS 7 . 

 CentOS 8 . 

 Debian 9.x or later. 

 Ubuntu 18.x or later. 

 Raspbian 9.x . 

 Raspberry OS 10.x . 

 

 The agent will have the basic values of the operating system and will run a Speed Test every half hour and you will be ready to analyze the speed of internet link. 

 What are we going to monitor in GNU/Linux? 

 We are going to see the values that are important to take into account in the health of an operating system which are: 

 Disk usage percentage CPU wait time CPU usage Network usage  Internet speed (Speed Test) 

 The internet speed measurement is done using the GNU/Linux client on the page https:/ /www.speedtest.net/  a very reliable tool for this type of testing:

Download and unzip the script
The script is available for free in the Pandora FMS library, to download the script we execute the command: 

 wget https://pandorafms.com/library/wp-content/uploads/2020/11/Install-PandoraAgent.tgz 

 Then we unzip the file with the command: 

 tar xvzf Install-PandoraAgent.tgz 

 If everything worked correctly we see something similar to this:

Run script
The script supports the following Linux distributions: CentOS 7, CentOS 8, Debian 9.x or later, Ubuntu 18.x or later, Raspbian 9.x and Raspberry OS 10.x. 

 An internet connection is required since the agent is downloaded as part of the process 

 We enter the agent directory and then execute it with the following command: 

 

 ./Install_agent.sh [server] 

 

 A practical example would be: ./Install_agent.sh 192.168.110.20, where the IP address 192.168.110.20 corresponds to our Pandora FMS server. 

 The script automatically detects which is the Linux distribution. In this guide we will see the example with a Raspberry PI, but we will obtain a similar result in any of the distributions supported by the same 

 We see the execution example: 

 

 We wait for the script to finish executing, it takes a few minutes depending on the internet connection we have to carry out the process:

Agents in the WEB console
We see the agents created with this script 

 

 In red you can see the values of the Speed Test executed on an agent with CentOS 8 (the measurement is expressed in MB/sec)

How Speed Test works
We already have the script installed, now we are going to see how it works to understand and learn more about how Pandora FMS works. When you run the installer, the /root/bin folder is created (in case it does not exist), inside this folder we will find several scripts: 

 

 The pandora_agent.conf file (it is the initial version created by the script when installing), regarding the operation of the Speed Test tool, the client in Python is used which is the speedtest-cli file,  so that the metrics can be taken, a scheduled task is created that executes the script /bin/speedtest.sh which is executed once every half hour, you can validate it with the command  

 crontab -l 

 

 It generates a file speedtest.log , where the PandoraFMS agent takes the metrics 

 

 The scripts speedtest_upload.sh and speedtest_download.sh are the ones that take the values to be able to add them in Pandora FMS: 

 

 To finish the lines corresponding to the internet speed tests in our configuration file pandora_agent.conf are the following: 

 

# SpeedTest Download

module_begin

module_name SpeedTestDownload

module_type generic_data

module_description Speedtest Download

module_exec /root/bin/speedtest_download.sh

module_group Networking

module_end

# Ping SpeedTest Upload

module_begin

module_name SpeedTestUpload

module_type generic_data

module_description Speedtest Upload

module_exec /root/bin/speedtest_upload.sh

module_group Networking

module_end

Additional monitors
When installing the agent automatically, some very useful scripts were added that are not part of the automated installation but can be used simply by adding some lines to the pandora_agent.conf file. > as we can see in the following examples 

 Ping to an IP, for the example we are going to use Google DNS 8.8.8.8, for it to work it will be Just add the following lines (use the script /root/bin/ping.sh) 

 

## Google DNS Ping

module_begin

module_name Ping-DNS-Google

module_type generic_data

module_description Ping DNS Google

module_max_critical 1

module_exec /root/bin/ping.sh 8.8.8.8

module_group Networking

module_end

 

 Example Ping to Switch 192.168.10.10 

 In order to measure the number of packets lost to an IP address, for example, Google DNS 8.8.8.8 will be It is enough to add the following lines  (use the script /root/bin/pl.sh) 

 

## Packet loss to DNS Google 8.8.8.8

module_begin

module_namePercentLostPackagesDNSGoogle

module_type generic_data

module_description Percent Lost DNS Packets Google 8.8.8.8

module_exec /root/bin/pl.sh 10 8.8.8.8

module_group Networking

module_end

 

 Example testing google.com.ar  

 To complete the monitors that are useful to know the health of our internet link with the following lines we can measure the network latency to an IP address, it is interesting to use the same one as in ping from the previous step: 

 

## Network Latency

module_begin

module_name PingLatencyGoogleDNS

module_type generic_data

module_description PingLatencyDNSGoogle

module_exec ping 8.8.8.8 -c 3 | grep "rtt min" | awk '{ print $4 }' | cut -f 2 -d "/"

module_group Networking

module_end  

 Google.com Latency Example