Install Grafana on Centos 7

Grafana

vi /etc/yum.repos.d/grafana.repo

[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
yum install grafana
systemctl enable grafana-server.service
systemctl start grafana-server
systemctl status grafana-server

Package details

  • Installs binary to /usr/sbin/grafana-server
  • Copies init.d script to /etc/init.d/grafana-server
  • Installs default file (environment vars) to /etc/sysconfig/grafana-server
  • Copies configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration uses a log file at /var/log/grafana/grafana.log
  • The default configuration specifies an sqlite3 database at /var/lib/grafana/grafana.db

InfluxDB

wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.3.x86_64.rpm
yum localinstall influxdb-1.6.3.x86_64.rpm
systemctl start influxdb
systemctl status influxdb

Create database

[root@localhost ~]# influx
Connected to http://localhost:8086 version 1.6.3
InfluxDB shell version: 1.6.3
> CREATE DATABASE collectd
> exit

vi /etc/influxdb/influxdb.conf

enabled = true
bind-address = "127.0.0.1:25826"
database = "collectd"
typesdb = "/usr/share/collectd"

systemctl restart influxdb

Collectd

yum install epel-release
yum install collectd
systemctl enable collectd
systemctl start collectd

vi /etc/collectd.conf

config file

Test if the measurements from CollectD are received by InfluxDB

[root@localhost ~]# influx
Connected to http://localhost:8086 version 1.6.3
InfluxDB shell version: 1.6.3
> use collectd
Using database collectd
> show measurements
name: measurements
name
----
collectd_value
contextswitch_value
cpu_value
df_value
disk_io_time
disk_read
disk_weighted_io_time
disk_write
interface_rx
interface_tx
irq_value
load_longterm
load_midterm
load_shortterm
memory_value
processes_value
swap_value
uptime_value
users_value
> exit