Created
August 17, 2012 21:30
-
-
Save alq666/3382912 to your computer and use it in GitHub Desktop.
Fix for #157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changes in HEAD | |
Modified checks/common.py | |
diff --git a/checks/common.py b/checks/common.py | |
index 1b84928..b014f63 100644 | |
--- a/checks/common.py | |
+++ b/checks/common.py | |
@@ -126,11 +126,12 @@ class checks(object): | |
if self.agentConfig.get('hostname'): | |
metadata['agent-hostname'] = self.agentConfig.get('hostname') | |
- | |
- try: | |
- metadata["hostname"] = socket.gethostname() | |
- except: | |
- pass | |
+ metadata['hostname'] = metadata['agent-hostname'] | |
+ else: | |
+ try: | |
+ metadata["hostname"] = socket.gethostname() | |
+ except: | |
+ pass | |
try: | |
metadata["fqdn"] = socket.getfqdn() | |
except: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/checks/common.py b/checks/common.py | |
index 1b84928..b014f63 100644 | |
--- a/checks/common.py | |
+++ b/checks/common.py | |
@@ -126,11 +126,12 @@ class checks(object): | |
if self.agentConfig.get('hostname'): | |
metadata['agent-hostname'] = self.agentConfig.get('hostname') | |
- | |
- try: | |
- metadata["hostname"] = socket.gethostname() | |
- except: | |
- pass | |
+ metadata['hostname'] = metadata['agent-hostname'] | |
+ else: | |
+ try: | |
+ metadata["hostname"] = socket.gethostname() | |
+ except: | |
+ pass | |
try: | |
metadata["fqdn"] = socket.getfqdn() | |
except: | |
Author
alq666
commented
Aug 17, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment