Install Grafana & Influxdb in Centos 7
1. Install Grafana
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-
1.x86_64.rpm
Start service grafana
service grafana-server start
To configure the Grafana server to start at boot time:
/sbin/chkconfig --add grafana-server
Start the server (via systemd)
$ systemctl daemon-reload
$ systemctl start grafana-server
$ systemctl status grafana-server
Enable the systemd service to start at boot
sudo systemctl enable grafana-server.service
2. Install Influxdb
Add InfluxDB to yum
Just paste this entire snippet into your putty session:
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
sudo yum install influxdb
Configure InfluxDB
By default your config file will be at /etc/influxdb/influxdb.conf. However, you can create a
new config file to modify if desired.
influx config > influxdb.generated.conf
Note: You can then use the -config parameter to launch InfluxDB. For example, influxd -config
influxdb.conf
Configure InfluxDB for Automatic start-up
systemctl enable influxdb.service
Start InfluxDB
sudo service influxdb start
Show database
Checking your work
Before calling this done, let's confirm that both InfluxDB and Grafana are configured for
auto-start.
systemctl list-unit-files | grep 'influx\|grafana'
The output from above should look similar to:
grafana-server.service enabled
influxd.service enabled
influxdb.service enabled
Step 1: Install Graphite
In order for Graphite to install and function, a set of packages must be installed on the server.
However, these packages are not available in the CentOS default yum repository. Vultr instances
come with the EPEL repository enabled by default, but if you're installing this elsewhere you
will need to install it via:
sudo yum install -y http://epel.mirror.constant.com/7/x86_64/e/epel-release-
7-10.noarch.rpm
Next, install the requires packages for Graphite as follows:
sudo yum install -y graphite-web python-carbon
Step 2: Configure Graphite
Next, we will need to modify storage schema file. The values in this file will instruct Carbon on
how long to store values.
sudo nano /opt/graphite/conf/storage-schemas.conf
Add the following lines:
[default]
pattern = .*
retentions = 12s:4h, 2m:3d, 5m:8d, 13m:32d, 1h:1y
Save the file and start Carbon using the following command:
sudo systemctl enable carbon-cache
sudo systemctl start carbon-cache
Next, change the timezone and SECRET_KEY values in /etc/graphite-
web/local_settings.py.
Once you are done, run the database setup script using following command:
PYTHONPATH=/usr/share/graphite/webapp django-admin syncdb --
settings=graphite.settings
Step 4: Configure Apache for Graphite
First, remove the default index page from apache:
echo > /etc/httpd/conf.d/welcome.conf
Next, edit /etc/httpd/conf.d/graphite-web.conf and replace everything in the 'Directory
"/usr/share/graphite/"' block with:
Require all granted
Order allow,deny
Allow from all
Assign the proper permissions to the Graphite directory:
sudo chown apache:apache /var/lib/graphite-web/graphite.db
And work around a bug related to building indexs with:
touch /var/lib/graphite-web/index
Start Apache and enable auto-start:
sudo systemctl start httpd
sudo systemctl enable httpd
Access Graphite Web Interface
You may need to enable port 80 in firewalld:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
You can now access Graphite in your web browser by visiting your server’s IP address.
Install Telegraf in Ubuntu ( server monitored)
Link https://github.com/influxdata/telegraf
wget https://dl.influxdata.com/telegraf/nightlies/telegraf_nightly_i386.deb
dpkg -i telegraf_nightly_i386.deb
telegraf -sample-config > telegraf.conf
cd /etc/telegraf/
telegraf -config telegraf.conf
Install telegraf on centos
wget https://dl.influxdata.com/telegraf/nightlies/telegraf-nightly.i386.rpm
rpm -Uvh telegraf-nightly.i386.rpm
Collector Configuration Details
Sample /etc/telegraf/telegraf.conf, just change urls = ["http://your_host:8086"] to your server and
you're ready to go
# Global tags can be specified here in key="value" format.
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
# user = "$USER"
# Configuration for telegraf agent
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
hostname = ""
omit_hostname = false
### OUTPUT
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
urls = ["http://your_host:8086"]
database = "telegraf_metrics"
## Retention policy to write to. Empty string writes to the default rp.
retention_policy = ""
## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
write_consistency = "any"
## Write timeout (for the InfluxDB client), formatted as a string.
## If not provided, will default to 5s. 0s means no timeout (not recommended).
timeout = "5s"
# username = "telegraf"
# password = "2bmpiIeSWd63a7ew"
## Set the user agent for HTTP POSTs (can be useful for log differentiation)
# user_agent = "telegraf"
## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
# udp_payload = 512
# Read metrics about cpu usage
[[inputs.cpu]]
## Whether to report per-cpu stats or not
percpu = true
## Whether to report total system cpu stats or not
totalcpu = true
## Comment this line if you want the raw CPU time metrics
fielddrop = ["time_*"]
# Read metrics about disk usage by mount point
[[inputs.disk]]
## By default, telegraf gather stats for all mountpoints.
## Setting mountpoints will restrict the stats to the specified mountpoints.
# mount_points = ["/"]
## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
## present on /run, /var/run, /dev/shm or /dev).
ignore_fs = ["tmpfs", "devtmpfs"]
# Read metrics about disk IO by device
[[inputs.diskio]]
## By default, telegraf will gather stats for all devices including
## disk partitions.
## Setting devices will restrict the stats to the specified devices.
# devices = ["sda", "sdb"]
## Uncomment the following line if you need disk serial numbers.
# skip_serial_number = false
# Get kernel statistics from /proc/stat
[[inputs.kernel]]
# no configuration
# Read metrics about memory usage
[[inputs.mem]]
# no configuration
# Get the number of processes and group them by status
[[inputs.processes]]
# no configuration
# Read metrics about swap memory usage
[[inputs.swap]]
# no configuration
# Read metrics about system load & uptime
[[inputs.system]]
# no configuration
# Read metrics about network interface usage
[[inputs.net]]
# collect data only about specific interfaces
# interfaces = ["eth0"]
[[inputs.netstat]]
# no configuration
[[inputs.interrupts]]
# no configuration
[[inputs.linux_sysctl_fs]]
# no configuration
Create datasource Influxdb
Import Dashboard Grafana (file json)