Installing OutagesIO on Ubuntu desktop or server

In this article, we’ll show you how you can install the OutagesIO Internet monitoring software on a Ubuntu LTS desktop or server as a stand alone script or a systemd service that auto starts with your operating system. In no time at all, you will have an agent running on your machine that will monitor your Internet service and provider.

Included are two options, one where you can run a script using something like rc.local or manually and another where the oeprating system can control the service automatically.

Stand alone script installation

The first step is to log into your control panel at app.outagesio.com.
If you don’t yet have an account, simply create one here; https://app.outagesio.com/account/signUp
Once logged in, click on the Agents menu item.
Click on the ‘Create software agent’ option.
Pick the device platform which in this case will be ‘Linux Ubuntu’.
Enter the local Internet providers business name.
Now enter the address where this agent is being installed. You can enter the whole address or part of it then click on ‘Click to auto fill address details’.
This should auto fill all of the details on the right hand side of the page.
If the map shows the correct location, you are done and can click on Create at the bottom of the page.
If the address is not right, try entering a nearby address then you can move the map around and click where the address is. Once you have the right location, click on Create.

Installation notes / credentials

The next page will show you installation notes and the required agent credentials.
The agent needs these credentials in order to know which account to send its reports to.

First click on ‘Agree to terms and conditions’ to reveal the credentials.

Next, open a terminal session from your Ubuntu desktop. Make sure you have root access.
Create the following file using your favorite editor. Mine is vi.

# vi /etc/agentid

Enter both credentials shown in the installation page as follow (example);

HhaeIxGP35
kKvcjzyn8Tp6ZOMfUgdRm4LtxVArPhaCN3bFWqHI

Save the file and you’re credentials are now ready.

Agent location and starter file

Next, create a directory where you will download and start the agent software from. The script by default is using but you can change it to what ever you like. Just keep track of any changes. I will use /agent.

# mkdir /agent
# cd /agent

Look back on the installation notes page and copy the starter script. It is the first text shown before the help information. Paste the test into a file called ‘starter_linux_ocp.sh’ using your favorite editor.

# vi starter_linux_ocp.sh

The file name is something we use in house, you can call it what ever you like. Just keep track of any changes you make to make sure everyhting matches.

After saving the contents, make the file executable.

# chmod 755 starter_linux_ocp_sh

At this point, all you need to do is to run the above file. It will download the latest version of the agent and will automatically start it as well. Now if you go to your new agents dashboard, you should see it’s heartbeat in green meaning that the agent is installed and properly running.

Automating startup using systemd

If you want to automate starting the agent each time the PC/server is rebooted, these are the steps to take.
First we need to comment out one of the lines in the script that we created above.

Find the following section near the end of the script and comment out the second line as shown.

## exec $start/otm_linux &
#$start/otm_linux &

This change will allow the systemd service to use the script to download the latest version but will prevent the script from starting the program because we want a system service to control it.

Next, let’s create a service for agent using your favorite editor.

# vi /etc/systemd/system/otm.service

Enter the following contents;

[Unit]
Description=Startup of the OutagesIO monitoring agent

[Install]
WantedBy=multi-user.target

After=network.target

[Service]
Type=simple
ExecStartPre=/agent/starter_linux_ocp.sh
ExecStart=/agent/otm_linux
WorkingDirectory=/agent
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n

Note the directory being used above is /agent/ but you can change this to what ever you like. Note that if you change the directory, you’ll have to change it in the script also. You’ll see that at the top of the script as shown below.

# Our example shows ‘/agent’, change this to what ever your path is.
start=”/agent”

Now that we have created the service, run the following command which will load the new file;
# systemctl daemon-reload

To have the agent auto start when your system starts, run the following;
# sudo systemctl enable otm.service

To start/stop the service or check the status, use the usual commands;
sudo systemctl xxx otm.service
xxx can equal enable, disable, start, stop ,status

You should now have a fully automated service.

Keep in mind than when you turn off your PC/server, the agent service gets turned off as well which means it is no longer monitoring your Internet connection.  You will see that your agent shows Inactive in your OutagesIO dashboard. After 30 minutes or so, that status will change to Disconnected.

Finally, the status will change back to Active once your PC/server is booted and running again.