mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
+ enhance ipsec-tunnel
This commit is contained in:
parent
03ca90bc3e
commit
598b5f22b1
@ -137,18 +137,26 @@ sub custom_traffic_calc {
|
|||||||
|
|
||||||
my $total_bytes = 0;
|
my $total_bytes = 0;
|
||||||
foreach (keys %{$options{new_datas}}) {
|
foreach (keys %{$options{new_datas}}) {
|
||||||
if (/$self->{instance}_cipSecTun$options{extra_options}->{label_ref}Octets_(\d+)/) {
|
if (/$self->{instance}_cipSecTunHc$options{extra_options}->{label_ref}Octets_(\d+)/) {
|
||||||
|
my $new_bytes = $options{new_datas}->{$_};
|
||||||
|
next if (!defined($options{old_datas}->{$_}));
|
||||||
|
my $old_bytes = $options{old_datas}->{$_};
|
||||||
|
|
||||||
|
$total_bytes += $new_bytes - $old_bytes;
|
||||||
|
$total_bytes += $new_bytes if ($total_bytes <= 0);
|
||||||
|
} elsif (/$self->{instance}_cipSecTun$options{extra_options}->{label_ref}Octets_(\d+)/) {
|
||||||
my $new_bytes = $options{new_datas}->{$_};
|
my $new_bytes = $options{new_datas}->{$_};
|
||||||
my $new_wraps = $options{new_datas}->{$self->{instance} . '_cipSecTun' . $options{extra_options}->{label_ref} . 'OctWraps_' . $1};
|
my $new_wraps = $options{new_datas}->{$self->{instance} . '_cipSecTun' . $options{extra_options}->{label_ref} . 'OctWraps_' . $1};
|
||||||
next if (!defined($options{old_datas}->{$_}));
|
next if (!defined($options{old_datas}->{$_}));
|
||||||
my ($old_bytes, $old_wraps) = ($options{old_datas}->{$_}, $options{old_datas}->{$self->{instance} . '_cipSecTun' . $options{extra_options}->{label_ref} . 'OctWraps_' . $1});
|
my ($old_bytes, $old_wraps) = ($options{old_datas}->{$_}, $options{old_datas}->{$self->{instance} . '_cipSecTun' . $options{extra_options}->{label_ref} . 'OctWraps_' . $1});
|
||||||
|
|
||||||
$total_bytes += $new_bytes - $old_bytes + (($new_wraps - $old_wraps) * (2**32));
|
$total_bytes += $new_bytes - $old_bytes + (($new_wraps - $old_wraps) * (2**32));
|
||||||
|
$total_bytes += $new_bytes if ($total_bytes <= 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||||
$self->{result_values}->{traffic_per_seconds} = $total_bytes / $options{delta_time};
|
$self->{result_values}->{traffic_per_seconds} = ($total_bytes * 8) / $options{delta_time};
|
||||||
$self->{result_values}->{label} = $options{extra_options}->{label_ref};
|
$self->{result_values}->{label} = $options{extra_options}->{label_ref};
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -237,9 +245,11 @@ my $mapping = {
|
|||||||
};
|
};
|
||||||
my $mapping2 = {
|
my $mapping2 = {
|
||||||
cipSecTunInOctets => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.26' },
|
cipSecTunInOctets => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.26' },
|
||||||
cipSecTunInOctWraps => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.28' },
|
cipSecTunHcInOctets => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.27' },
|
||||||
|
cipSecTunInOctWraps => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.28' }, # seems buggy
|
||||||
cipSecTunInDropPkts => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.33' },
|
cipSecTunInDropPkts => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.33' },
|
||||||
cipSecTunOutOctets => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.39' },
|
cipSecTunOutOctets => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.39' },
|
||||||
|
cipSecTunHcOutOctets => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.40' }, # seems buggy
|
||||||
cipSecTunOutOctWraps => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.41' },
|
cipSecTunOutOctWraps => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.41' },
|
||||||
cipSecTunOutDropPkts => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.46' },
|
cipSecTunOutDropPkts => { oid => '.1.3.6.1.4.1.9.9.171.1.3.2.1.46' },
|
||||||
};
|
};
|
||||||
@ -305,8 +315,14 @@ sub manage_selection {
|
|||||||
|
|
||||||
$self->{tunnel}->{$name} = { display => $name, sa => 0 }
|
$self->{tunnel}->{$name} = { display => $name, sa => 0 }
|
||||||
if (!defined($self->{tunnel}->{$name}));
|
if (!defined($self->{tunnel}->{$name}));
|
||||||
|
if (defined($result2->{cipSecTunHcInOctets}) && defined($result2->{cipSecTunHcOutOctets})) {
|
||||||
|
delete $result2->{cipSecTunInOctets};
|
||||||
|
delete $result2->{cipSecTunInOctWraps};
|
||||||
|
delete $result2->{cipSecTunOutOctets};
|
||||||
|
delete $result2->{cipSecTunOutOctWraps};
|
||||||
|
}
|
||||||
foreach my $oid_name (keys %{$mapping2}) {
|
foreach my $oid_name (keys %{$mapping2}) {
|
||||||
$self->{tunnel}->{$name}->{$oid_name . '_' . $cip_tun_index} = $result2->{$oid_name};
|
$self->{tunnel}->{$name}->{$oid_name . '_' . $cip_tun_index} = $result2->{$oid_name} if (defined($result2->{$oid_name}));
|
||||||
}
|
}
|
||||||
$self->{tunnel}->{$name}->{cikeTunActiveTime} = $result->{cikeTunActiveTime};
|
$self->{tunnel}->{$name}->{cikeTunActiveTime} = $result->{cikeTunActiveTime};
|
||||||
$self->{tunnel}->{$name}->{sa}++;
|
$self->{tunnel}->{$name}->{sa}++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user