Added queries for last events per hour, day, week and month
This commit is contained in:
parent
c42ae4a91d
commit
20b024ef02
|
@ -2,7 +2,36 @@
|
||||||
class MonitorsController extends AppController {
|
class MonitorsController extends AppController {
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
$this->set('monitors', $this->Monitor->find('all'));
|
$monitoroptions['fields'] = array('Name', 'Id', 'Function', 'Host');
|
||||||
|
$this->set('monitors', $this->Monitor->find('all', $monitoroptions));
|
||||||
|
|
||||||
|
$elhoptions = array(
|
||||||
|
'conditions' => array('Event.StartTime > DATE_SUB(NOW(), INTERVAL 1 HOUR)'),
|
||||||
|
'group' => array('Event.MonitorId'),
|
||||||
|
'fields' => array('count(Event.Id) AS count')
|
||||||
|
);
|
||||||
|
$this->set('elh', $this->Monitor->Event->find('all', $elhoptions));
|
||||||
|
|
||||||
|
$eldoptions = array(
|
||||||
|
'conditions' => array('Event.StartTime > DATE_SUB(NOW(), INTERVAL 1 DAY)'),
|
||||||
|
'group' => array('Event.MonitorId'),
|
||||||
|
'fields' => array('count(Event.Id) AS count')
|
||||||
|
);
|
||||||
|
$this->set('eld', $this->Monitor->Event->find('all', $eldoptions));
|
||||||
|
|
||||||
|
$elwoptions = array(
|
||||||
|
'conditions' => array('Event.StartTime > DATE_SUB(NOW(), INTERVAL 1 WEEK)'),
|
||||||
|
'group' => array('Event.MonitorId'),
|
||||||
|
'fields' => array('count(Event.Id) AS count')
|
||||||
|
);
|
||||||
|
$this->set('elw', $this->Monitor->Event->find('all', $elwoptions));
|
||||||
|
|
||||||
|
$elmoptions = array(
|
||||||
|
'conditions' => array('Event.StartTime > DATE_SUB(NOW(), INTERVAL 1 MONTH)'),
|
||||||
|
'group' => array('Event.MonitorId'),
|
||||||
|
'fields' => array('count(Event.Id) AS count')
|
||||||
|
);
|
||||||
|
$this->set('elm', $this->Monitor->Event->find('all', $elmoptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view($id = null) {
|
public function view($id = null) {
|
||||||
|
|
Loading…
Reference in New Issue