3 require_once( dirname(__FILE__
).'/base/basedowntime.php' );
6 * Describes a single object from livestatus
8 class Downtime_Model
extends BaseDowntime_Model
{
10 * A list of column dependencies for custom columns
12 static public $rewrite_columns = array(
13 'triggered_by_text' => array('triggered_by')
17 * Get triggered by object, as a text.
19 public function get_triggered_by_text() {
20 // TODO: Don't nest queries... Preformance!!! (Do this in livestatus?)
21 $trig_id = $this->get_triggered_by();
22 if( !$trig_id ) return 'N/A';
23 $trig = DowntimePool_Model
::all()->reduce_by('id', $trig_id, '=')->it(array('host.name', 'service.description'), array(), 1, 0)->current();
24 if( !$trig ) return 'Unknown';
25 $host = $trig->get_host()->get_name();
26 $svc = $trig->get_service()->get_description();
27 if( $svc ) return $host.';'.$svc;