Graphite is a free open-source software tool that monitors and graphs numeric time-series data such as the performance of computer systems Graphite monitoring provides operations teams with visibility on varying levels of granularity concerning the behavior and mannerisms of the systems and applications. This leads to error detection, resolution, and continuous improvement.
Graphite stores numeric time-series data (metric, value, epoch timestamp) and renders graphs of this data on demand A time-series is a sequence of observations taken sequentially in time Time series analysis reveals trends and patterns associated with external factors and anomalies With adequate graphing teams and enough time series data, it’s even possible to intuitively forecast future events.
As Graphites design is orientated towards modularity and doing one thing very well, there is no direct data collection support. Carbon, one of the three Graphite components, listens passively for data. Solutions such as StatsD and CollectD are used to collect and parse data upstream to Graphite as different protocols
The main graphite components are:
- carbon - a Twisted daemon that listens for time-series data
- whisper - a simple database library for storing time-series data (similar in design to RRD)
- graphite webapp - A Django webapp that renders graphs on-demand using Cairo
Ensure that docker installed
Since we are using docker to run graphite, ensure it is installed before proceeding. If you don’t have docker installed, check these guides:
- How to Install and Use Docker in Ubuntu 20.04.
- How to install and configure docker In Fedora 34/35
- How to install and configure docker on Debian 11
- How to install and configure docker In Centos 8
Check installed docker version using this command:
|
|
Running Graphite
The simplest way of running graphite is using its docker components. This will save you the time of installing each component and setting its dependencies. The docker project work can be found in this github repo.
The docker image includes the following components:
- Nginx - reverse proxies the graphite dashboard
- Graphite - front-end dashboard
- Carbon - back-end
- Statsd - UDP based back-end proxy
The following ports are exposed from the container. We will map them locally later:
Host | Container | Service |
---|---|---|
8090 | 80 | nginx |
2003 | 2003 | carbon receiver - plaintext |
2004 | 2004 | carbon receiver - pickle |
2023 | 2023 | carbon aggregator - plaintext |
2024 | 2024 | carbon aggregator - pickle |
8080 | 8080 | Graphite internal gunicorn port (without Nginx proxying). |
8125 | 8125 | statsd |
8126 | 8126 | statsd admin |
Create data directories to persist container data. They’ll be mapped to container volumes when starting the container.
|
|
Now run this command in your terminal:
|
|
If you are running the above command for the first time, it will download the latest Graphite and Statsd container images.
Access Graphite Web interface
Since we mapped port 80 to 8090 in the above docker run command, we will use that to access the web interface. Use your Server IP address on port 8090 to access Graphite web interface.
The default logins creds are:
Username: root
Password: root
Managing Graphite Container with systemd
To manage the container easily and to ensure that it starts on boot, we can use systemd. Systemd is a Linux service manager that comes with most modern linux distros. Use this command to create a systemd service file for our Graphite
|
|
Reload Systemd to get new units.
|
|
Confirm graphite-docker
unit file is created.
|
|
Starting and enabling graphite-docker service
We have to start the service. Use this command:
|
|
Confirm that it is working as expected:
|
|
The above output shows that the service is running. To enable the service on boot use this command:
|
|
That is it! We have managed to get graphite up and running in this guide.