diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php
index 970cefa30..a2afad499 100644
--- a/modules/monitoring/application/controllers/ListController.php
+++ b/modules/monitoring/application/controllers/ListController.php
@@ -224,16 +224,17 @@ class Monitoring_ListController extends ModuleActionController
'host_name',
'service_description',
'notification_type',
+ 'notification_reason',
'notification_start_time',
'notification_contact',
'notification_information',
- //'notification_timeperiod',
- //'notification_command'
+ 'notification_command'
));
if (!$this->_getParam('sort')) {
// TODO: Remove this once MonitoringView::applyRequestSorting
// applies NotificationView::sortDefaults
- $query->order('time', -1); // Descending
+ $this->_request->setParam('sort', 'notification_start_time');
+ $this->_request->setParam('dir', -1); // Query is still using ASC!?
}
$this->view->notifications = $query->applyRequest($this->_request);
$this->inheritCurrentSortColumn();
diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml
index e05d10fe4..c1e428fda 100644
--- a/modules/monitoring/application/views/scripts/list/notifications.phtml
+++ b/modules/monitoring/application/views/scripts/list/notifications.phtml
@@ -12,7 +12,7 @@
'class' => 'autosubmit'
),
array(
- 'time' => 'Time'
+ 'notification_start_time' => 'Time'
)
);
?>
@@ -20,6 +20,11 @@
+notifications->paginate();
+echo $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve));
+?>
+
@@ -27,13 +32,75 @@
Service |
Type |
Time |
- Time period |
Contact |
Notification command |
Information |
-
+
+
+
+ = $notification->host_name ?>
+ |
+
+ = empty($notification->service_description) ? 'N/A' : $notification->service_description ?>
+ |
+ notification_reason)
+ {
+ case 0:
+ echo 'NORMAL';
+ break;
+ case 1:
+ echo 'ACKNOWLEDGEMENT';
+ break;
+ case 2:
+ echo 'FLAPPINGSTART';
+ break;
+ case 3:
+ echo 'FLAPPINGSTOP';
+ break;
+ case 4:
+ echo 'FLAPPINGDISABLED';
+ break;
+ case 5:
+ echo 'DOWNTIMESTART';
+ break;
+ case 6:
+ echo 'DOWNTIMEEND';
+ break;
+ case 7:
+ echo 'DOWNTIMECANCELLED';
+ break;
+ case 8:
+ if (intval($notification->notification_type) === 0) {
+ echo 'CUSTOM(UP)';
+ } else {
+ echo 'CUSTOM(OK)';
+ }
+ break;
+ case 9:
+ echo 'STALKING';
+ break;
+ default:
+ echo 'UNKNOWN';
+ }
+?>
+ |
+
+ = $notification->notification_start_time ?>
+ |
+
+ = $notification->notification_contact ?>
+ |
+
+ = $notification->notification_command ?>
+ |
+
+ = $this->escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?>
+ |
+
+
\ No newline at end of file
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php
index 0a9af695d..c62ce8c0e 100644
--- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php
+++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php
@@ -27,7 +27,7 @@ namespace Monitoring\Backend\Ido\Query;
/**
- * Handling notification queries
+ * NotificationQuery
*/
class NotificationQuery extends AbstractQuery
{
@@ -38,19 +38,20 @@ class NotificationQuery extends AbstractQuery
*/
protected $columnMap = array(
'notification' => array(
- 'notification_type' => '',
- 'notification_start_time' => '',
- 'notification_information' => ''
+ 'notification_type' => 'n.notification_type',
+ 'notification_reason' => 'n.notification_reason',
+ 'notification_start_time' => 'n.start_time',
+ 'notification_information' => 'n.output'
),
'objects' => array(
- 'host_name' => '',
- 'service_description' => ''
+ 'host_name' => 'o.name1',
+ 'service_description' => 'o.name2'
),
'contact' => array(
- 'notification_contact' => ''
+ 'notification_contact' => 'c_o.name1'
),
- 'timeperiod' => array(
- 'notification_timeperiod' => ''
+ 'command' => array(
+ 'notification_command' => 'cmd_o.name1'
)
);
@@ -59,7 +60,10 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinBaseTables()
{
-
+ $this->baseQuery = $this->db->select()->from(array(
+ 'n' => $this->prefix . 'notifications'
+ ));
+ $this->joinedVirtualTables = array('notification' => true);
}
/**
@@ -67,7 +71,12 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinObjects()
{
-
+ $this->baseQuery->joinInner(
+ array(
+ 'o' => $this->prefix . 'objects'
+ ),
+ 'n.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)'
+ );
}
/**
@@ -75,14 +84,42 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinContact()
{
-
+ $this->baseQuery->joinInner(
+ array(
+ 'c' => $this->prefix . 'contactnotifications'
+ ),
+ 'n.notification_id = c.notification_id'
+ );
+ $this->baseQuery->joinInner(
+ array(
+ 'c_o' => $this->prefix . 'objects'
+ ),
+ 'c.contact_object_id = c_o.object_id'
+ );
}
/**
- * Fetch assigned time period for each notification
+ * Fetch name of the command which was used to send out a notification
*/
- protected function joinTimeperiod()
+ protected function joinCommand()
{
-
+ $this->baseQuery->joinInner(
+ array(
+ 'cmd_c' => $this->prefix . 'contactnotifications'
+ ),
+ 'n.notification_id = cmd_c.notification_id'
+ );
+ $this->baseQuery->joinInner(
+ array(
+ 'cmd_m' => $this->prefix . 'contactnotificationmethods'
+ ),
+ 'cmd_c.notification_id = cmd_m.contactnotification_id'
+ );
+ $this->baseQuery->joinInner(
+ array(
+ 'cmd_o' => $this->prefix . 'objects'
+ ),
+ 'cmd_m.command_object_id = cmd_o.object_id'
+ );
}
}
\ No newline at end of file
diff --git a/modules/monitoring/library/Monitoring/View/NotificationView.php b/modules/monitoring/library/Monitoring/View/NotificationView.php
index cea4df1b7..279d324b6 100644
--- a/modules/monitoring/library/Monitoring/View/NotificationView.php
+++ b/modules/monitoring/library/Monitoring/View/NotificationView.php
@@ -38,10 +38,10 @@ class NotificationView extends MonitoringView
'host_name',
'service_description',
'notification_type',
+ 'notification_reason',
'notification_start_time',
'notification_contact',
'notification_information',
- 'notification_timeperiod',
'notification_command'
);