Skip to content

Commit

Permalink
When parsing port, get last element after ':' instead of second
Browse files Browse the repository at this point in the history
The token parsed from netstat can take one of two forms: "0 0.0.0.0:6379" and ":::6379".  If the for-loop hits the latter line first, then the line throws an exception.  This modification ensures that both formats are supported.
  • Loading branch information
casey-green committed Nov 6, 2014
1 parent f6c4ca9 commit 77ed497
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion collectors/0/redis-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def scan_for_instances():
if not (line and 'redis-server' in line):
continue
pid = int(line.split()[6].split("/")[0])
port = int(line.split()[3].split(":")[1])
port = int(line.split()[3].split(":")[-1])

# now we have to get the command line. we look in the redis config file for
# a special line that tells us what cluster this is. else we default to using
Expand Down

0 comments on commit 77ed497

Please sign in to comment.