-
Notifications
You must be signed in to change notification settings - Fork 8
/
mcpeek.pl
executable file
·66 lines (42 loc) · 1.06 KB
/
mcpeek.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -w
use lib qw(/web/lib/perl);
use strict;
use Getopt::Std;
use Log::Log4perl qw(get_logger :levels);
use Kynetx::Memcached qw(:all);
use Cache::Memcached;
use Kynetx::Configure qw(:all);
use Data::Dumper;
$Data::Dumper::Indent = 1;
# configure KNS
Kynetx::Configure::configure();
use Log::Log4perl qw(get_logger :levels);
Log::Log4perl->easy_init($INFO);
#Log::Log4perl->easy_init($DEBUG);
# global options
my $memd = new Cache::Memcached {
'servers' => Kynetx::Configure::get_config("MEMCACHE_SERVERS"),
'debug' => 0,
'compress_threshold' => 10_000,
};
use vars qw/ %opt /;
my $opt_string = 'h?k:';
getopts( "$opt_string", \%opt ); # or &usage();
&usage() if $opt{'h'} || $opt{'?'};
my $key = $opt{'k'};
die "You must supply a ruleset key [ruleset:<prod|dev>:<rid>]\n" unless $key;
my $result = $memd->get($key);
print Dumper($result);
1;
sub usage {
print STDERR <<EOF;
usage:
mcpeek.pl -k session_id
Peek at a cached ruleset.
Options are:
-k : Ruleset key to dump...
Examples:
mcpeek.pl -k ruleset:prod:a22x2
EOF
exit;
}