enhance paloalto ssh
This commit is contained in:
parent
15682ca8a6
commit
982161aed8
|
@ -81,6 +81,7 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||
'critical-status:s' => { name => 'critical_status', default => '%{state} ne "up"' },
|
||||
|
@ -108,6 +109,12 @@ sub manage_selection {
|
|||
$self->{global} = { total => 0 };
|
||||
$self->{interface} = {};
|
||||
foreach (@{$result->{hw}->{entry}}) {
|
||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||
$_->{name} !~ /$self->{option_results}->{filter_name}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping interface '" . $_->{name} . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{interface}->{$_->{name}} = {
|
||||
display => $_->{name},
|
||||
type => $_->{type},
|
||||
|
@ -123,10 +130,14 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check vpn.
|
||||
Check interfaces.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter interface name (can be a regexp).
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set unknown threshold for status (Default: '').
|
||||
|
|
|
@ -116,7 +116,10 @@ sub get_diff_time {
|
|||
# '2019/10/15 12:03:58 BST'
|
||||
return if ($options{time} !~ /^\s*(\d{4})\/(\d{2})\/(\d{2})\s+(\d+):(\d+):(\d+)\s+(\S+)/);
|
||||
|
||||
my $tz = $7 eq 'BST' ? 'GMT' : $7;
|
||||
my $tz = $7;
|
||||
$tz = 'GMT' if ($tz eq 'BST');
|
||||
$tz = 'Europe/Paris' if ($tz eq 'CEST');
|
||||
$tz = 'America/New_York' if ($tz eq 'EST');
|
||||
my $dt = DateTime->new(
|
||||
year => $1,
|
||||
month => $2,
|
||||
|
|
Loading…
Reference in New Issue