some fix on kaspersky
This commit is contained in:
parent
ea414df3e3
commit
7ba1bd547a
|
@ -42,9 +42,12 @@ sub custom_status_calc {
|
|||
sub custom_progress_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(label => 'progress',
|
||||
value => $self->{result_values}->{installed},
|
||||
min => 0, max => $self->{result_values}->{total});
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'progress',
|
||||
nlabel => $self->{nlabel},
|
||||
value => $self->{result_values}->{installed},
|
||||
min => 0, max => $self->{result_values}->{total}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_progress_threshold {
|
||||
|
@ -52,9 +55,13 @@ sub custom_progress_threshold {
|
|||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = defined($self->{instance_mode}->{option_results}->{percent}) ? $self->{result_values}->{prct_installed} : $self->{result_values}->{installed} ;
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value,
|
||||
threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $threshold_value,
|
||||
threshold => [
|
||||
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' }
|
||||
]
|
||||
);
|
||||
return $exit;
|
||||
}
|
||||
|
||||
|
@ -82,19 +89,26 @@ sub custom_progress_calc {
|
|||
sub custom_expiring_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(label => 'expiring',
|
||||
value => $self->{result_values}->{expiring},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}),
|
||||
min => 0);
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'expiring',
|
||||
nlabel => $self->{nlabel},
|
||||
value => $self->{result_values}->{expiring},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_expiring_threshold {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{expiring},
|
||||
threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => $self->{result_values}->{expiring},
|
||||
threshold => [
|
||||
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' }
|
||||
]
|
||||
);
|
||||
return $exit;
|
||||
}
|
||||
|
||||
|
@ -119,19 +133,26 @@ sub custom_expiring_calc {
|
|||
sub custom_expired_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(label => 'expired',
|
||||
value => $self->{result_values}->{expired},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}),
|
||||
min => 0);
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'expired',
|
||||
nlabel => $self->{nlabel},
|
||||
value => $self->{result_values}->{expired},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_expired_threshold {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{expired},
|
||||
threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => $self->{result_values}->{expired},
|
||||
threshold => [
|
||||
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' }
|
||||
]
|
||||
);
|
||||
return $exit;
|
||||
}
|
||||
|
||||
|
@ -224,7 +245,7 @@ my %map_status = (
|
|||
0 => 'OK',
|
||||
1 => 'Info',
|
||||
2 => 'Warning',
|
||||
3 => 'Critical',
|
||||
3 => 'Critical'
|
||||
);
|
||||
|
||||
my $oid_deploymentStatus = '.1.3.6.1.4.1.23668.1093.1.1.1';
|
||||
|
@ -240,14 +261,16 @@ my $oid_hostsLicenceExpired = '.1.3.6.1.4.1.23668.1093.1.1.10';
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_deploymentStatus, $oid_hostsInGroups,
|
||||
$oid_hostsWithAntivirus, $oid_hostsRemoteInstallFailed,
|
||||
$oid_licenceExpiringSerial, $oid_licenceExpiredSerial,
|
||||
$oid_licenceExpiringDays, $oid_hostsLicenceExpiring,
|
||||
$oid_hostsLicenceExpired ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_deploymentStatus, $oid_hostsInGroups,
|
||||
$oid_hostsWithAntivirus, $oid_hostsRemoteInstallFailed,
|
||||
$oid_licenceExpiringSerial, $oid_licenceExpiredSerial,
|
||||
$oid_licenceExpiringDays, $oid_hostsLicenceExpiring,
|
||||
$oid_hostsLicenceExpired
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
deploymentStatus => $map_status{$snmp_result->{$oid_deploymentStatus}},
|
||||
|
|
|
@ -49,14 +49,15 @@ sub set_counters {
|
|||
$self->{maps_counters}->{global} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2, warning_default => '%{status} =~ /Warning/i',
|
||||
type => 2,
|
||||
warning_default => '%{status} =~ /Warning/i',
|
||||
critical_default => '%{status} =~ /Critical/i',
|
||||
set => {
|
||||
key_values => [ { name => 'eventsStatus' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'events', nlabel => 'events.critical.count', set => {
|
||||
|
@ -81,18 +82,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
my %map_status = (
|
||||
0 => 'OK',
|
||||
1 => 'Info',
|
||||
2 => 'Warning',
|
||||
3 => 'Critical',
|
||||
3 => 'Critical'
|
||||
);
|
||||
|
||||
my $oid_eventsStatus = '.1.3.6.1.4.1.23668.1093.1.6.1';
|
||||
|
@ -101,14 +95,16 @@ my $oid_criticalEventsCount = '.1.3.6.1.4.1.23668.1093.1.6.3';
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_eventsStatus, $oid_criticalEventsCount ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_eventsStatus, $oid_criticalEventsCount
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
eventsStatus => $map_status{$snmp_result->{$oid_eventsStatus}},
|
||||
criticalEventsCount => $snmp_result->{$oid_criticalEventsCount},
|
||||
criticalEventsCount => $snmp_result->{$oid_criticalEventsCount}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -49,14 +49,15 @@ sub set_counters {
|
|||
$self->{maps_counters}->{global} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2, warning_default => '%{status} =~ /Warning/i',
|
||||
type => 2,
|
||||
warning_default => '%{status} =~ /Warning/i',
|
||||
critical_default => '%{status} =~ /Critical/i',
|
||||
set => {
|
||||
key_values => [ { name => 'fullscanStatus' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'not-scanned', nlabel => 'hosts.unscanned.count', set => {
|
||||
|
@ -85,7 +86,7 @@ my %map_status = (
|
|||
0 => 'OK',
|
||||
1 => 'Info',
|
||||
2 => 'Warning',
|
||||
3 => 'Critical',
|
||||
3 => 'Critical'
|
||||
);
|
||||
|
||||
my $oid_fullscanStatus = '.1.3.6.1.4.1.23668.1093.1.4.1';
|
||||
|
@ -94,14 +95,14 @@ my $oid_hostsNotScannedLately = '.1.3.6.1.4.1.23668.1093.1.4.3';
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_fullscanStatus, $oid_hostsNotScannedLately ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ $oid_fullscanStatus, $oid_hostsNotScannedLately ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
fullscanStatus => $map_status{$snmp_result->{$oid_fullscanStatus}},
|
||||
hostsNotScannedLately => $snmp_result->{$oid_hostsNotScannedLately},
|
||||
hostsNotScannedLately => $snmp_result->{$oid_hostsNotScannedLately}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'new-hosts', nlabel => 'hosts.new.count', set => {
|
||||
|
@ -106,18 +106,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
my %map_status = (
|
||||
0 => 'OK',
|
||||
1 => 'Info',
|
||||
2 => 'Warning',
|
||||
3 => 'Critical',
|
||||
3 => 'Critical'
|
||||
);
|
||||
|
||||
my $oid_logicalNetworkStatus = '.1.3.6.1.4.1.23668.1093.1.5.1';
|
||||
|
@ -129,19 +122,21 @@ my $oid_hostsControlLost = '.1.3.6.1.4.1.23668.1093.1.5.6';
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_logicalNetworkStatus, $oid_hostsFound,
|
||||
$oid_groupsCount, $oid_hostsNotConnectedLongTime,
|
||||
$oid_hostsControlLost ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_logicalNetworkStatus, $oid_hostsFound,
|
||||
$oid_groupsCount, $oid_hostsNotConnectedLongTime,
|
||||
$oid_hostsControlLost
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
logicalNetworkStatus => $map_status{$snmp_result->{$oid_logicalNetworkStatus}},
|
||||
hostsFound => $snmp_result->{$oid_hostsFound},
|
||||
groupsCount => $snmp_result->{$oid_groupsCount},
|
||||
hostsNotConnectedLongTime => $snmp_result->{$oid_hostsNotConnectedLongTime},
|
||||
hostsControlLost => $snmp_result->{$oid_hostsControlLost},
|
||||
hostsControlLost => $snmp_result->{$oid_hostsControlLost}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_
|
|||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("Protection status is '%s'", $self->{result_values}->{status});
|
||||
return $msg;
|
||||
return sprintf("Protection status is '%s'", $self->{result_values}->{status});
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
|
@ -58,7 +57,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'no-antivirus', nlabel => 'protection.hosts.antivirus.notrunning.count', set => {
|
||||
|
@ -89,8 +88,8 @@ sub set_counters {
|
|||
key_values => [ { name => 'hostsNotCuredObject' } ],
|
||||
output_template => '%d host(s) with not cured objects',
|
||||
perfdatas => [
|
||||
{ label => 'not_cured_objects', value => 'hostsNotCuredObject', template => '%d', min => 0 },
|
||||
],
|
||||
{ label => 'not_cured_objects', value => 'hostsNotCuredObject', template => '%d', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'too-many-threats', nlabel => 'protection.hosts.2manythreats.count', set => {
|
||||
|
@ -100,7 +99,7 @@ sub set_counters {
|
|||
{ label => 'too_many_threats', template => '%d', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -119,7 +118,7 @@ my %map_status = (
|
|||
0 => 'OK',
|
||||
1 => 'Info',
|
||||
2 => 'Warning',
|
||||
3 => 'Critical',
|
||||
3 => 'Critical'
|
||||
);
|
||||
|
||||
my $oid_protectionStatus = '.1.3.6.1.4.1.23668.1093.1.3.1';
|
||||
|
@ -132,12 +131,14 @@ my $oid_hostsTooManyThreats = '.1.3.6.1.4.1.23668.1093.1.3.7';
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_protectionStatus, $oid_hostsAntivirusNotRunning,
|
||||
$oid_hostsRealtimeNotRunning, $oid_hostsRealtimeLevelChanged,
|
||||
$oid_hostsNotCuredObject, $oid_hostsTooManyThreats ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_protectionStatus, $oid_hostsAntivirusNotRunning,
|
||||
$oid_hostsRealtimeNotRunning, $oid_hostsRealtimeLevelChanged,
|
||||
$oid_hostsNotCuredObject, $oid_hostsTooManyThreats
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
protectionStatus => $map_status{$snmp_result->{$oid_protectionStatus}},
|
||||
|
@ -145,7 +146,7 @@ sub manage_selection {
|
|||
hostsRealtimeNotRunning => $snmp_result->{$oid_hostsRealtimeNotRunning},
|
||||
hostsRealtimeLevelChanged => $snmp_result->{$oid_hostsRealtimeLevelChanged},
|
||||
hostsNotCuredObject => $snmp_result->{$oid_hostsNotCuredObject},
|
||||
hostsTooManyThreats => $snmp_result->{$oid_hostsTooManyThreats},
|
||||
hostsTooManyThreats => $snmp_result->{$oid_hostsTooManyThreats}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ sub custom_last_perfdata {
|
|||
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'last_server_update',
|
||||
nlabel => $self->{nlabel},
|
||||
value => $self->{result_values}->{diff},
|
||||
unit => 's',
|
||||
min => 0
|
||||
|
@ -58,8 +59,8 @@ sub custom_last_threshold {
|
|||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => $self->{result_values}->{diff},
|
||||
threshold => [
|
||||
{ label => 'critical-' . $self->{label}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{label}, exit_litteral => 'warning' }
|
||||
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' }
|
||||
]
|
||||
);
|
||||
return $exit;
|
||||
|
|
Loading…
Reference in New Issue