remove time elapsed

This commit is contained in:
Lotfi zaouche 2020-05-26 16:24:54 +00:00
parent bcf4e19365
commit cc39987318
2 changed files with 14 additions and 27 deletions

View File

@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use bigint;
use Time::Seconds;
# use Time::Seconds;
use Digest::MD5 qw(md5_hex);
sub set_counters {
@ -77,14 +77,14 @@ sub custom_block_output {
if (0 eq $self->{result_values}->{block_count}) {
return sprintf("No block yet...");
} else {
my $time_elapsed = time() - $self->{result_values}->{last_block_ts};
my $t = Time::Seconds->new($time_elapsed);
# my $time_elapsed = time() - $self->{result_values}->{last_block_ts};
# my $t = Time::Seconds->new($time_elapsed);
return sprintf(
"Block frequency: '%.2f/min', Last block (#%s) was %s ago",
"Block frequency: '%.2f/min', Last block (#%s)",# was %s ago",
$self->{result_values}->{block_count},
$self->{result_values}->{last_block},
$t->pretty
# $t->pretty
);
}
}
@ -95,14 +95,11 @@ sub custom_transaction_output {
if (0 eq $self->{result_values}->{transaction_count}) {
return sprintf("No transaction yet...");
} else {
my $time_elapsed = time() - $self->{result_values}->{last_transaction_ts};
my $t = Time::Seconds->new($time_elapsed);
return sprintf(
"Transaction frequency: '%.2f/min', Last transaction (#%s) was %s ago",
"Transaction frequency: '%.2f/min', Last transaction (#%s)",
$self->{result_values}->{transaction_count},
$self->{result_values}->{last_transaction},
$t->pretty
$self->{result_values}->{last_transaction}
);
}
}
@ -113,14 +110,11 @@ sub custom_fork_output {
if (0 eq $self->{result_values}->{fork_count}) {
return sprintf("No fork occurred yet...");
} else {
my $time_elapsed = time() - $self->{result_values}->{last_fork_ts};
my $t = Time::Seconds->new($time_elapsed);
return sprintf(
"Fork frequency: '%.2f/min', Last fork (#%s) was %s ago",
"Fork frequency: '%.2f/min', Last fork (#%s)",
$self->{result_values}->{fork_count},
$self->{result_values}->{last_fork},
$t->pretty
$self->{result_values}->{last_fork}
);
}
}

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use bigint;
use Time::Seconds;
use Digest::MD5 qw(md5_hex);
sub set_counters {
@ -124,14 +123,11 @@ sub custom_event_output {
if (0 eq $self->{result_values}->{last_event}) {
return sprintf("No event yet...");
} else {
my $time_elapsed = time() - $self->{result_values}->{last_event_ts};
my $t = Time::Seconds->new($time_elapsed);
return sprintf(
"Event frequency: %.2f/min, Last event (#%s) was %s ago in block #%s",
"Event frequency: %.2f/min, Last event (#%s) was in block #%s",
$self->{result_values}->{event_count},
$self->{result_values}->{last_event},
$t->pretty,
$self->{result_values}->{last_event_block}
);
}
@ -143,14 +139,11 @@ sub custom_miner_output {
if (0 eq $self->{result_values}->{last_mining}) {
return sprintf("No validation yet...");
} else {
my $time_elapsed = time() - $self->{result_values}->{last_mining_ts};
my $t = Time::Seconds->new($time_elapsed);
return sprintf(
"Mining frequency: %.2f/min, Last validation (#%s) was %s ago for block #%s",
"Mining frequency: %.2f/min, Last validation (#%s) ago for block #%s",
$self->{result_values}->{mining_count},
$self->{result_values}->{last_mining},
$t->pretty,
$self->{result_values}->{last_mining_block}
);
}