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';
38 unshift @headers, 'IP';
40 print join("\t", @headers),"\n";
42 foreach my $l ( @{ $info->{info} } ) {
43 warn "## l=",dump($l) if $debug > 1;
45 $l->[3] .= ':' . $info->{stats}->[ $l->[3] ];
46 $l->[4] .= ':' . $info->{types}->[ $l->[4] ];
48 print join("\t", $ip, @$l), "\n";
51 foreach my $l ( @{ $info->{jHst} } ) {
52 warn "## l=",dump($l) if $debug > 1;
54 $l->[2] .= ':' . $info->{stsAry}->[ $l->[2] ];
55 $l->[3] .= ':' . $info->{types}->[ $l->[3] ];
57 print join("\t", $ip, @$l),"\n";