Skip to content

Commit

Permalink
Fix connection to unix socket for new binary (#1755)
Browse files Browse the repository at this point in the history
* Properly format server argument
  • Loading branch information
nmuesch committed Jun 18, 2018
1 parent 95dd84a commit 631f200
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mcache/datadog_checks/mcache/mcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,19 @@ def check(self, instance):
if socket:
server = 'unix'
port = socket
connection_server = "{}".format(port)
else:
port = int(instance.get('port', self.DEFAULT_PORT))
connection_server = "{}:{}".format(server, port)
custom_tags = instance.get('tags') or []

mc = None # client
tags = ["url:{0}:{1}".format(server, port)] + custom_tags
service_check_tags = ["host:%s" % server, "port:%s" % port] + custom_tags

try:
self.log.debug("Connecting to %s:%s tags:%s", server, port, tags)
mc = bmemcached.Client(["{}:{}".format(server, port)], username, password)
self.log.debug("Connecting to %s, tags:%s", connection_server, tags)
mc = bmemcached.Client(connection_server, username, password)

self._get_metrics(mc, tags, service_check_tags)
if options:
Expand Down

0 comments on commit 631f200

Please sign in to comment.