Howto: Installing the Linux Internet monitoring agent software

Howto videos and features explanations
Locked
KelAuth
Posts: 44
Joined: Thu Mar 05, 2020 12:13 pm

Howto: Installing the Linux Internet monitoring agent software

Post by KelAuth »

This information is taken directly from the dashboard where members can download and install our Linux based Internet troubleshooting agent.

We have tested on Centos7, Centos 8 and Ubuntu.
Once these steps have been followed, the Linux agent will be downloaded and automatically started.
Please let us know if you successfully run on unlisted versions and we'll update our list of supported operating systems.

Please follow these steps
From your Agents list menu, click on the 'Create software agent' option.
In the Device drop down, pick the Linux versions required for your operating system.
Enter the address where the agent will be installed and click on 'Auto fill address details below'.
Enter the Internet provider at this location.
Click on Create when done.

Please agree to the terms and conditions to reveal the required credentials.

Create/edit using your favorite text editor a file in your /etc directory called agentid (/etc/agentid).
Enter the credentials shown without line spaces, one on each line then save it.

It should look like this;
xxxxx
xxxxxxxxxxxxxxxxx

Create a directory called /otm and copy the starter script below into this directory.
If you decide to use another directory, be sure to update the script by changing the 'start' value and put your starter script there instead.

Copy the script code below (the next window) into a file called starter_linux_ocp.sh in the same directory.
Save then make the file executable 'chmod 755 starter_linux_ocp.sh'.
Run it by typing './starter_linux_ocp.sh'.

This will download the program and automatically start it. The starter script will end but the monitoring program will continue running.

Updating to a new version
If the site is showing a new version available for download, simply re-run the startup script and it will download the newest version.

Is my agent running?
Confirm all is working by looking at your agents dashboard in Standard view mode. You should see Heartbeat status change to green and you should also see hops updated in Recent events and pings showing up in your Pings graph.

Please be sure to set the geo location under Configure, 'Address and geo location' for correct reports.

To automate the program startup, you could start it in /etc/rc.local for example. Search Google on how to do this.
Someone may have shared a script or if you have one, you could share it in the Linux section here in our support forums.

If your agent is not communicating, check any virus scanner or firewalls which may be blocking agent communications.
The agent uses only standard ports 80, 443 and ICMP to communicate with the Outages.io network.

Code: Select all

#!/bin/bash

#Version 1.0.1

# Enter the full path where you will be placing the starter_linux_otm.sh script into.
# Our example shows '/agent', change this to what ever your path is.
start="/agent"

echo "Make sure to create /etc/agentid with credentials before starting this script"
echo "Make sure you have set the 'start' path where this file is"
echo "You could add this to /etc/rc.local to start it or build a service for it. Please search Google for more."
sleep 5

### Define Global Variables
OTMIN="otm"
IN="$start/updater_linux_ocp.sh"
DATE=`date +%d-%m-%y`
OTM_COMMAND="otm_linux"
USERNAME=`awk 'NR==1' /etc/agentid`
PASSWORD=`awk 'NR==2' /etc/agentid`

### OTM section
# Get rid of any old version
rm -f $start/otm_linux
OTM_HTTP_STATUS=''
OTM_REMOTE_LENGTH=''

### Loop
until [[ ${OTM_HTTP_STATUS} -eq 200 && ! -z ${OTM_REMOTE_LENGTH} ]]
do
sleep 5

##
echo "Receiving binary location"
BINARY_LOCATION=$(curl -m 20 -s -u $USERNAME:$PASSWORD --connect-timeout 10 -X POST https://www.foxymon.com/receiver/receiver2.php -F function=receive_binary_location)
echo "Getting the OTM Package"
curl -I -m 30 --connect-timeout 15 "$BINARY_LOCATION" -o $start/otminfo.log
OTM_HTTP_STATUS=$(cat $start/otminfo.log | awk '/HTTP/ {print $2}')
OTM_REMOTE_LENGTH=$( cat $start/otminfo.log | awk '/Content-Length/ {print $2}' | sed -e 's/[\r\n]//g' )
done

###
if [[ ${OTM_HTTP_STATUS} -eq 200 && ! -z ${OTM_REMOTE_LENGTH} ]]; then
echo "Downloading OTM"
curl -m 30 --connect-timeout 15 "$BINARY_LOCATION" -o otm_linux
sleep 2
OTM_LOCAL_LENGTH=$( ls -l $start/otm_linux | awk '{print $5}' | sed -e 's/[\r\n]//g' )
if [ "${OTM_LOCAL_LENGTH}" == "${OTM_REMOTE_LENGTH}" ]; then
echo "OTM show be downloaded and if so, we're starting it and exiting this script"
cd $start
chmod +x $start/otm_linux
# exec $start/otm_linux &
$start/otm_linux &
fi
fi 

Locked