From 6fb70dc1fd61805ef75ae14b92f0f7c236519688 Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Fri, 21 Mar 2014 14:16:30 +0530 Subject: plugins: Fixing template, commands and vol utilization Fixed the template, commands and vol utilization plugin Change-Id: I11eb562f6f563d066938110f730512ae0b772eaf Signed-off-by: Sahina Bose Reviewed-on: https://cuckoo.blr.redhat.com:8443/66 Reviewed-by: Nishanth Thomas --- config/gluster-commands.cfg | 11 +++++++++++ config/glustercluster.cfg.sample | 29 +++++++++++++++++++++++++++++ plugins/check_vol_utilization_server.py | 10 +++++----- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/config/gluster-commands.cfg b/config/gluster-commands.cfg index 803cc58..c2d70a7 100644 --- a/config/gluster-commands.cfg +++ b/config/gluster-commands.cfg @@ -45,6 +45,17 @@ define command { } +define command { + command_name check_brick_usage + command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_brick_usage -a $_SERVICEBRICK_DIR$ +} + +define command { + command_name check_vol_utilization + command_line $USER1$/gluster/check_vol_utilization_server.py $ARG1$ $ARG2$ -w $ARG3$ -c $ARG4$ +} + + define command{ command_name check_cluster_vol_usage command_line $USER1$/gluster/check_cluster_vol_usage.py -w $ARG1$ -c $ARG2$ -hg $HOSTNAME$ diff --git a/config/glustercluster.cfg.sample b/config/glustercluster.cfg.sample index 397c743..c03bb0a 100644 --- a/config/glustercluster.cfg.sample +++ b/config/glustercluster.cfg.sample @@ -31,6 +31,14 @@ define host{ check_command check_dummy!0 } +################################################################################ +# This defines a Host +# Edit this sample +# host_name = FQDN or IP address of host +# alias = Used for display +# address = FQDN or IP address of host +# hostgroups = Add the name of hostgroup defined for cluster +################################################################################ define host{ use gluster-host host_name host.ipaddress1 @@ -39,6 +47,14 @@ define host{ hostgroups gluster_hosts,test-cluster ; SHOULD HAVE the cluster it belongs to } +################################################################################ +# This defines a Brick utilization service +# Edit this sample +# host_name = host the brick is on +# service_description = brick name of form serverip:brickdir +# display_name = Name to be shown up on Nagios. +# _BRICK_DIR = Path to brick on server +################################################################################ define service { use brick-service host_name host.ipaddress1 @@ -47,6 +63,14 @@ define service { _BRICK_DIR /bricks/b1 ; MUST DECLARE the custom var _BRICK_DIR } +################################################################################ +# This defines a Volume utilization service +# Edit this sample +# host_name = the cluster host previously defined for cluster +# service_description = Volume Utilization - +# check_command = check_vol_utilization!!!! +# _VOL_NAME = Volume name +################################################################################ define service{ use gluster-service-with-graph host_name test-cluster @@ -55,6 +79,11 @@ define service{ check_command check_vol_utilization!test-cluster!data-vol!70!90 } +################################################################################ +# This defines a Cluster utilization service +# Edit this sample +# host_name = cluster host previously defined. (The service is under a cluster) +################################################################################ define service{ use gluster-service-with-graph host_name test-cluster diff --git a/plugins/check_vol_utilization_server.py b/plugins/check_vol_utilization_server.py index 8b08f21..d34e212 100755 --- a/plugins/check_vol_utilization_server.py +++ b/plugins/check_vol_utilization_server.py @@ -13,19 +13,19 @@ def excecNRPECommand(host): answer = livestatus.checkLiveStatus("GET hosts\nColumns: address\n" "Filter: display_name = " + host + "\n") - command = _NRPEPath + " -H " + answer.rstrip() + " -c " \ - "check_vol_utilization -a " + args.volume + " " + \ - str(args.warning) + " " + str(args.critical) + command = (_NRPEPath + " -H " + answer.rstrip() + " -c " + + "check_vol_utilization -a " + args.volume + " " + + str(args.warning) + " " + str(args.critical)) status = commands.getoutput(command) return status def showVolumeUtilization(args): - table = livestatus.readLiveStatus("GET hostgroups\nColumns: members name\n" + table = livestatus.readLiveStatus("GET hostgroups\nColumns: members\n" "Filter: name = " + args.hostgroup + "\n") tab1 = table[0] - list_hosts = tab1[0].split(";") + list_hosts = tab1[0].split(",") #First take a random host from the group and send the request host = random.choice(list_hosts) status = excecNRPECommand(host) -- cgit