diff options
-rw-r--r-- | config/gluster-commands.cfg | 2 | ||||
-rw-r--r-- | plugins/config_generator.py | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/config/gluster-commands.cfg b/config/gluster-commands.cfg index 41aa99b..377887c 100644 --- a/config/gluster-commands.cfg +++ b/config/gluster-commands.cfg @@ -63,7 +63,7 @@ define command{ define command{ command_name gluster_auto_discovery - command_line $USER1$/gluster/discovery.py -H $ARG1$ -c $ARG2$ + command_line $USER1$/gluster/discovery.py -H $ARG1$ -c $HOSTNAME$ } define command{ diff --git a/plugins/config_generator.py b/plugins/config_generator.py index 041ee8b..1f0be4e 100644 --- a/plugins/config_generator.py +++ b/plugins/config_generator.py @@ -96,8 +96,7 @@ class GlusterNagiosConfManager: service['host_name'] = clusterName service['use'] = 'generic-service' service['service_description'] = 'Cluster Auto Config' - service['check_command'] = "gluster_auto_discovery!%s!%s" % ( - hostIp, clusterName) + service['check_command'] = "gluster_auto_discovery!%s" % (hostIp) service['check_interval'] = '1440' return service @@ -141,10 +140,12 @@ class GlusterNagiosConfManager: hostsConfigs = [] clusterServices = self.createrVolumeServices( cluster.get('volumes'), cluster['name']) - clusterServices.append(self.createClusterUtilizationService( - cluster['name'])) + # If there are volumes, then create a cluster utilization service at cluster level + if cluster.get('volumes'): + clusterServices.append(self.createClusterUtilizationService( + cluster['name'])) clusterServices.append(self.createClusterAutoConfigService( - cluster['name'], cluster['hosts'][0]['hostip'])) + cluster['name'], cluster['hosts'][-1]['hostip'])) clusterHostConfig = self.createHost( cluster['name'], cluster['name'], "gluster-cluster", cluster['name'], "", "check_dummy", clusterServices) |