Upgrading Grafana and InfluxDB
This is a follow up post from last year where I installed Grafana and InfluxDB from scratch on an Amazon EC2 instance running Ubuntu.
Upgrading Grafana
I previously had Grafana 2.0.2 and wished to upgrade to 2.6.0.
I went to the Grafana downloads and ran the suggested commands:
$ wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb
$ sudo apt-get update
$ sudo apt-get install -y adduser libfontconfig
$ sudo dpkg -i grafana_2.6.0_amd64.deb
I decided to overwrite my configuration file at /etc/grafana/grafana.ini
during installation, but then I edited the port and domain. Be sure to remove the ;
to uncomment the configuration.
Note that there are two config files:
/etc/grafana/grafana.ini
/usr/share/grafana/conf/defaults.ini
but you should only edit the one at /etc/grafarana
#################################### Server ####################################
# The http port to use
http_port = 4555
# The public facing domain name used to access grafana from a browser
domain = grafana.cozymisery.com
I then started up the Grafana service
$ sudo service grafana-server start
You can watch the log file by runnning sudo tail -20f /var/log/grafana/grafana.log
I created a firewall hole on my Amazon EC2 instance to allow inbound TCP traffic on port 4555 for my IP address. I confirmed I was able to visit Grafana and log in. The default user and password is admin/admin.
Upgrading InfluxDB
I previously had Influx 0.9 and wished to upgrade to 10.0.
I went to the downloads page and ran the recommended commands:
$ wget https://s3.amazonaws.com/influxdb/influxdb_0.10.0-1_amd64.deb
$ sudo dpkg -i influxdb_0.10.0-1_amd64.deb
I again choose to just install the package maintainer's version of the configuration file. You can edit the configuration file at /etc/influxdb/influxdb.conf
if you wish.
I restarted the service with sudo service influxdb restart
I then connected to InfluxDB by typing influx
$ influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
Connected to http://localhost:8086 version 0.10.0
InfluxDB shell 0.10.0
> SHOW DATABASES
name: databases
---------------
name
demodb
Looks like a successful upgrade of Grafana and InfluxDB.
Making Grafana and InfluxDB play nice together
As it turns out, I didn't have to change any settings in Grafana for it to recognize InfluxDB as the datasource. My previous settings from the original setup worked just fine.
Helpful debugging commands
I had some difficulty opening up InfluxDB to the outside. That is to say, I was able to connect to InfluxDB on localhost
but I wanted an external process to be able to send data to InfluxDB on a different machine.
Machine A has InfluxDB running on it. Machine B wants to send data to it.
On machine B I try to ping machine A:
ubuntu@ip-172-31-40-87:$ ping 172.31.39.7
PING 172.31.39.7 (172.31.39.7) 56(84) bytes of data.
--- 172.31.39.7 ping statistics ---
28 packets transmitted, 0 received, 100% packet loss, time 27216ms
Okay, I need to open up a firewall port. I allow all traffic from 172.31.0.0/16 to reach 172.31.39.7. Ping works as shown below.
ubuntu@ip-172-31-40-87:$ ping 172.31.39.7
PING 172.31.39.7 (172.31.39.7) 56(84) bytes of data.
64 bytes from 172.31.39.7: icmp_seq=1 ttl=64 time=0.651 ms
64 bytes from 172.31.39.7: icmp_seq=2 ttl=64 time=0.618 ms
64 bytes from 172.31.39.7: icmp_seq=3 ttl=64 time=0.691 ms
--- 172.31.39.7 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
On machine B I now try to ping InfluxDB:
ubuntu@ip-172-31-40-87:$ curl -i 'http://172.31.39.7:8086/ping'
HTTP/1.1 204 No Content
Request-Id: d8acb6d3-cea8-11e5-824b-000000000000
X-Influxdb-Version: 0.10.0
Date: Mon, 08 Feb 2016 21:13:48 GMT
So I can reach InfluxDB on the correct port and it does respond. This is also a helpful way to figure out which version of InfluxDB is running.
On machine B I now try to POST some data to an existing DB named demodb
:
curl -i -XPOST 'http://172.31.39.7:8086/write?db=demodb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64'
And I get back
HTTP/1.1 204 No Content
Request-Id: 66b85ec6-cea9-11e5-8269-000000000000
X-Influxdb-Version: 0.10.0
Date: Mon, 08 Feb 2016 21:17:47 GMT
Connection: close
I then went to machine A (running InfluxDB and Grafana) and verified that the data is there.
$ influx
Connected to http://localhost:8086 version 0.10.0
> use demodb
Using database demodb
> select value from cpu_load_short
name: cpu_load_short
--------------------
time value
1454978947388563270 0.64
Hooray!
You may wish to see my other posts about Grafana and InfluxDB that walks through setting them up:
February 2016 - How to monitor your Linux machine(s)
June 2015 - Installing InfluxDB and Grafana on an EC2 instance