Document Control

Author

Version

Time

Comment

Hao.Yu@telit.com

V0.1

Mar 1st , 2019

First commit

Hao.Yu@telit.com

V0.2

Mar 4th , 2019

add data source from influxDB

Grafana topologic

graphite is solution for data source scale out

statsD to limited the metric sent to graphite

Install MYSQL 5.7

Download MySQL Yum Repository

wget http://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm

install the repo

rpm -ivh mysql80-community-release-el7-2.noarch.rpm

see if the repo is enable or disable

yum repolist all | grep mysql

enable mysql 5.7

yum-config-manager --enable mysql57-community

check repo to make sure 5.7 is enable in repo

cat mysql-community.repo

yum repolist enabled | grep mysql

yum install mysql-community-server

systemctl start mysqld

systemctl status -l mysqld

yum install python34-PyMySQL.noarch

find mysql root initial password

sudo grep 'temporary password' /var/log/mysqld.log

2019-03-01T04:19:58.304407Z 1 [Note] A temporary password is generated for root@localhost: 1XGPZC)o<rs+

mysql -uroot -p

change root password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root@123';

create user graphite identified by 'Grap@123';

create database graphite;

grant all ON graphite.* to graphite@'%';

Install Grafana on Docker

sudo yum install -y yum-utils \

device-mapper-persistent-data \

lvm2

sudo yum-config-manager \

--add-repo \

sudo yum install docker-ce docker-ce-cli containerd.io

service docker start

docker run -d --name graphite --restart=always -p 81:81 -p 80:80 -p 8125:8125/udp hopsoft/graphite-statsd

please check 8125 is StatsD traffic port in UDP mapping

visit with admin/admin

change admin password

Install Grafana on CentOS

find download information from

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

[grafana]

name=grafana

baseurl=https://packages.grafana.com/oss/rpm

repo_gpgcheck=1

enabled=1

gpgcheck=1

gpgkey=https://packages.grafana.com/gpg.key

sslverify=1

sslcacert=/etc/pki/tls/certs/ca-bundle.crt

yum install Grafana

binding ip address and mysql account information

vi /etc/grafana/grafana.ini

systemctl start grafana-server

systemctl status -l grafana-server

check port is up

netstat -ntlp

goto http://192.168.1.60:3000

login as admin/admin

install server side image rendering

yum install -y fontconfig freetype* urw-fonts

Using Grafana

First time in web UI

create folder and dashboard

add panel

share the link

take a local snapshot

take a Cloud snapshot

Add data source

fill in mysql account information

click save and test for testing the connection

Integration with InfluxDB

installation influxdatabase

topologic introduce https://www.influxdata.com/time-series-platform/

goto get download link

wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.4.x86_64.rpm

sudo yum localinstall influxdb-1.7.4.x86_64.rpm

systemctl start influxdb

enter influx to enter the shell

create and show database

insert data by shell

insert cpu,host=nginx value=0.5

insert data by API

curl -i -XPOST 'http://localhost:8086/write?db=TelitDemo' --data-binary 'cpu,host=apache value=4'

query database

create admin user in influxdb

CREATE USER "admin" WITH PASSWORD 'Pass@123' WITH ALL PRIVILEGES

enable auth in influxdb

vi /etc/influxdb/influxdb.conf

[http]

enabled = true

bind-address = "10.143.40.163:8088"

auth-enabled = true

then restart the influxdb

systemctl restart influxdb

Add data source in Grafana

goto Grafana web ui and find configuration in left menu

enter influxdb connection information

click save and test to make sure db link is available

add panel to dashboard

create influx DS folder and create new dashboard

add query and select data source

edit panel

add fake data

data will show up in the panel

Integration with MySQL

add data source

update with mysql account information

Make fake data in database

create production table and column

make some fake number

Add panel

create mysql folder and switch datasource to mysql

select add a table

SELECT * from production

order by SalesTime desc

limit 10

;

finally go back to dashboard and looks like this

Notification & Alert

update SMTP information in /etc/grafana/grafana.ini

and update alerting configuration in Grafana webUI

Worldping plug

download & installation

https://grafana.com/plugins/raintank-worldping-app/installation

grafana-cli plugins install raintank-worldping-app

service grafana-server restart

enable worldping in Grafana plugings

go and get Grafana.com API Key

register user and find key

https://grafana.com/orgs/pcdog/api-keys

dashboard like this

Add End point

goto world ping home in left menu

add endpoint

wait data information collection

wait for a while for the ping data collection , the dashboard will looks like this.