Skip to content

Commit

Permalink
adds possibility to add fqnd in proxies name for round dns support
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick Briffa committed Jan 28, 2016
1 parent 6d9f049 commit f03c407
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions agent-a0labs-newrelic
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,13 @@ class Agent:
def reformat_csv(self, csv):
ret = {}
for row in csv:
if (row['# pxname'] not in ret):
pxname = self.rounddns == True and row['# pxname'] + " - " + socket.getfqdn() or row['# pxname']
if (pxname not in ret):
tmp = {}
tmp['svname'] = row['# pxname']
tmp['svname'] = pxname
tmp['servers'] = {}
else:
tmp = ret[row['# pxname']]
tmp = ret[pxname]
svname = row['svname']
if (svname == 'FRONTEND'):
self.reformat_add_numeric_value(tmp, 'front_connection', my_int(row['stot']))
Expand Down Expand Up @@ -171,7 +172,7 @@ class Agent:
httpreq = my_int(row['hrsp_1xx']) + my_int(row['hrsp_2xx']) + my_int(row['hrsp_3xx']) + my_int(row['hrsp_4xx']) + my_int(row['hrsp_5xx']) + my_int(row['hrsp_other'])
self.reformat_add_numeric_value(tmp['servers'][svname], 'back_requests', httpreq)

ret[row['# pxname']] = tmp
ret[pxname] = tmp

return ret

Expand Down Expand Up @@ -289,6 +290,8 @@ class Agent:
self.newrelic_license = Config().get('NewRelicAPI', 'license_key')
self.poll_cycle = Config().getInt('NewRelicAPI', 'poll_cycle')

# Haproxy round dns - boolean
self.rounddns = Config().getBoolean('Haproxy', 'rounddns')
# Init of agent informations
self.guid = Config().get('Agent', 'guid')
self.agent_host = socket.gethostname()
Expand Down
1 change: 1 addition & 0 deletions agent-a0labs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
csv_url=#Example : http://192.168.0.21/haproxy?stats;csv
username=
password=
rounddns=false

[Logs]
enable=true
Expand Down

0 comments on commit f03c407

Please sign in to comment.