4 * A model for generating statistics from livestatus
6 class Stats_Model
extends Model
{
8 * return statistics for given type
10 public function get_stats($type, $options = null, $last_program_start = null) {
12 $ls = Livestatus
::instance();
14 case 'host_totals': return $ls->getHostTotals($options);
16 case 'service_totals': return $ls->getServiceTotals($options);
18 case 'host_performance': return $ls->getHostPerformance($last_program_start, $options);
20 case 'service_performance': return $ls->getServicePerformance($last_program_start, $options);
22 default: throw new Exception("unknown type: $type");
25 } catch (LivestatusException
$ex) {