1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | use strict;
|
9 | use warnings;
|
10 | use Getopt::Long;
|
11 | use lib '.';
|
12 | use Etsy::StatsD;
|
13 |
|
14 | my %opt;
|
15 |
|
16 | GetOptions(\%opt, 'host=s', 'port=s', 'sample=f', 'time=f', 'increment', 'decrement', 'update=i') or die;
|
17 |
|
18 | my $bucket = shift or die "Need to provide a bucket";
|
19 |
|
20 | my $statsd = Etsy::StatsD->new($opt{host}, $opt{port}, $opt{rate});
|
21 | if ($opt{time}) {
|
22 | $statsd->timing($bucket,$opt{time});
|
23 | }
|
24 | if ($opt{increment}) {
|
25 | $statsd->increment($bucket);
|
26 | }
|
27 | if ($opt{update}) {
|
28 | $statsd->update($bucket, $opt{update});
|
29 | }
|
30 | if ($opt{decrement}) {
|
31 | $statsd->decrement($bucket);
|
32 | }
|
33 |
|