monitoring: Don't rely on Icinga updating the is_currently_running column

From version to version this column seems to be buggy as it's not being updated when stopping Icinga.

refs #9942
This commit is contained in:
Eric Lippmann 2015-08-18 13:08:03 +02:00
parent 7c7881659d
commit 00e206096d
1 changed files with 10 additions and 9 deletions

View File

@ -4,10 +4,13 @@
namespace Icinga\Module\Monitoring\Backend\Ido\Query; namespace Icinga\Module\Monitoring\Backend\Ido\Query;
/** /**
* Query program status out of database * Program status query
*/ */
class ProgramstatusQuery extends IdoQuery class ProgramstatusQuery extends IdoQuery
{ {
/**
* {@inheritdoc}
*/
protected $columnMap = array( protected $columnMap = array(
'programstatus' => array( 'programstatus' => array(
'id' => 'programstatus_id', 'id' => 'programstatus_id',
@ -15,16 +18,11 @@ class ProgramstatusQuery extends IdoQuery
'program_version' => 'program_version', 'program_version' => 'program_version',
'program_start_time' => 'UNIX_TIMESTAMP(programstatus.program_start_time)', 'program_start_time' => 'UNIX_TIMESTAMP(programstatus.program_start_time)',
'program_end_time' => 'UNIX_TIMESTAMP(programstatus.program_end_time)', 'program_end_time' => 'UNIX_TIMESTAMP(programstatus.program_end_time)',
'is_currently_running' => 'CASE WHEN (programstatus.is_currently_running = 0) 'is_currently_running' => 'CASE WHEN (UNIX_TIMESTAMP(programstatus.status_update_time) + 60 > UNIX_TIMESTAMP(NOW()))
THEN
0
ELSE
CASE WHEN (UNIX_TIMESTAMP(programstatus.status_update_time) + 60 > UNIX_TIMESTAMP(NOW()))
THEN THEN
1 1
ELSE ELSE
0 0
END
END', END',
'process_id' => 'process_id', 'process_id' => 'process_id',
'endpoint_name' => 'endpoint_name', 'endpoint_name' => 'endpoint_name',
@ -50,6 +48,9 @@ class ProgramstatusQuery extends IdoQuery
) )
); );
/**
* {@inheritdoc}
*/
protected function joinBaseTables() protected function joinBaseTables()
{ {
parent::joinBaseTables(); parent::joinBaseTables();