From 18dbd5ed1482e1e745c34853da35d4df2c85b7c5 Mon Sep 17 00:00:00 2001 From: Lotfi zaouche Date: Mon, 11 May 2020 18:32:33 +0000 Subject: [PATCH] code to be completed 2/2 --- blockchain/parity/ethpoller/mode/disk.pm | 2 +- blockchain/parity/ethpoller/mode/stats.pm | 6 +++--- blockchain/parity/ethpoller/mode/tracking.pm | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blockchain/parity/ethpoller/mode/disk.pm b/blockchain/parity/ethpoller/mode/disk.pm index bd5158c28..586d41da9 100644 --- a/blockchain/parity/ethpoller/mode/disk.pm +++ b/blockchain/parity/ethpoller/mode/disk.pm @@ -69,7 +69,7 @@ sub set_counters { }, { label => 'disk_usage', nlabel => 'eth.poller.disk.usage', set => { key_values => [ { name => 'disk_usage' } ], - output_template => "Disk usage: %d %", + output_template => "Disk usage: %d %%", perfdatas => [ { label => 'disk_usage', value => 'disk_usage_absolute', template => '%d', min => 0 } ], diff --git a/blockchain/parity/ethpoller/mode/stats.pm b/blockchain/parity/ethpoller/mode/stats.pm index 10acb6bef..e0cf28b7b 100644 --- a/blockchain/parity/ethpoller/mode/stats.pm +++ b/blockchain/parity/ethpoller/mode/stats.pm @@ -110,12 +110,12 @@ sub manage_selection { $datas->{last_tx_count} = $result->{block}->{count}; use Data::Dumper; - print Dumper($old_timestamp); + print Dumper($old_tx_timestamp); my $res_timestamp = 0; if ($old_block_count && $old_block_timestamp) { - $res_timestamp = $result->{block}->{timestamp}) == 0 ? '' : $result->{block}->{timestamp})); + $res_timestamp = $result->{block}->{timestamp} == 0 ? '' : $result->{block}->{timestamp}; my $calculated_block_freq = ($result->{block}->{count} - $old_block_count) / (time() - $old_block_timestamp); $self->{block} = { block_freq => $calculated_block_freq }; $self->{output}->output_add(severity => 'OK', long_msg => 'Last block (#' . $result->{block}->{count} . ') was at ' . $res_timestamp); @@ -124,7 +124,7 @@ sub manage_selection { } if ($old_tx_count && $old_tx_timestamp) { - $res_timestamp = $result->{transaction}->{timestamp}) == 0 ? '' : $result->{transaction}->{timestamp})); + $res_timestamp = $result->{transaction}->{timestamp} == 0 ? '' : $result->{transaction}->{timestamp}; my $calculated_tx_freq = ($result->{transaction}->{count} - $old_tx_count) / (time() - $old_tx_timestamp); $self->{transaction} = { transaction_freq => $calculated_tx_freq }; $self->{output}->output_add(severity => 'OK', long_msg => 'Last transaction (#' . $result->{transaction}->{count} . ') was at ' . $res_timestamp); diff --git a/blockchain/parity/ethpoller/mode/tracking.pm b/blockchain/parity/ethpoller/mode/tracking.pm index 3fbb113dc..49a927894 100644 --- a/blockchain/parity/ethpoller/mode/tracking.pm +++ b/blockchain/parity/ethpoller/mode/tracking.pm @@ -132,7 +132,7 @@ sub manage_selection { my $old_event_count = $self->{statefile_cache}->get(name => 'last_event_count'); #get the id last_event_count $datas->{$event->{id}}->{last_event_timestamp} = time(); - $datas->{$event->{id}}->{last_event_count} = $result->{block}->{count}; + $datas->{$event->{id}}->{last_event_count} = $event->{count}; if ($old_event_count && $old_event_timestamp) { $calculated_frequency = ($event->{count} - $old_event_count) / (time() - $old_event_timestamp); @@ -164,7 +164,7 @@ sub manage_selection { my $old_miner_count = $self->{statefile_cache}->get(name => 'last_miner_count'); #get the id last_miner_count $datas->{$miner->{id}}->{last_miner_timestamp} = time(); - $datas->{$miner->{id}}->{last_miner_count} = $result->{block}->{count}; + $datas->{$miner->{id}}->{last_miner_count} = $miner->{count}; if ($old_miner_timestamp && $old_miner_timestamp) { $calculated_frequency = ($miner->{count} - $old_miner_count) / (time() - $old_miner_timestamp); @@ -196,7 +196,7 @@ sub manage_selection { $datas->{$balance->{id}}->{last_balance} = $balance->{balance}; if ($old_balance) { - $calculated_diff = ($balance->{balance} - $old_balance) / ($old_balance); + my $calculated_diff = ($balance->{balance} - $old_balance) / ($old_balance); $self->{balances}->{$balance->{id}}->{display} = $balance->{label}; $self->{balances}->{$balance->{id}}->{balance} = $calculated_diff;