Installing your OutagesIO Internet monitor on Ubuntu
In this article, we’ll explain you how you can automate the startup of your OutagesIO Internet monitoring agent on your device using systemd. Here we assume you already have an account and have created your free software agent. Some might start and stop the agent manually while others might use something like rc.local to automatically start the agent when the system starts.
Now let’s add a little better control of the agent using systemd.
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 you need for your board.
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.
At this point, follow the instructions and you’ll soon have an agent running on your device.
Automating startup using systemd
If you want to automate starting the agent each time the device 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.
# $STARTING_FOLDER/$OTM_BINARY &
This change will allow the systemd service to use the script to download the latest version and will prevent another instance of the agent from starting so that the system service will control it.
Next, let’s create a service for agent using your favorite editor.
# vi /etc/systemd/system/otm.service
Enter the following contents;
Description=Startup of the OutagesIO Internet monitor agent
Note the directory being used above is /otm/ 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 ‘/otm’, change this to what ever your path is.
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 device, 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 device is booted and running again.