Monitor your production systems and application analytics using Grafana and Graphite. This article will help you setup these tools on Ubuntu 14.04 on a Nginx webserver with PostgreSQL as backend.
Before starting following this setup, please go through my previous post on Deploy Graphite and Nginx on an Ubuntu 14.04 server
What is what
What is Grafana?
Grafana is a tool for visualising time-series data for various application analytics. It is a great tool when used in combination with Graphite. It gives us flexibility of creating dashboards and share them with teams. Grafana Official
To install Graphite please follow this tutorial on Deploy Graphite and Nginx on an Ubuntu 14.04 server.
Install Ubuntu Packages
Executing following commands will install Grafana on your machine
Create a database for Grafana
Just as we created the database for Graphite on PostgreSQL, we will create a database for Grafana as well. Create a database grafana and give user graphite (the user having access to Graphite database) ownership of it.
Edit the Grafana configuration file
The settings should be something like this
Once your configuration is done, you can start Grafana Server by running
The log files are located at /var/log/grafana/grafana.log
If everything goes well the log file should have content
Setup Nginx for Graphite
Let us first create all files and links
Now we are ready for configuring Nginx server for Grafana
Open file /etc/nginx/sites-enabled/grafana and put following content in it
Now you can view a working Grafana on your server. Just hit http://grafana.yourservername.com from your favourite browser.
See it working
Once you open the Grafana page, you will see a page something like this.
Log in to the system with default credentials
- username: admin
- password: admin
Once you are logged in, you should see a screen like this.
Before you see any analytics information here, you should add your data source. The data source you will add will be Graphite that was setup earlier.
Goto Data Source -> Add New
Make following changes:
- Name: graphite
- URL: graphite.yourservername.com
You should test your connection before adding any dashboard.
Once the connection is successful, now we are ready to add our first dashboard. Go to home page and goto New Dashboard -> New
Once that is done, you can add panels to it. To add graphs in panels click on Green Button -> Add Panel -> Graph. At the botton you will see metrics in which select test and count. Then you will see screen something like this.
Please follow the below links in order to know more about Grafana and its amazing customizations.