Setting Up Real-Time Monitoring with ‘Ganglia’ for Grids and Clusters of Linux Servers
===========
Ever since system administrators have been in charge of managing servers and groups of machines, tools like monitoring applications have been their best friends. You will probably be familiar with tools like[Nagios][11],[Zabbix][10],[Icinga][9], andCentreon. While those are the heavyweights of monitoring, setting them up and fully taking advantage of their features may be somewhat difficult for new users.
In this article we will introduce you toGanglia, a monitoring system that is easily scalable and allows to view a wide variety of system metrics of Linux servers and clusters (plus graphs) in real time.
[![Install Gangila Monitoring in Linux](http://www.tecmint.com/wp-content/uploads/2016/06/Install-Gangila-Monitoring-in-Linux.png)][8]
Install Gangila Monitoring in Linux
Ganglialets you set upgrids(locations) andclusters(groups of servers) for better organization.
Thus, you can create a grid composed of all the machines in a remote environment, and then group those machines into smaller sets based on other criteria.
In addition, Ganglia’s web interface is optimized for mobile devices, and also allows you to export data en`.csv`and`.json`formats.
Our test environment will consist of a centralCentOS 7server (IP address192.168.0.29) where we will installGanglia, and anUbuntu 14.04machine (192.168.0.32), the box that we want to monitor through Ganglia’s web interface.
Throughout this guide we will refer to theCentOS 7system as the master node, and to the Ubuntu box as the monitored machine.
### Installing and Configuring Ganglia
To install the monitoring utilities in the themaster node, follow these steps:
#### 1.Enable the[EPEL repository][7]and then install Ganglia and related utilities from there:
The packages installed in the step above along with ganglia, the application itself, perform the following functions:
1.`rrdtool`, the Round-Robin Database, is a tool that’s used to store and display the variation of data over time using graphs.
2.`ganglia-gmetad`is the daemon that collects monitoring data from thehoststhat you want to monitor. In those hosts and in themaster nodeit is also necessary to installganglia-gmond(the monitoring daemon itself):
3.`ganglia-web`provides the web frontend where we will view the historical graphs and data about the monitored systems.
#### 2.Set up authentication for theGangliaweb interface (/usr/share/ganglia). We will use basic authentication as provided byApache.
If you want to explore more advanced security mechanisms, refer to the[Authorization and Authentication][6]section of the Apache docs.
To accomplish this goal, create ausernameand assign a password to access a resource protected by Apache. In this example, we will create a username called`adminganglia`and assign a password of our choosing, which will be stored in/etc/httpd/auth.basic(feel free to choose another directory and / or file name – as long as Apache has read permissions on those resources, you will be fine):
```
# htpasswd -c /etc/httpd/auth.basic adminganglia
```
Enter the password for adminganglia twice before proceeding.
First, use the gridname directive followed by a descriptive name for the grid you’re setting up:
```
gridname "Home office"
```
Then, usedata_sourcefollowed by a descriptive name for the cluster (group of servers), a polling interval in seconds and the IP address of the master and monitored nodes:
#### 9.Edit the/etc/ganglia/gmond.conffile in the monitored box. This should be identical to the same file in themaster nodeexcept that the commented out lines in thecluster,udp_send_channel, andudp_recv_channelshould be enabled:
```
cluster {
name = "Labs" # The name in the data_source directive in gmetad.conf
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
udp_send_channel {
mcast_join = 239.2.11.71
host = localhost
port = 8649
ttl = 1
}
udp_recv_channel {
mcast_join = 239.2.11.71 ## comment out
port = 8649
bind = 239.2.11.71 ## comment out
}
```
Then, restart the service:
```
$ sudo service ganglia-monitor restart
```
#### 10.Refresh the web interface and you should be able to view the statistics and graphs for both hosts inside theHome office grid/Labs cluster(use the dropdown menu next to toHome office gridto choose a cluster,Labsin our case):
[![Ganglia Home Office Grid Report](http://www.tecmint.com/wp-content/uploads/2016/06/Ganglia-Home-Office-Grid-Report.png)][4]
Ganglia Home Office Grid Report
Using the menu tabs (highlighted above) you can access lots of interesting information about each server individually and in groups. You can even compare the stats of all the servers in a cluster side by side using the Compare Hosts tab.
Simply choose a group of servers using a regular expression and you will be able to see a quick comparison of how they are performing:
[![Ganglia Host Server Information](http://www.tecmint.com/wp-content/uploads/2016/06/Ganglia-Server-Information.png)][3]
Ganglia Host Server Information
One of the features I personally find most appealing is the mobile-friendly summary, which you can access using theMobiletab. Choose the cluster you’re interested in and then the individual host:
[![Ganglia Mobile Friendly Summary View](http://www.tecmint.com/wp-content/uploads/2016/06/Ganglia-Mobile-View.png)][2]
Ganglia Mobile Friendly Summary View
### Summary
In this article we have introducedGanglia, a powerful and scalable monitoring solution for grids and clusters of servers. Feel free to install, explore, and play around with Ganglia as much as you like (by the way, you can even try out Ganglia in a demo provided in the project’s[official website][1].
While you’re at it, you will also discover that several well-known companies both in the IT world or not use Ganglia. There are plenty of good reasons for that besides the ones we have shared in this article, with easiness of use and graphs along with stats (it’s nice to put a face to the name, isn’t it?) probably being at the top.
But don’t just take our word for it, try it out yourself and don’t hesitate to drop us a line using the comment form below if you have any questions.