Skip to content

Commit

Permalink
Merge pull request #1292 from DataDog/quentin/display-proxy-info
Browse files Browse the repository at this point in the history
Add proxy settings on agent info display
  • Loading branch information
remh committed Jan 14, 2015
2 parents 313b21e + 33ed5c9 commit 4c367b5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
26 changes: 24 additions & 2 deletions checks/check_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# project
import config
from config import _windows_commondata_path
from config import _windows_commondata_path, get_config
from util import get_os, plural, Platform

# 3rd party
Expand Down Expand Up @@ -624,15 +624,37 @@ def __init__(self, queue_length=0, queue_size=0, flush_count=0, transactions_rec
self.flush_count = flush_count
self.transactions_received = transactions_received
self.transactions_flushed = transactions_flushed
self.proxy_data = get_config().get('proxy_settings')
if self.proxy_data and self.proxy_data.get('user'):
username = self.proxy_data.get('user')
hidden = len(username) / 2 if len(username) <= 7 else len(username) - 4
self.hidden_username = '*' * 5 + username[hidden:]
self.hidden_password = '*' * 10

def body_lines(self):
lines = [
"Queue Size: %s bytes" % self.queue_size,
"Queue Length: %s" % self.queue_length,
"Flush Count: %s" % self.flush_count,
"Transactions received: %s" % self.transactions_received,
"Transactions flushed: %s" % self.transactions_flushed
"Transactions flushed: %s" % self.transactions_flushed,
""
]

if self.proxy_data:
lines += [
"Proxy",
"=====",
"",
" Host: %s" % self.proxy_data.get('host'),
" Port: %s" % self.proxy_data.get('port')
]
if self.proxy_data.get('user'):
lines += [
" Username: %s" % self.hidden_username,
" Password: %s" % self.hidden_password
]

return lines

def has_error(self):
Expand Down
13 changes: 13 additions & 0 deletions win32/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,19 @@ <h2>Forwarder</h2>
<dt>Queue length</dt> <dd>{{ forwarder['queue_length'] }}</dd>
</dl>

{% if forwarder['proxy_data'] %}
<h3>Proxy</h3>

<dl>
<dt>Host</dt> <dd>{{ forwarder['proxy_data']['host'] }}</dd>
<dt>Port</dt> <dd>{{ forwarder['proxy_data']['port'] }}</dd>
{% if forwarder.get('hidden_username') %}
<dt>Username</dt> <dd>{{ forwarder['hidden_username'] }}</dd>
<dt>Password</dt> <dd>{{ forwarder['hidden_password'] }}</dd>
{% end %}
</dl>
{% end %}

<!-- Dogstatsd -->
<h2>DogstatsD</h2>

Expand Down

0 comments on commit 4c367b5

Please sign in to comment.