diff --git a/config/modules/monitoring/menu.ini b/config/modules/monitoring/menu.ini
index 058b6162f..ff3aed3b7 100755
--- a/config/modules/monitoring/menu.ini
+++ b/config/modules/monitoring/menu.ini
@@ -13,6 +13,8 @@ Hosts = "/monitoring/list/hosts"
Services = "/monitoring/list/services"
Downtimes = "/monitoring/list/downtimes"
Notifications = "/monitoring/list/notifications"
+Contacts = "/monitoring/list/contacts"
+Contact Groups = "/monitoring/list/contactgroups"
;Remove component as of #4583 since it's not working
;Summaries = "/monitoring/summary/group/by/hostgroup"
diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php
index 4ea9fddd5..5a4eaadb0 100644
--- a/modules/monitoring/application/controllers/ListController.php
+++ b/modules/monitoring/application/controllers/ListController.php
@@ -42,6 +42,8 @@ use \Icinga\Application\Config as IcingaConfig;
use Icinga\Module\Monitoring\DataView\Notification as NotificationView;
use Icinga\Module\Monitoring\DataView\Downtime as DowntimeView;
+use Icinga\Module\Monitoring\DataView\Contact as ContactView;
+use Icinga\Module\Monitoring\DataView\Contactgroup as ContactgroupView;
use Icinga\Module\Monitoring\DataView\HostAndServiceStatus as HostAndServiceStatusView;
class Monitoring_ListController extends ActionController
@@ -114,7 +116,6 @@ class Monitoring_ListController extends ActionController
'host_last_comment',
'host_active_checks_enabled',
'host_passive_checks_enabled'
-
)
)->getQuery();
$this->view->hosts = $query->paginate();
@@ -245,7 +246,62 @@ class Monitoring_ListController extends ActionController
)->getQuery();
$this->view->notifications = $query->paginate();
$this->setupSortControl(array(
- 'notification_start_time' => 'Notification Start'
+ 'notification_start_time' => 'Notification Start'
+ ));
+ $this->handleFormatRequest($query);
+ }
+
+ public function contactsAction()
+ {
+ $query = ContactView::fromRequest(
+ $this->_request,
+ array(
+ 'contact_name',
+ 'contact_id',
+ 'contact_alias',
+ 'contact_email',
+ 'contact_pager',
+ 'contact_notify_service_timeperiod',
+ 'contact_notify_service_recovery',
+ 'contact_notify_service_warning',
+ 'contact_notify_service_critical',
+ 'contact_notify_service_unknown',
+ 'contact_notify_service_flapping',
+ 'contact_notify_service_downtime',
+ 'contact_notify_host_timeperiod',
+ 'contact_notify_host_recovery',
+ 'contact_notify_host_down',
+ 'contact_notify_host_unreachable',
+ 'contact_notify_host_flapping',
+ 'contact_notify_host_downtime',
+ )
+ )->getQuery();
+ $this->view->contacts = $query->paginate();
+ $this->setupSortControl(array(
+ 'contact_name' => 'Name',
+ 'contact_alias' => 'Alias',
+ 'contact_email' => 'Email',
+ 'contact_pager' => 'Pager Address / Number',
+ 'contact_notify_service_timeperiod' => 'Service Notification Timeperiod',
+ 'contact_notify_host_timeperiod' => 'Host Notification Timeperiod'
+ ));
+ $this->handleFormatRequest($query);
+ }
+
+ public function contactgroupsAction()
+ {
+ $query = ContactgroupView::fromRequest(
+ $this->_request,
+ array(
+ 'contactgroup_name',
+ 'contactgroup_alias',
+ 'contact_name'
+ )
+ )->getQuery();
+ $this->view->contactgroups = $query->paginate();
+ $this->setupSortControl(array(
+ 'contactgroup_name' => 'Group Name',
+ 'contactgroup_alias' => 'Group Alias'
));
$this->handleFormatRequest($query);
}
diff --git a/modules/monitoring/application/views/helpers/ContactFlags.php b/modules/monitoring/application/views/helpers/ContactFlags.php
new file mode 100644
index 000000000..e2a9187fd
--- /dev/null
+++ b/modules/monitoring/application/views/helpers/ContactFlags.php
@@ -0,0 +1,40 @@
+ $value) {
+ if (preg_match('/^contact_notify_' . $type . '_.*/', $key) && $value == True) {
+ $option = $this->getNotificationOptionName($key);
+ if (strtolower($option) != 'timeperiod') {
+ array_push($out, $option);
+ }
+ }
+ }
+ return implode($glue, $out);
+ }
+}
+
diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml
new file mode 100644
index 000000000..fb899be72
--- /dev/null
+++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml
@@ -0,0 +1,44 @@
+= $this->tabs->render($this); ?>
+
+getHelper('MonitoringState');
+$knownGroups = array()
+?>
+
+
+ = $this->sortControl->render($this); ?>
+ = $this->paginationControl($contactgroups, null, null, array('preserve' => $this->preserve)); ?>
+
+
+
+ Group Name |
+ Description |
+ Member Name |
+
+
+
+
+
+
+ href('monitoring/show/contacts', array('contact' => $contact->contact_name)); ?>
+
+ contactgroup_name;
+ if (!array_key_exists($groupName, $knownGroups)) {
+ echo '' . $groupName . ' | ' . $contact->contactgroup_alias . ' | ';
+ $knownGroups[$groupName] = True;
+ } else {
+ echo ' | | ';
+ }
+ ?>
+
+
+ = $contact->contact_name ?>
+
+ |
+
+
+
+
+ = $this->paginationControl($contactgroups, null, null, array('preserve' => $this->preserve)); ?>
+
diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml
new file mode 100644
index 000000000..bc308b829
--- /dev/null
+++ b/modules/monitoring/application/views/scripts/list/contacts.phtml
@@ -0,0 +1,41 @@
+= $this->tabs->render($this); ?>
+
+getHelper('MonitoringState');
+$contactHelper = $this->getHelper('ContactFlags');
+?>
+
+
+ = $this->sortControl->render($this); ?>
+ = $this->paginationControl($contacts, null, null, array('preserve' => $this->preserve)); ?>
+
+
+
+ Contact Name |
+ Alias |
+ Email Address |
+ Pager Address / Number |
+ Service Notification Options |
+ Host Notification Options |
+ Service Notification Period |
+ Host Notification Period |
+
+
+
+
+ href('monitoring/show/contacts', array('contact' => $contact->contact_name)); ?>
+
+ = $contact->contact_name ?> |
+ = $contact->contact_alias ?> |
+ = $contact->contact_email ?> |
+ = $contact->contact_pager ?> |
+ = $contactHelper->contactFlags($contact, 'service') ?> |
+ = $contactHelper->contactFlags($contact, 'host') ?> |
+ = $contact->contact_notify_service_timeperiod ?> |
+ = $contact->contact_notify_host_timeperiod ?> |
+
+
+
+
+ = $this->paginationControl($contacts, null, null, array('preserve' => $this->preserve)); ?>
+
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php
index c219ff5a3..575882ba8 100644
--- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php
+++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php
@@ -4,13 +4,12 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query;
class ContactQuery extends AbstractQuery
{
- // TODO: join host/service timeperiod
-
protected $columnMap = array(
'contacts' => array(
+ 'contact_id' => 'c.contact_id',
'contact_name' => 'co.name1 COLLATE latin1_general_ci',
- 'contact_alias' => 'c.alias',
- 'contact_email' => 'c.email_address',
+ 'contact_alias' => 'c.alias COLLATE latin1_general_ci',
+ 'contact_email' => 'c.email_address COLLATE latin1_general_ci',
'contact_pager' => 'c.pager_address',
'contact_has_host_notfications' => 'c.host_notifications_enabled',
'contact_has_service_notfications' => 'c.service_notifications_enabled',
@@ -27,6 +26,10 @@ class ContactQuery extends AbstractQuery
'contact_notify_host_flapping' => 'c.notify_host_flapping',
'contact_notify_host_downtime' => 'c.notify_host_downtime',
),
+ 'timeperiods' => array(
+ 'contact_notify_host_timeperiod' => 'ht.alias COLLATE latin1_general_ci',
+ 'contact_notify_service_timeperiod' => 'st.alias COLLATE latin1_general_ci'
+ ),
'hosts' => array(
'host_object_id' => 'ho.object_id',
'host_name' => 'ho.name1 COLLATE latin1_general_ci',
@@ -87,4 +90,17 @@ class ContactQuery extends AbstractQuery
);
}
+ protected function joinTimeperiods()
+ {
+ $this->baseQuery->join(
+ array('ht' => $this->prefix . 'timeperiods'),
+ 'ht.timeperiod_object_id = c.host_timeperiod_object_id',
+ array()
+ );
+ $this->baseQuery->join(
+ array('st' => $this->prefix . 'timeperiods'),
+ 'st.timeperiod_object_id = c.service_timeperiod_object_id',
+ array()
+ );
+ }
}
diff --git a/modules/monitoring/library/Monitoring/DataView/Contact.php b/modules/monitoring/library/Monitoring/DataView/Contact.php
new file mode 100644
index 000000000..44387b2de
--- /dev/null
+++ b/modules/monitoring/library/Monitoring/DataView/Contact.php
@@ -0,0 +1,61 @@
+ array(
+ 'default_dir' => self::SORT_ASC,
+ 'order' => self::SORT_DESC
+ )
+ );
+ }
+}
diff --git a/modules/monitoring/library/Monitoring/DataView/Contactgroup.php b/modules/monitoring/library/Monitoring/DataView/Contactgroup.php
new file mode 100644
index 000000000..69ade0c90
--- /dev/null
+++ b/modules/monitoring/library/Monitoring/DataView/Contactgroup.php
@@ -0,0 +1,39 @@
+ array(
+ 'default_dir' => self::SORT_ASC,
+ 'order' => self::SORT_DESC
+ )
+ );
+ }
+}
diff --git a/var/log/.gitkeep b/var/log/.gitkeep
old mode 100644
new mode 100755