Skip to content

Commit

Permalink
check_tsd: add a --rate flag.
Browse files Browse the repository at this point in the history
Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
  • Loading branch information
masiulaniec authored and tsuna committed Oct 17, 2012
1 parent df82dd3 commit 870f88f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions THANKS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Aravind Gottipati <aravind@stumbleupon.com>
Arvind Jayaprakash <work@anomalizer.net>
Berk D. Demir <bdd@mindcast.org>
Hugo Trippaers <opensource@strocamp.net>
Jacek Masiulaniec <jacek.masiulaniec@gmail.com>
Jari Takkala <jari.takkala@betfair.com>
Mark Smith <msmith@stumbleupon.com>
Paula Keezer <paula.keezer@gmail.com>
Expand Down
10 changes: 8 additions & 2 deletions tools/check_tsd
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def main(argv):
help='Aggregation method: avg, min, sum (default), max.')
parser.add_option('-x', '--method', dest='comparator', default='gt',
metavar='METHOD', help='Comparison method for -w/-c: gt, ge, lt, le, eq, ne.')
parser.add_option('-r', '--rate', dest='rate', default=False,
action='store_true', help='Use rate value as comparison operand.')
parser.add_option('-w', '--warning', dest='warning', type='int', metavar='THRESHOLD',
help='Threshold for warning. Uses the comparison method.')
parser.add_option('-c', '--critical', dest='critical', type='int', metavar='THRESHOLD',
Expand Down Expand Up @@ -102,8 +104,12 @@ def main(argv):
downsampling = ''
else:
downsampling = '%ds-%s:' % (options.duration, options.downsample)
url = ('/q?start=%ss-ago&m=%s:%s%s%s&ascii&nagios'
% (options.duration, options.aggregator, downsampling, options.metric,
if options.rate:
rate = 'rate:'
else:
rate = ''
url = ('/q?start=%ss-ago&m=%s:%s%s%s%s&ascii&nagios'
% (options.duration, options.aggregator, downsampling, rate, options.metric,
tags))
tsd = '%s:%d' % (options.host, options.port)
if options.ssl_connection: # Pick the class to instantiate first.
Expand Down

0 comments on commit 870f88f

Please sign in to comment.