Graphite is a complete monitoring tool for both simple and complex environments. It can be used for the monitoring of various networked systems—including sites, apps, services and servers in local and cloud environments. This range of possibilities serves companies of diverse segments and sizes. In this post all explain how graphite monitoring can help you get greater visibility into your application and infrastructure.
A Quick Graphite Monitoring FAQ
Graphite can support a company that has a specialized infrastructure, with a dedicated team and complex environments. It can also work well for small companies that have smaller teams and equipment.
When it comes to choosing a monitoring tool, an admin usually asks several questions, such as: How long does it take to deploy? Does this tool address our issues? Will my team be able to work with and understand the essence of the tool? What reports are available? An administrator needs to ask these questions so that the choice of tool is as accurate as possible. Below are the answers to these questions for Graphite.
How long does Graphite take to set up?
Setting up and deploying Graphite is simple thanks to an installation script called Synthesize. And extensive technical documentation on Graphite makes it possible to gather information on the tool quickly. Essentially, Synthesize is a script that allows the installation and configuration of a range of components to automate the configuration of Graphite.
Does this tool work in my environment?
Graphite can support almost any type of environment you need to run it in. It works in the cloud. It runs on hybrid infrastructure. It works with on-premises servers. And it can run efficiently no matter what the size of your environment.
Will my team be able to work with and understand the essence of the tool?
If your team is able to read and interpret, they will understand the essence of the tool.As previously mentioned, Graphite has thorough documentation with step-by-step instructions, and scripts available to change according to your needs.
What reports are available?
Graphite reports are inclusive, well-crafted and easy to manipulate. This is useful because reports are often used by people who are not part of the technology team, and they need to be able to understand the information quickly. The reports will be used most often to justify requests for purchases of new equipment, as well as hardware upgrades, and for performance measurement.
How Graphite Monitoring Works
Now that we’ve discussed what Graphite is and where you can use it, let’s take a look at how it works.
Graphite is composed of the following items:
|Carbon||A service that will be installed on the client computer and will listen for the TCP/UDP packets to be sent over the network.|
|Whisper||The database that will store data collected from the machines.|
|Graphite Webapp||Django web app for graphics generation.|
To provide a sense of Graphite in action, I’ll next provide an overview of how it works on different Linux distributions. I’ll discuss my experience installing and configuring Graphite on both Ubuntu and CentOS, so that I cover both sides (the Ubuntu/Debian and CentOS/Red Hat of the Linux universe).
Installing Graphite on Ubuntu Using Synthesize
I installed Graphite on an Ubuntu server hosted in the cloud. Everything went smoothly, but here are a couple of special tweaks I had to perform:
After logging into the cloud environment and installing Ubuntu 14.04 to test the Synthesize script, it was necessary for the cloud platform to release a port on the firewall so that the data could be sent to the dashboard (which should be done in any infrastructure, be it cloud or local). I had to be careful to release only the application port and not the full range.
After that, I used a data collection dashboard recommended by Graphite, called Grafana. However, you can also stream Graphite data directly into Sumo Logic.
Manual Installation of Graphite on CentOS
Now let’s try a manual installation of Graphite, without using Synthesize. In a manual installation, we have to be careful about the dependencies that the operating system requires to run smoothly. To make the job a bit more complex for this example, I decided to use CentOS, and I followed the steps below.
The first requirement for every operating system is to upgrade (if you haven’t already) so that it does not cause dependency problems later.
sudo yum -y update
Install the dependencies:
sudo yum -y install httpd gcc gcc-c++ git pycairo mod_wsgi epel-release python-pip python-devel blas-devel lapack-devel libffi-devel
Access the local folder to download the sources:
Clone the source of Carbon:
sudo git clone https://github.com/graphite-project/carbon.git
Access the Carbon folder:
sudo python setup.py install
Clone the source of Graphite Web:
sudo git clone https://github.com/graphite-project/graphite-web.git
Access the Graphite Web folder:
Install Graphite Web:
sudo pip install -r /usr/local/src/graphite-web/requirements.txt
sudo python setup.py install
Copy the Carbon configuration file:
sudo cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
Copy the storage schemas configuration file:
sudo cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
Copy the storage aggregation configuration file:
sudo cp /opt/graphite/conf/storage-aggregation.conf.example /opt/graphite/conf/storage-aggregation.conf
Copy the relay rules configuration file:
sudo cp /opt/graphite/conf/relay-rules.conf.example /opt/graphite/conf/relay-rules.conf
Copy the local settings file:
sudo cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
Copy the Graphite WSGI file:
sudo cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
Copy the virtual hosts file:
sudo cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite.conf
Copy the initi files to /etc/init.d:
sudo cp /usr/local/src/carbon/distro/redhat/init.d/carbon-* /etc/init.d/
Give permission to execute the init files:
sudo chmod +x /etc/init.d/carbon-*
Start the Carbon cache:
sudo systemctl start carbon-cache
sudo systemctl enable httpd
sudo systemctl start httpd
With this configuration, we can access the Graphite web interface in https://localhost:8080, and monitor the local server running CentOS.
Graphite and Sumo Logic
Now that you have Graphite running, you can stream Graphite-formatted metrics directly into Sumo Logic. All you need do is set up an installed collector and connect it to a metrics source. This webinar walks you through the steps:
Sources are the environments that Sumo Logic Collectors connect to to collect data from your site. Each Source is configured to collect files in a specific way, depending on the type of Collector you’re using. The Setup Wizard in Sumo Logic walks you through the process. You’ll find Linux, Mac OS and Windows instructions for installing a new Graphite collector here. Part of this process defines how your data will be tagged for _sourceCategory, the protocol and port you’ll use to stream data. Next, simply configure a Graphite source for the collector to connect to. Here are the steps for configuring your Graphite source.
That’s it. Now you can use Sumo Logic’s advanced analytics to search and visualize data streaming from your application and infrastructure. Enjoy!
About the Author
Brena Monteiro is a software engineer with experience in the analysis and development of systems. She is a free software enthusiast and an apprentice of new technologies.
Getting Started with Graphite Monitoring is published by the Sumo Logic DevOps Community. If you’d like to learn more or contribute, visit devops.sumologic.com. Also, be sure to check out Sumo Logic Developers for free tools and code that will enable you to monitor and troubleshoot applications from code to production.