mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
hardened cyberoam
This commit is contained in:
parent
83924b35c6
commit
21c699408b
@ -23,32 +23,32 @@ package network::cyberoam::snmp::mode::components::service;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my %map_status = (
|
my $map_status = {
|
||||||
1 => 'untouched', 2 => 'stopped', 3 => 'initializing', 4 => 'running', 5 => 'exiting',
|
1 => 'untouched', 2 => 'stopped', 3 => 'initializing', 4 => 'running', 5 => 'exiting',
|
||||||
6 => 'dead', 7 => 'unregistered',
|
6 => 'dead', 7 => 'unregistered',
|
||||||
);
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
pop3Service => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.1', map => \%map_status, type => 'pop3' },
|
pop3Service => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.1', map => $map_status, type => 'pop3' },
|
||||||
imap4Service => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.2', map => \%map_status, type => 'imap4' },
|
imap4Service => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.2', map => $map_status, type => 'imap4' },
|
||||||
smtpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.3', map => \%map_status, type => 'smtp' },
|
smtpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.3', map => $map_status, type => 'smtp' },
|
||||||
ftpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.4', map => \%map_status, type => 'ftp' },
|
ftpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.4', map => $map_status, type => 'ftp' },
|
||||||
httpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.5', map => \%map_status, type => 'http' },
|
httpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.5', map => $map_status, type => 'http' },
|
||||||
avService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.6', map => \%map_status, type => 'av' },
|
avService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.6', map => $map_status, type => 'av' },
|
||||||
asService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.7', map => \%map_status, type => 'as' },
|
asService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.7', map => $map_status, type => 'as' },
|
||||||
dnsService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.8', map => \%map_status, type => 'dns' },
|
dnsService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.8', map => $map_status, type => 'dns' },
|
||||||
haService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.9', map => \%map_status, type => 'ha' },
|
haService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.9', map => $map_status, type => 'ha' },
|
||||||
idpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.10', map => \%map_status, type => 'idp' },
|
idpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.10', map => $map_status, type => 'idp' },
|
||||||
apacheService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.11', map => \%map_status, type => 'apache' },
|
apacheService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.11', map => $map_status, type => 'apache' },
|
||||||
ntpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.12', map => \%map_status, type => 'ntp' },
|
ntpService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.12', map => $map_status, type => 'ntp' },
|
||||||
tomcatService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.13', map => \%map_status, type => 'tomcat' },
|
tomcatService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.13', map => $map_status, type => 'tomcat' },
|
||||||
sslvpnService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.14', map => \%map_status, type => 'sslvpn' },
|
sslvpnService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.14', map => $map_status, type => 'sslvpn' },
|
||||||
DataBaseService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.15', map => \%map_status, type => 'database' },
|
DataBaseService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.15', map => $map_status, type => 'database' },
|
||||||
networkService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.16', map => \%map_status, type => 'network' },
|
networkService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.16', map => $map_status, type => 'network' },
|
||||||
garnerService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.17', map => \%map_status, type => 'garner' },
|
garnerService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.17', map => $map_status, type => 'garner' },
|
||||||
droutingService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.18', map => \%map_status, type => 'drouting' },
|
droutingService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.18', map => $map_status, type => 'drouting' },
|
||||||
sshdService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.19', map => \%map_status, type => 'sshd' },
|
sshdService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.19', map => $map_status, type => 'sshd' },
|
||||||
dgdService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.20', map => \%map_status, type => 'dgd' },
|
dgdService => { oid => '.1.3.6.1.4.1.21067.2.1.2.10.20', map => $map_status, type => 'dgd' },
|
||||||
};
|
};
|
||||||
my $oid_serviceStats = '.1.3.6.1.4.1.21067.2.1.2.10';
|
my $oid_serviceStats = '.1.3.6.1.4.1.21067.2.1.2.10';
|
||||||
|
|
||||||
@ -68,19 +68,28 @@ sub check {
|
|||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_serviceStats}, instance => '0');
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_serviceStats}, instance => '0');
|
||||||
|
|
||||||
foreach (keys %{$mapping}) {
|
foreach (keys %{$mapping}) {
|
||||||
|
next if (!defined($result->{$_}));
|
||||||
next if ($self->check_filter(section => 'service', instance => $mapping->{$_}->{type}));
|
next if ($self->check_filter(section => 'service', instance => $mapping->{$_}->{type}));
|
||||||
|
|
||||||
$self->{components}->{service}->{total}++;
|
$self->{components}->{service}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("service '%s' status is '%s' [instance: %s].",
|
$self->{output}->output_add(
|
||||||
$mapping->{$_}->{type}, $result->{$_},
|
long_msg => sprintf(
|
||||||
$mapping->{$_}->{type}
|
"service '%s' status is '%s' [instance: %s].",
|
||||||
));
|
$mapping->{$_}->{type}, $result->{$_},
|
||||||
|
$mapping->{$_}->{type}
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(label => 'default', section => 'service', instance => $mapping->{$_}->{type}, value => $result->{$_});
|
my $exit = $self->get_severity(label => 'default', section => 'service', instance => $mapping->{$_}->{type}, value => $result->{$_});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("service '%s' status is '%s'",
|
severity => $exit,
|
||||||
$mapping->{$_}->{type}, $result->{$_}));
|
short_msg => sprintf(
|
||||||
|
"service '%s' status is '%s'",
|
||||||
|
$mapping->{$_}->{type},
|
||||||
|
$result->{$_}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,8 @@ sub new {
|
|||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_performance => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_performance => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user