Tue 13 Apr 2010
There's little info on the web about how to monitor a glusterfs brick with nagios (or any other tool). There is a hint of a gluster utility script – http://www.mail-archive.com/gluster-devel@nongnu.org/msg06928.html – but it's not available in the source package.
It also needed some updates to make it suitable for nagios. I hope the gluster devs take my version of the script, along with these instructions, and add them to the main gluster source…
These instructions are for a default nagios3 installation on ubuntu karmic with gluster 3.0.3 compiled from source so you may need to edit this for your site.
Download this script (glfs-health.sh) and store it somewhere useful:
wget http://www.sirgroane.net/downloads/glfs-health.sh --output-document=/usr/local/bin/glfs-health.sh chmod u+x /usr/local/bin/glfs-health.sh
Assuming a simple TCP gluster install we can set up a nagios command like this:
echo '
define command{
command_name check_gluster
command_line sudo /usr/local/bin/glfs-health.sh $HOSTADDRESS$ 6996 tcp $ARG1$
}
' >> /etc/nagios-plugins/config/gluster.cfg
Notice the "sudo" in the command? This is because glfs-health.sh has to run as root. To enable this we have to add a line to /etc/sudoers:
echo "nagios ALL=(ALL) NOPASSWD: /usr/local/bin/glfs-health.sh" >> /etc/sudoers
Now you can construct a nagios service to monitor the bricks. For example: you've created a nagios hostgroup "gluster-bricks" with all the bricks in and they all export a volume "export_data":
define service {
hostgroup_name gluster-bricks
service_description Glusterfsd
check_command check_gluster!export_data
use generic-service
notification_interval 0
}
Restart nagios and you're done.
This work was supported by:

April 14th, 2010 at 7:26 pm
Ian –
Very nice, we love to see community developed projects around Gluster. I've fowarded this to our director of engineering and I'll follow up to see if we can get it included in a release. I'd like to get you some tee shirts and hats as a thank you, please get in touch.
Craig
September 25th, 2010 at 12:54 am
Hello, Ian.
This nagios script will require to have the gluster client component installed on the Nagios server. Is that correct?
October 6th, 2011 at 6:07 pm
Keep in mind things have changed since this was written. The Gluster port to use would no longer be 6996. Probably more like 24010 or something.