Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added mode multi-cpu-load #87

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Modi
|-------------------------------|------------------------------------------------------------------------|
| hardware-health | Check the status of environmental equipment (fans, temperatures, power) |
| cpu-load | Check the CPU load of the device) |
| multi-cpu-load | Check the CPU load of each core of the device |
| memory-usage | Check the memory usage of the device) |
| interface-usage | Check the utilization of interfaces) |
| interface-errors | Check the error-rate of interfaces |
Expand Down
3 changes: 2 additions & 1 deletion plugins-scripts/Classes/CheckPoint/Firewall1.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ sub init {
$self->analyze_and_check_environmental_subsystem("Classes::CheckPoint::Firewall1::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::CheckPoint::Firewall1::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::multi-load/) {
$self->analyze_and_check_multicpu_subsystem("Classes::CheckPoint::Firewall1::Component::MultiCpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::CheckPoint::Firewall1::Component::MemSubsystem");
} elsif ($self->mode =~ /device::ha::/) {
Expand All @@ -23,4 +25,3 @@ sub init {
$self->no_such_mode();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package Classes::CheckPoint::Firewall1::Component::MultiCpuSubsystem;
our @ISA = qw(Monitoring::GLPlugin::SNMP::Item);
use strict;

sub init {
my $self = shift;
$self->get_snmp_tables('CHECKPOINT-MIB', [
['cpus', 'multiProcTable', 'Classes::CheckPoint::Firewall1::Component::MultiCpuSubsystem::CPU'],
]);
}

sub check {
my $self = shift;
foreach (sort {$a->{multiProcIndex} <=> $b->{multiProcIndex}} @{$self->{cpus}}) {
$_->check();
}
if ($self->opts->report eq "short") {
$self->clear_ok();
$self->add_ok('no problems') if ! $self->check_messages();
}
}

package Classes::CheckPoint::Firewall1::Component::MultiCpuSubsystem::CPU;
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem);
use strict;

sub check {
my $self = shift;
$self->add_info(sprintf 'cpu%s usage is %.2f%%',
$self->{multiProcIndex},
$self->{multiProcUsage});
$self->set_thresholds(metric => "cpu".$self->{multiProcIndex}."_usage", warning => 80, critical => 90);
$self->add_message($self->check_thresholds(metric => "cpu".$self->{multiProcIndex}."_usage", value => $self->{multiProcUsage}));
$self->add_perfdata(
label => "cpu".$self->{multiProcIndex}."_usage",
value => $self->{multiProcUsage},
uom => '%',
);
}
3 changes: 2 additions & 1 deletion plugins-scripts/Classes/CheckPoint/VSX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ sub init {
$self->analyze_and_check_environmental_subsystem("Classes::CheckPoint::Firewall1::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::CheckPoint::Firewall1::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::multi-load/) {
$self->analyze_and_check_multicpu_subsystem("Classes::CheckPoint::Firewall1::Component::MultiCpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::CheckPoint::Firewall1::Component::MemSubsystem");
} elsif ($self->mode =~ /device::ha::/) {
Expand All @@ -23,4 +25,3 @@ sub init {
$self->no_such_mode();
}
}

1 change: 1 addition & 0 deletions plugins-scripts/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ EXTRA_MODULES=\
Classes/CheckPoint/Firewall1/Component/FwSubsystem.pm \
Classes/CheckPoint/Firewall1/Component/HaSubsystem.pm \
Classes/CheckPoint/Firewall1/Component/CpuSubsystem.pm \
Classes/CheckPoint/Firewall1/Component/MultiCpuSubsystem.pm \
Classes/CheckPoint/Firewall1/Component/MemSubsystem.pm \
Classes/CheckPoint/Firewall1.pm \
Classes/CheckPoint/VSX/Component/FwSubsystem.pm \
Expand Down
6 changes: 6 additions & 0 deletions plugins-scripts/check_nwc_health.pl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
alias => ['cpu-usage'],
help => 'Check the CPU load of the device',
);
$plugin->add_mode(
internal => 'device::hardware::multi-load',
spec => 'multi-cpu-load',
alias => undef,
help => 'Check the CPU load of each core of the device',
);
$plugin->add_mode(
internal => 'device::hardware::memory',
spec => 'memory-usage',
Expand Down