Upgrading Telegraf on Debian Linux

So…it’s been just a little while since I actually posted anything.  Life got busy…another baby came, and work has been out of control busy.  Things have started to settle down now so hopefully I can get back to blogging again.  Since it has been so long since my last post, today we will start by upgrading Telegraf.  When I last made a blog post, the latest Telegraf version was 1.7.  Quite a lot has changes since then.  In preparation for my next few blog posts, let’s start by upgrading Telegraf.

Installation

If we take a look back at part 5 of my dashboard series, we’ll see that we downloaded a .deb to perform our installation.  Rather than going that route for the update, we’ll instead use the Advanced Package Tool (APT).  First we need to update and then get and install the transport https package for APT:

sudo apt-get update && sudo apt-get install apt-transport-https

If all goes well, we should see everything update and we should see apt-transport-https install:

 

Upgrading Telegraf

Now that we have APT ready to go, we can add the Influx key and the repository.  Wait, what?  Third-party software providers (in this instance, anyone that’s not Debian or already in the actual Debian repository) can give you access to their repository to download the latest stable build of their software.  To gain access to that repository installations and updates, you must first download and install the key to said repository.  Let’s start with the key:

wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -

This command will use wget to download the key and key and then use apt-key to add the key so that we can get access to the third-party repository.  We should see something like this:

Now let’s add the repository to APT so that we can update Telegraf.  Here’s the command (copied directly from the Influx website):

source /etc/os-release
test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

I’m running Debian 9, so it writes the stretch repository definition to a file named influxdb.list in our sources directory for APT:

Now that we’ve added Influx to our APT repository, we can upgrade Telegraf.  Before we can actually run that upgrade, we first need to use APT to update our packages:

sudo apt-get update

This will update ever package, not just Telegraf, but it will not actually upgrade anything (this screenshot is from another VM, as I failed to take a screenshot):

And finally, we can actually perform the upgrade!  We have two variations on the APT command to do so.  We can use the following command:

sudo apt-get install telegraf

This command will update Telegraf if it is installed or install it if it is not.  The other option is just a variation on this command:

sudo apt-get --only-upgrade install telegraf

This basically prevents the installation of Telegraf and will only perform an upgrade.  I went with the former:

When the upgrade occurs, we are prompted to either keep or update the telegraf.conf file.  You will likely want to keep your current configuration, so answer N (the default) to complete the upgrade.

Conclusion

There we have it…using apt-get install to perform an upgrade.  I had to look this up, so that’s why I put this post together, to make sure you can find everything here about working on your dashboard!  Next up..VMware vSphere with Telegraf!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.