Skip to content

Instantly share code, notes, and snippets.

@alq666
Created August 17, 2012 21:30
Show Gist options
  • Save alq666/3382912 to your computer and use it in GitHub Desktop.
Save alq666/3382912 to your computer and use it in GitHub Desktop.
Fix for #157
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:
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:
@alq666
Copy link
Author

alq666 commented Aug 17, 2012

curl -L http://dtdg.co/P3Kbkm > /tmp/hostname.diff
cd /usr/share/datadog/agent/
sudo patch -p1 < /tmp/hostname.diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment