summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/nagios_server.conf6
-rwxr-xr-xplugins/check_proc_status.py6
-rw-r--r--plugins/gluster-proc.crontab2
-rw-r--r--plugins/nscautils.py.in6
4 files changed, 16 insertions, 4 deletions
diff --git a/config/nagios_server.conf b/config/nagios_server.conf
index 56c8995..381e588 100644
--- a/config/nagios_server.conf
+++ b/config/nagios_server.conf
@@ -11,3 +11,9 @@ nagios_server=
[NAGIOS-DEFINTIONS]
cluster_name=
+
+# LOCAL HOST NAME
+# Host name given in the nagios server
+[HOST-NAME]
+hostname_in_nagios=
+
diff --git a/plugins/check_proc_status.py b/plugins/check_proc_status.py
index 80a41c8..20b7b32 100755
--- a/plugins/check_proc_status.py
+++ b/plugins/check_proc_status.py
@@ -166,9 +166,9 @@ def sendShdStatus(hostName, volInfo):
if __name__ == '__main__':
- #Get the volume status
- #status = 0
- hostName = socket.getfqdn()
+ hostName = nscautils.getCurrentHostNameInNagiosServer()
+ if not hostName:
+ hostName = socket.getfqdn()
if hostName == "localhost.localdomain" or hostName == "localhost":
sys.stderr.write("failed to find localhost fqdn")
diff --git a/plugins/gluster-proc.crontab b/plugins/gluster-proc.crontab
index 7344ea2..9febe26 100644
--- a/plugins/gluster-proc.crontab
+++ b/plugins/gluster-proc.crontab
@@ -1 +1 @@
-*/1 * * * * root /usr/lib64/nagios/gluster/plugins/check_proc_status.py
+*/1 * * * * root /usr/lib64/nagios/plugins/gluster/check_proc_status.py
diff --git a/plugins/nscautils.py.in b/plugins/nscautils.py.in
index 10247e2..6ad96f5 100644
--- a/plugins/nscautils.py.in
+++ b/plugins/nscautils.py.in
@@ -31,6 +31,12 @@ def getNagiosServerIP():
return config.get('NAGIOS-SERVER', 'nagios_server')
+def getCurrentHostNameInNagiosServer():
+ config = ConfigParser.ConfigParser()
+ config.read(__NAGIOSSERVER_CONF)
+ return config.get('HOST-NAME', 'hostname_in_nagios')
+
+
def getNagiosClusterName():
config = ConfigParser.ConfigParser()
config.read(__NAGIOSSERVER_CONF)