Add a closure

This commit is contained in:
Quentin Garnier 2014-07-27 18:03:31 +02:00
parent b6ce5716e3
commit 664548ff00
1 changed files with 7 additions and 2 deletions

View File

@ -118,8 +118,8 @@ sub calc {
sub threshold_check {
my ($self, %options) = @_;
if (defined($self->{closure_custom_threshpld})) {
return &{$self->{closure_custom_threshold}}($self);
if (defined($self->{closure_custom_threshpld_check})) {
return &{$self->{closure_custom_threshold_check}}($self, %options);
}
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{label};
@ -174,6 +174,11 @@ sub output {
sub perfdata {
my ($self, %options) = @_;
if (defined($self->{closure_custom_perfdata})) {
return &{$self->{closure_custom_perfdata}}($self, %options);
}
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{label};
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{label};