blob: 81f1049178d30038458d17ce7139107ff2de9a98 (
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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
package App::Mangemanche::Command::inspect;
use strict;
use warnings;
use parent 'App::Mangemanche::Command';
use App::Mangemanche::Command ':exit_codes';
sub run {
my $self = shift;
$self->SUPER::run;
$self->usage_error("extra parameters") if @ARGV > 1;
my $cfg = $self->agent->get_config(@ARGV);
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 SYNOPSIS
B<inspect>
[I<PARAM>]
=head1 DESCRIPTION
Queries the running instance of B<ping903> about its configuration and
prints it on screen in its configuration file format.
If given a single argument I<PARAM>, only the requested configuration
parameter is displayed.
=head1 OPTIONS
=head2 Informative options
=over 4
=item B<-?>
Display short help summary.
=item B<--usage>
Display command line usage summary.
=item B<--help>
Display a detailed program manual.
=back
=head1 NOTES
Depending on the B<ping903> server and the user settings, the configuration
returned can be censored.
The IP list is always formatted as a here-document, containing both immutable
and mutable IPs from the server configuration.
=head1 SEE ALSO
L<ping903>(1), L<ping903.conf>(5).
|