aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Ping903/Command/inspect.pm
blob: 464a1b6266cb595fbda89c6ef84fbf58d822125c (plain)
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
package App::Ping903::Command::inspect;
use strict;
use warnings;
use parent 'App::Ping903::Command';
use App::Ping903::Command ':exit_codes';

sub run {
    my $self = shift;
    $self->SUPER::run;

    my $cfg = $self->agent->get_config;
    unless ($cfg) {
	$self->abend(EX_FAIL, $self->agent->error_message);
    }

    foreach my $kw (sort keys %$cfg) {
	my $val = $cfg->{$kw} or next;
	print "$kw ";
	if (ref($val) eq 'ARRAY') {
	    print "<<EOF\n";
	    foreach my $ip (@$val) {
		print "    $ip\n";
	    }
	    print "EOF";
	} elsif (JSON::is_bool($val)) {
	    print $val ? "on" : "off";
	} else {
	    print $val
	}
	print "\n";
    }
}

1;
=head1 NAME

inspect - inspect ping903 server configuration

=head1 DESCRIPTION

Text

Return to:

Send suggestions and report system problems to the System administrator.