New-ish Device

Free Internet troubleshooting agent for ARM based devices. Raspberry 3A, 3B+ and others. Outages.io finds connectivity issues, gives you hard facts.

Moderator: peachy

Post Reply
lobalt
Posts: 2
Joined: Fri Nov 20, 2020 11:59 am

New-ish Device

Post by lobalt »

Hello everybody! I just wanted to take a moment to write in and say that I was able to get the Agent working on a Raspberry Pi 2B. I know that's probably not surprising, since it works on the RPi3 and RPi4, but it does work nonetheless!

Now, if only I could figure out which of these moving boxes has my Pi Zero... :D

User avatar
Outages.io_Support
Posts: 160
Joined: Wed Feb 12, 2020 11:09 am

Re: New-ish Device

Post by Outages.io_Support »

That's great to hear, thank you for sharing this.
We can update the list of devices to include this one too if you feel this is a confirmed report.

Unfortunately, at this time, we don't have any scripts or tips to offer others installing Pi devices that could help.
I'm with the Outages.io support team. Please post your question and I'll try to answer

Are the issues in your local network, with your Internet provider or beyond?
Save countless hours by letting Outages.io help you find Internet connection problems.

lobalt
Posts: 2
Joined: Fri Nov 20, 2020 11:59 am

Re: New-ish Device

Post by lobalt »

I might see about writing one up, but I basically followed a combination of the OrangePi instructions from Peachy and the systemd instruction from Xant. I think a unified set would be good, though, so I'll probably get around to it. :)

Edit: I will say that I tried to use wget to download the Arm package directly to the Pi, but the link came back as unauthorized. Is there a way to enable that download so that we don't have to SFTP or SCP the file over?

User avatar
Outages.io_Support
Posts: 160
Joined: Wed Feb 12, 2020 11:09 am

Re: New-ish Device

Post by Outages.io_Support »

>I will say that I tried to use wget to download the Arm package directly to the Pi, but the link came back as unauthorized.
>Is there a way to enable that download so that we don't have to SFTP or SCP the file over?

Yes, it would need to be an authorized download, meaning, from a known account.
If you look at the Linux startup script, you could modify that to end up with a fully automated script that would start when your device does.
Just create a new agent, pick Linux and you'll see the scripts. When an agent is in the Created status, it will get removed in 24hrs so no need to worry about it being there.

Let me see if we can do a little testing then will update this post with something usable.
I'm with the Outages.io support team. Please post your question and I'll try to answer

Are the issues in your local network, with your Internet provider or beyond?
Save countless hours by letting Outages.io help you find Internet connection problems.

User avatar
Outages.io_Support
Posts: 160
Joined: Wed Feb 12, 2020 11:09 am

Re: New-ish Device

Post by Outages.io_Support »

Ok, if you want to try this, let's see where it can get. You may have to change some of the commands in the script to match your OS. For example, the command to make sure that curl is installed, etc.

Once this is working, you will be able to create an agent ARM in your dashboard, cut/paste the credentials and the starter script onto the device.
Preferably, in a location that will survive reboots. Once this is done, the device should auto start the scrip, which in turn will automatically download the most current version of OTM and start working with Outages.io.

Ok, let's start.

Cut/paste the Linux starter script I share below onto your device.
Change it's name to starter_linux_arm_otm.sh so we know this is the new script.

Make *sure* that you create a new agent using one of the ARM agents. This will give you a set of credentials for that version of OTM (agent).
Use the same method for Linux with this agent to create the credentials file, etc.

From your Agents list menu, click on the 'Create software agent' option.
In the Device drop down, pick the agent version 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_arm_otm.sh in the same directory.
Save then make the file executable 'chmod 755 starter_linux_arm_otm.sh'.
Run it by typing './starter_linux_arm_otm.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.

The following is the Linux agent script but once you do the above, it should work fine. Just remember, it needs to use credentials that were created specifically for this agent version (ARM).

Code: Select all

#!/bin/bash

#Version 1.0.3

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

command -v curl >/dev/null 2>&1 || { echo >&2 "The curl package is needed but not installed. Please install it and try again. Aborting."; exit 1; }

echo ""
echo "Make sure to create /etc/agentid with credentials before starting this script"
echo "Make sure your starter file points to the same directory that you have it in - Edit the 'start' option above accordingly"
echo "You could add this to /etc/rc.local to start it or build a service for it. Please search Google for more."
echo ""
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 $start/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 downloaded, starting program then exiting this script"
cd $start
chmod +x $start/otm_linux
# exec $start/otm_linux &
$start/otm_linux &

ps cax | grep otm_linux > /dev/null
if [ $? -eq 0 ]; then
echo ""
echo "Congratulations, your agent is now monitoring your Internet connectivity."
echo "Type 'ps cax | grep otm_linux' to see the process number"
else
echo "Something didn't work, your agent is not running."
fi

fi
fi

I'm with the Outages.io support team. Please post your question and I'll try to answer

Are the issues in your local network, with your Internet provider or beyond?
Save countless hours by letting Outages.io help you find Internet connection problems.

Post Reply