Skip to content

Commit

Permalink
Collect TCP profile statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Hite committed Nov 17, 2015
1 parent 65409d1 commit 11ad1d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion graphitecollectors/f5.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from time import sleep
from .util import timestamp_local, write_json_metrics

__VERSION__ = '1.9.3'
__VERSION__ = '1.9.4'


def get_parser():
Expand Down Expand Up @@ -128,6 +128,8 @@ def get_parser():
metric_group.add_argument('--no-node', action='store_true', dest='no_node')
metric_group.add_argument('--no-web-acceleration', action='store_true',
dest='no_web_acceleration')
metric_group.add_argument('--no-tcp-profile', action='store_true',
dest='no_tcp_profile')
return parser


Expand Down
21 changes: 21 additions & 0 deletions graphitecollectors/icontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,27 @@ def get_web_acceleration_metrics(api, prefix='', ts=None):
return metrics


def get_tcp_profile_metrics(api, prefix='', ts=None):
metrics = []
logging.info('Retrieving TCP profile statistics...')
tcp_profile_stats = api.LocalLB.ProfileTCP.get_all_statistics()
logging.debug('tcp_profile_stats =\n%s' % pformat(tcp_profile_stats))
if not ts:
ts = ts_epoch(tcp_profile_stats['time_stamp'])
statistics = tcp_profile_stats['statistics']

for x in statistics:
profile_name = x['profile_name'].replace('.', '-')
for y in x['statistics']:
stat_name, stat_val = parse_statistic(statistic=y)
stat_path = '%s.tcp_profile.%s.%s' % (prefix, profile_name,
stat_name)
metric = (stat_path, (ts, stat_val))
logging.debug('metric = %s' % str(metric))
metrics.append(metric)
return metrics


def get_bigip_api(hostname, user, password, max_attempts=1, retry_sleep=1):
last_error = ''
for attempt in range(max_attempts):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author='Matt Hite',
author_email='[email protected]',
description='A collection of network device graphite collectors',
version='1.9.3',
version='1.9.4',
packages=['graphitecollectors',],
scripts=['bin/f5-agent',],
install_requires=['bigsuds', 'argparse',],
Expand Down

0 comments on commit 11ad1d9

Please sign in to comment.