monitoring/process: was broken, fix it

Stumbled across two issues here:

* It's currently not possible to fetch all (*) columns from a DataView
* Backends are not able to tell their names

Worked around the first issue by naming all columns and implemented a
quick & dirty solution for the second one.
This commit is contained in:
Thomas Gelf 2014-06-21 04:25:02 +02:00
parent 7f53ba11cf
commit 57ad88c38c
2 changed files with 45 additions and 4 deletions

View File

@ -56,12 +56,38 @@ class Monitoring_ProcessController extends MonitoringController
$this->getTabs()->activate('info');
$this->setAutorefreshInterval(10);
// TODO: This one is broken right now, doublecheck default columns
// TODO: This one is broken right now, doublecheck default columns
$this->view->programstatus = $this->backend->select()
->from('programstatus')
->from('programstatus', array(
'id',
'status_update_time',
'program_start_time',
'program_end_time',
'is_currently_running',
'process_id',
'daemon_mode',
'last_command_check',
'last_log_rotation',
'notifications_enabled',
'disable_notif_expire_time',
'active_service_checks_enabled',
'passive_service_checks_enabled',
'active_host_checks_enabled',
'passive_host_checks_enabled',
'event_handlers_enabled',
'flap_detection_enabled',
'failure_prediction_enabled',
'process_performance_data',
'obsess_over_hosts',
'obsess_over_services',
'modified_host_attributes',
'modified_service_attributes',
'global_host_event_handler',
'global_service_event_handler'
))
->getQuery()->fetchRow();
$this->view->backendName = $this->backend->getDefaultBackendName();
$this->view->backendName = $this->backend->getName();
}
public function performanceAction()

View File

@ -32,6 +32,8 @@ class Backend implements Selectable, Queryable, ConnectionInterface
*/
protected $type;
protected $name;
/**
* Create a new backend
*
@ -44,6 +46,17 @@ class Backend implements Selectable, Queryable, ConnectionInterface
$this->type = $type;
}
// Temporary workaround, we have no way to know our name
protected function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
/**
* Create a backend
*
@ -88,7 +101,9 @@ class Backend implements Selectable, Queryable, ConnectionInterface
// TODO(el): The resource should set the table prefix
$resource->setTablePrefix('icinga_');
}
return new Backend($resource, $backendConfig->type);
$backend = new Backend($resource, $backendConfig->type);
$backend->setName($backendName);
return $backend;
}
public function getResource()