5 use Data::Dump qw(dump);
7 my $ip = shift @ARGV || '10.60.3.35';
8 my $debug = $ENV{DEBUG} || 0;
11 my $op = shift @ARGV || 'list';
13 my $url = 'jblist.htm';
14 if ( $op eq 'list' ) {
16 } elsif ( $op eq 'hist' ) {
19 die "UNKNOWN op [$op]\n";
22 warn "# $ip/$url" if $debug;
23 open(my $curl, '-|', "curl --silent http://$ip/$url");
26 if ( m/var (stats|types|info|hdrs|stsAry|jHst)=(.*);/ ) {
28 my $v = eval $json; # this is not valid JSON, but perl's eval doesn't mind
29 #warn "# JSON $json -> ",dump($v);
34 warn "# info=",dump($info) if $debug;
36 my @headers = @{ $info->{hdrs} };
37 unshift @headers, 'id' if $op eq 'list';
39 print join("\t", @headers),"\n";
41 foreach my $l ( @{ $info->{info} } ) {
42 warn "## l=",dump($l) if $debug > 1;
44 $l->[3] = $info->{stats}->[ $l->[3] ];
45 $l->[4] = $info->{types}->[ $l->[4] ];
47 print join("\t", @$l), "\n";
50 foreach my $l ( @{ $info->{jHst} } ) {
51 warn "## l=",dump($l) if $debug > 1;
53 $l->[2] = $info->{stsAry}->[ $l->[2] ];
54 $l->[3] = $info->{types}->[ $l->[3] ];
56 print join("\t", @$l),"\n";