How to Install Ganglia Monitoring Server on Ubuntu 18.04 | 16.04

This brief tutorial shows students and new users how to install and configure Ganglia monitoring platform on Ubuntu 18.04 | 16.04.

For those who don’t know about Ganglia, is an open source software which provides monitoring and analytics across network systems and runs on all major operating systems, including Ubuntu.

It uses XML for data representation, XDR for compact, portable data transport, and RRDtool for data storage and visualization and can scale to handle clusters with 2000 nodes.

Ganglia is a complete enterprise grade server and log monitoring system which brings together data from diverse systems and databases into a single platform.

This post will show you how to perform a basic configuration after installation this open source project backed by a vibrant community. You’ll also be able to logon to Ganglia server once installed.

For more about Ganglia, please visit its homepage.

When you’re ready, continue below with the steps:

Step 1: Install Apache2 HTTP Server

Apache2 HTTP Server is the most popular web server in use. so install it since Ganglia needs it.

To install Apache2 HTTP on Ubuntu server, run the commands below.

sudo apt update
sudo apt install apache2

After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

To verify whether Apache2 HTTP server is installed and operating, open your browser and browse to the server’s hostname or IP address. If you see a page similar to the one below, then Apache2 is working as expected.

apache2 ubuntu install

Step 2: Install PHP 7.2 and Related Modules

Some version of Ubuntu won’t have PHP 7.2 available in their default repositories. In order to install it, you will have to get it from third-party repositories.

Run the commands below to add the below third party repository to upgrade to PHP 7.2 if Ubuntu doesn’t already have it available.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Then update and upgrade to PHP 7.2

sudo apt update

Next, run the commands below to install PHP 7.2 and related modules.

sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip

After installing PHP 7.2, run the commands below to open PHP default config file for Apache2.

sudo nano /etc/php/7.2/apache2/php.ini

Then make the changes on the following lines below in the file and save. The value below are great settings to apply in your environments.

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
max_input_vars = 1500
date.timezone = America/Chicago

After making the change above, save the file and close out.

When you’re done making changes, all you have to do is restart Apache2 to reload PHP configurations.

To restart Apache2, run the commands below

sudo systemctl restart apache2.service

To verify whether PHP 7.2 installed and find default settings configured with Apache2, create a phpinfo.php file in Apache2 root directory by running the commands below

sudo nano /var/www/html/phpinfo.php

Then type the content below and save the file.

<?php phpinfo( ); ?>

Save the file. then browse to your server hostname followed by /phpinfo.php

/phpinfo.php

You should see PHP default test page.

PHP 7.2 ubuntu nginx

Step 3: Install Ganglia Package

Now that Apache2 and PHP are installed, simply run the commands below to install Ganglia

sudo apt update
sudo apt install ganglia-monitor rrdtool gmetad ganglia-webfrontend

Once installed, the commands below can be used to stop, start and enable Ganglia to automatically startup when the server boots up.

sudo systemctl stop ganglia-monitor.service
sudo systemctl start ganglia-monitor.service
sudo systemctl enable ganglia-monitor.service

Step 4: Configure Ganglia Service

Ganglia default configuration files are located under /etc/ganglia directory. Its main configuration file is /etc/ganglia/gmetad.conf and has a basic setup configured in it. You’ll need to make some changes to suit your environment.

To validate if Ganglia is installed, run the commands below:

systemctl status ganglia-monitor.service

You should see Ganglia system status details as shown below:

● ganglia-monitor.service
   Loaded: loaded (/etc/init.d/ganglia-monitor; generated)
   Active: active (running) since Wed 2020-01-22 08:46:37 CST; 29s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 2 (limit: 4674)
   CGroup: /system.slice/ganglia-monitor.service
           └─30412 /usr/sbin/gmond --pid-file /var/run/gmond.pid

Jan 22 08:46:37 ubuntu1804 systemd[1]: Starting ganglia-monitor.service.
Jan 22 08:46:37 ubuntu1804 ganglia-monitor[30410]: Starting Ganglia Monitor Daemon: gmond.
Jan 22 08:46:37 ubuntu1804 systemd[1]: Started ganglia-monitor.service.

First, you will need to edit gmetad.conf file and define your master node. You can do this with the following command:

sudo nano /etc/ganglia/gmetad.conf

Make the following highlighted changes to define the server IP address to serve as master node.

# A list of machines which service the data source follows, in the 
# format ip:port, or name:port. If a port is not specified then 8649
# (the default gmond port) is assumed.
# default: There is no default value
#
# data_source "my cluster" 10 localhost  my.machine.edu:8649  1.2.3.5:8655
# data_source "my grid" 50 1.3.4.7:8655 grid.org:8651 grid-backup.org:8651
# data_source "another source" 1.3.4.7:8655  1.3.4.8

data_source "my cluster" 50 192.168.101.101:8655
#

After making your changes, save your changes and exit.

Next, open /etc/ganglia/gmond.conf and make the highlighted changes to reference the master node.

sudo nano /etc/ganglia/gmond.conf

Make the changes below, then save the file.

/* Feel free to specify as many udp_send_channels as you like.  Gmond
   used to only support having a single channel */
udp_send_channel {
  mcast_join = 192.168.101.101
  port = 8649 
  ttl = 1
} 

/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
  mcast_join = 192.168.101.101
  port = 8649
  bind = 192.168.101.101
}

/* You can specify as many tcp_accept_channels as you like to share
   an xml description of the state of the cluster */
tcp_accept_channel {
  port = 8649
}

/* Each metrics module that is referenced by gmond must be specified and
   loaded. If the module has been statically linked with gmond, it does

Finally, copy Ganglia’s configuration file to Apache virtual host directory. This can be done by running the commands below:

sudo cp /etc/ganglia-webfrontend/apache.conf /etc/apache2/sites-enabled/ganglia.conf

Next, restart ganglia monitor, gmetad and apache services using the commands below:

sudo systemctl restart ganglia-monitor 
sudo systemctl restart gmetad
sudo systemctl restart apache2

Step 5: Access Ganglia Web Portal

Now that Ganglia server is installed and access is allowed from the local machine, use the address below to access Ganglia portal.

You should Ganglia home page as shown below:

Ganglia Ubuntu Install

Step 6: Install Ganglia Clients

Now that Ganglia server is installed and running, go and install its client software your desktops and other servers that should be reporting.

On Ubuntu and other Debian systems, simply run the commands below to install Ganglia’s client monitor package.

sudo apt install ganglia-monitor

After installing Ganglia client, edit its gmond.conf file to define the master node.

sudo nano /etc/ganglia/gmond.conf

Make the following changes:

udp_send_channel {
 host = 192.168.101.101
  port = 8649
  ttl = 1
}

Save and exit, then start ganglia-monitor service using the following command:

systemctl start ganglia-monitor

In no time, client machines should be reporting to the master node.

Congratulations! You have learned how to install Ganglia monitoring platform on Ubuntu 16.04 | 18.04 LTS servers.

You may also like the post below: