Tuesday, November 5, 2024
HomeDevOpsHow to Setup Influxdb, grafana and telegraf on Ubuntu

How to Setup Influxdb, grafana and telegraf on Ubuntu

May we see lot of people CollectD with influxDB and Grafana to monitor also graphite was played good role and which highly suitable with grafana (build with AngularJS). CollectD seems to be a very suitable daemon which collects system performance statistics periodically, but needs some slight configuration to work with InfluxDB. But we decide to go with telegraf to explore and monitor.

  • InfluxDB for ingesting and storing data
  • Grafana for displaying real-time and historical charts
  • Telegraf for system monitoring

We can install influxDB and grafana in one system and we can run telegraf remain all the system which we have to monitor.

You can our script to setup this in Ubuntu. Script please find in Our Repo Influxdb+Grafana

Installing InfluxDB

Installing on an Ubuntu machine is straightforward. Per the downloads page:

# wget https://s3.amazonaws.com/influxdb/influxdb_0.10.0-1_amd64.deb

# dpkg -i influxdb_0.10.0-1_amd64.deb

# /etc/init.d/influxdb start

Starting the process influxdb [ OK ]

influxdb process was started [ OK ]

# influx

Connected to http://localhost:8086 version 0.10.0

InfluxDB shell 0.10.0

>

If you wise access through browser you can use http://<your-server-ip>:8083. Normally it doesn’t require any username. In web UI you can create the database and also can see the measurements.

Installing Grafana

Also simple enough. Per the downloads page:

# wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb

# apt-get update

# apt-get install -y adduser libfontconfig

# dpkg -i grafana_2.6.0_amd64.deb

# service grafana-server start

Once you install you can access the nice web UI using http://<Your –server-IP>:3000. Its uses admin/admin as default username/password.

Installing Telegraf

Per the GitHub page:

# wget http://get.influxdb.org/telegraf/telegraf_0.10.2-1_amd64.deb

# dpkg -i telegraf_0.10.2-1_amd64.deb

Next you have to decide what you want to monitor. Running the following command will generate a sample config file listing many inputs and outputs. You can view the resulting telegraf.conf file if you wish.

# telegraf -sample-config > telegraf.conf

For demonstration purposes, I configure to monitor CPU, memory, and swap usage and output it to InfluxDB. Therefore I can generate the configuration file by specifying:

# telegraf -sample-config -input-filter cpu:mem:swap -output-filter influxdb > telegraf.conf

And then run telegraf by passing in the configuration file:

# telegraf -config telegraf.conf

2016/02/10 01:05:19 Starting Telegraf (version 0.10.2)

2016/02/10 01:05:19 Loaded outputs: influxdb

2016/02/10 01:05:19 Loaded inputs: cpu mem swap

2016/02/10 01:05:19 Tags enabled: host=precise64

2016/02/10 01:05:19 Agent Config: Interval:10s, Debug:false, Quiet:false, Hostname:”precise64″, Flush Interval:10s

2016/02/10 01:05:20 Gathered metrics, (10s interval), from 3 inputs in 752.027µs

2016/02/10 01:05:30 Gathered metrics, (10s interval), from 3 inputs in 1.537643ms

2016/02/10 01:05:30 Wrote 7 metrics to output influxdb in 7.466383ms

View the stats

Once we setup all in server side now we can move to grafana dashboard to fetch the influxdb data to grafana. Follow below steps to configure influxdb in grafana.

1.) The top left Menu (icon of Spiral)
2.) Data Sources
3.) + Add data source
4.) Fill out:
a.) Name: InfluxDB
b.) Type: InfluxDB
c.) (HTTP Settings) Url: http://10.0.0.20:8086
d.) (InfluxDB Settings) Database: telegraf
5.) Click “Save & Test” — it will save and work

Grafana requires a database user/name to complete the form, but InfluxDB doesn’t actually care.

You can create some dashboards be selecting the fields you want to query, and then organize everything as desired.

If you wish you monitor more servers just install telegraf and start collect data.

RELATED ARTICLES
- Advertisment -

Most Popular

Recent Comments