1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
4 * Report options for all kinds of Summary reports
6 class Summary_options
extends Report_options
8 public static $type = 'summary';
10 const RECENT_ALERTS
= 1; /**< A summary that lists alerts from newest to oldest */
11 const ALERT_TOTALS
= 2; /**< A summary that displays which ones and how many alerts each object has retrieved */
12 const TOP_ALERT_PRODUCERS
= 3; /**< A summary that displays a top list of the most frequently alerting objects */
14 public function setup_properties()
16 parent
::setup_properties();
17 $this->properties
['summary_type'] = array('type' => 'enum', 'default' => self
::TOP_ALERT_PRODUCERS
, 'options' => array(
18 self
::RECENT_ALERTS
=> _('Most recent alerts'),
19 self
::ALERT_TOTALS
=> _('Alert totals'),
20 self
::TOP_ALERT_PRODUCERS
=> _('Top alert producers')));
21 $this->properties
['standardreport'] = array('type' => 'enum', 'default' => '', 'options' => array(
22 1 => _('Most recent hard alerts'),
23 2 => _('Most recent hard host alerts'),
24 3 => _('Most recent hard service alerts'),
25 4 => _('Top hard alert producers'),
26 5 => _('Top hard host alert producers'),
27 6 => _('Top hard service alert producers')));
29 $this->properties
['alert_types'] = array(
32 'description' => _('Show events for this kind of objects'),
34 3 => _('Host and service alerts'),
35 1 => _('Host alerts'),
36 2 => _('Service alerts'))
38 $this->properties
['state_types'] = array(
41 'description' => _('Restrict events based on which state the event is in (soft vs hard)'),
43 3 => _('Hard and soft states'),
44 2 => _('Hard states'),
45 1 => _('Soft states'))
47 $this->properties
['host_states'] = array(
50 'description' => _('Limit the result set to a certain kind of host states'),
52 7 => _('All host states'),
53 6 => _('Host problem states'),
54 1 => _('Host up states'),
55 2 => _('Host down states'),
56 4 => _('Host unreachable states'))
58 $this->properties
['service_states'] = array(
61 'description' => _('Limit the result set to a certain kind of service states'),
63 15 => _('All service states'),
64 14 => _('Service problem states'),
65 1 => _('Service OK states'),
66 2 => _('Service warning states'),
67 4 => _('Service critical states'),
68 8 => _('Service unknown states'))
70 $this->properties
['summary_items'] = array(
73 'description' => 'Number of summary items to include in reports'
75 $this->properties
['include_long_output'] = array(
78 'description' => 'Set this to include the full plugin output with the output of your reports'
81 $this->rename_options
['displaytype'] = 'summary_type';
82 $this->properties
['report_period']['options']['forever'] = _('Forever');
85 protected function update_value($name, $value)
88 case 'standardreport':
91 $this['report_period'] = 'last7days';
93 $this['summary_type'] = self
::RECENT_ALERTS
;
95 $this['summary_type'] = self
::TOP_ALERT_PRODUCERS
;
97 // By utilizing Report_options::ALL_AUTHORIZED, we pass on the
98 // explicit selection to the report model
100 $this['alert_types'] = 3;
101 $this['state_types'] = 2;
102 $this['report_type'] = 'hosts';
103 $this->options
['objects'] = Report_options
::ALL_AUTHORIZED
;
107 $this['alert_types'] = 1;
108 $this['state_types'] = 2;
109 $this['report_type'] = 'hosts';
110 $this->options
['objects'] = Report_options
::ALL_AUTHORIZED
;
114 $this['alert_types'] = 2;
115 $this['state_types'] = 2;
116 $this['report_type'] = 'services';
117 $this->options
['objects'] = Report_options
::ALL_AUTHORIZED
;
121 var_dump('unknown standard report');
122 Kohana
::debug("Unknown standard report: $value");
127 return parent
::update_value($name, $value);
130 protected function calculate_time($report_period) {
131 if ($report_period === 'forever') {
132 $this->options
['start_time'] = 0;
133 $this->options
['end_time'] = time();
136 return parent
::calculate_time($report_period);