Add Extended signature database updates

This commit is contained in:
tlaurikainen 2019-07-23 11:32:11 +02:00 committed by GitHub
parent 7caab59e9e
commit 7c7037861f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 52 additions and 4 deletions

View File

@ -31,7 +31,9 @@ sub set_counters {
$self->{maps_counters_type} = [
{ name => 'av', type => 0, cb_prefix_output => 'prefix_av_output' },
{ name => 'avet', type => 0, cb_prefix_output => 'prefix_avet_output' },
{ name => 'ips', type => 0, cb_prefix_output => 'prefix_ips_output' },
{ name => 'ipset', type => 0, cb_prefix_output => 'prefix_ipset_output' },
];
$self->{maps_counters}->{av} = [
@ -46,6 +48,18 @@ sub set_counters {
}
},
];
$self->{maps_counters}->{avet} = [
{ label => 'avet', set => {
key_values => [ { name => 'human' }, { name => 'value' } ],
threshold_use => 'value_absolute',
output_template => "last refresh is: '%s'",
perfdatas => [
{ label => 'avet_update', value => 'value_absolute',
template => '%d', min => 0, unit => 's' },
],
}
},
];
$self->{maps_counters}->{ips} = [
{ label => 'ips', set => {
key_values => [ { name => 'human' }, { name => 'value' } ],
@ -58,6 +72,18 @@ sub set_counters {
}
},
];
$self->{maps_counters}->{ipset} = [
{ label => 'ipset', set => {
key_values => [ { name => 'human' }, { name => 'value' } ],
threshold_use => 'value_absolute',
output_template => "last refresh is: '%s'",
perfdatas => [
{ label => 'ipset_update', value => 'value_absolute',
template => '%d', min => 0, unit => 's' },
],
}
},
];
}
sub prefix_av_output {
@ -66,12 +92,24 @@ sub prefix_av_output {
return "AV Signature ";
}
sub prefix_avet_output {
my ($self, %options) = @_;
return "AV Extended Signature ";
}
sub prefix_ips_output {
my ($self, %options) = @_;
return "IPS Signature ";
}
sub prefix_ipset_output {
my ($self, %options) = @_;
return "IPS Extended Signature ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
@ -97,24 +135,34 @@ sub manage_selection {
my $oid_fgSysVersionAv = '.1.3.6.1.4.1.12356.101.4.2.1.0';
my $oid_fgSysVersionIps = '.1.3.6.1.4.1.12356.101.4.2.2.0';
my $oid_fgSysVersionAvEt = '.1.3.6.1.4.1.12356.101.4.2.3.0';
my $oid_fgSysVersionIpsEt = '.1.3.6.1.4.1.12356.101.4.2.4.0';
my $result = $self->{snmp}->get_leef(oids => [$oid_fgSysVersionAv, $oid_fgSysVersionIps], nothing_quit => 1);
my $result = $self->{snmp}->get_leef(oids => [$oid_fgSysVersionAv, $oid_fgSysVersionIps, $oid_fgSysVersionAvEt, $oid_fgSysVersionIpsEt], nothing_quit => 1);
my $av_epoch = $self->get_epoch_from_signature(date => $result->{$oid_fgSysVersionAv});
my $ips_epoch = $self->get_epoch_from_signature(date => $result->{$oid_fgSysVersionIps});
my $avet_epoch = $self->get_epoch_from_signature(date => $result->{$oid_fgSysVersionAvEt});
my $ipset_epoch = $self->get_epoch_from_signature(date => $result->{$oid_fgSysVersionIpsEt});
my $now = time();
my $av_diff = $now - $av_epoch;
my $ips_diff = $now - $ips_epoch;
my $avet_diff = $now - $avet_epoch;
my $ipset_diff = $now - $ipset_epoch;
$self->{av} = { human => centreon::plugins::misc::change_seconds(value => $av_diff, start => 'h'),
value => $av_diff };
$self->{ips} = { human => centreon::plugins::misc::change_seconds(value => $ips_diff, start => 'h'),
value => $ips_diff };
value => $ips_diff };
$self->{avet} = { human => centreon::plugins::misc::change_seconds(value => $avet_diff, start => 'h'),
value => $avet_diff };
$self->{ipset} = { human => centreon::plugins::misc::change_seconds(value => $ipset_diff, start => 'h'),
value => $ipset_diff };
}
1;