#586 do not show poller performance rows for still running jobs

This commit is contained in:
Oliver Gorwits
2019-05-27 14:23:09 +01:00
parent 902ab6c5f8
commit 087ca8e33c

View File

@@ -10,13 +10,21 @@ __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('poller_performance');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<ENDSQL
SELECT action, entered, to_char( entered, 'YYYY-MM-DD HH24:MI:SS' ) AS entered_stamp,
COUNT( device ) AS number, MIN( started ) AS start, MAX( finished ) AS end,
justify_interval( extract ( epoch FROM( max( finished ) - min( started ) ) ) * interval '1 second' ) AS elapsed
SELECT action,
entered,
to_char( entered, 'YYYY-MM-DD HH24:MI:SS' ) AS entered_stamp,
COUNT( device ) AS number,
MIN( started ) AS start,
MAX( finished ) AS end,
justify_interval(
extract ( epoch FROM( max( finished ) - min( started ) ) )
* interval '1 second'
) AS elapsed
FROM admin
WHERE action IN ( 'discover', 'macsuck', 'arpnip', 'nbtstat' )
GROUP BY action, entered
HAVING count( device ) > 1
HAVING count( device ) > 1
AND SUM( CASE WHEN status LIKE 'queued%' THEN 1 ELSE 0 END ) = 0
ORDER BY entered DESC, elapsed DESC
LIMIT 30
ENDSQL