diff --git a/modules/monitoring/application/controllers/MultiController.php b/modules/monitoring/application/controllers/MultiController.php index a6efcad25..723a7f576 100644 --- a/modules/monitoring/application/controllers/MultiController.php +++ b/modules/monitoring/application/controllers/MultiController.php @@ -45,54 +45,68 @@ class Monitoring_MultiController extends ActionController public function hostAction() { $hosts = array(); - $warnings = array(); + $hostnames = array(); + $comments = array(); + $downtimes = array(); + + $errors = array(); foreach ($this->view->queries as $index => $query) { - if (array_key_exists('host', $query)) { - $host = Host::fetch($this->backend, $query['host']); - $host->prefetch(); - $hosts[] = $host; - } else { - $warnings[] = 'Query ' . $index . ' misses property host.'; + if (!array_key_exists('host', $query)) { + $errors[] = 'Query ' . $index . ' misses property host.'; + continue; } + + $host = Host::fetch($this->backend, $query['host']); + foreach ($host->comments as $comment) { + $comments[$comment->comment_id] = null; + } + if ($host->host_in_downtime) { + $downtimes[] += $host->host_in_downtime; + } + $hostnames[] = $host->host_name; + $hosts[] = $host; } - $this->view->commands = array( - 'host' => array( - ), - 'service' => array( - - ), - 'notification' => array( - - ), - '' - ); $this->view->objects = $this->view->hosts = $hosts; - $this->view->warnings = $warnings; + $this->view->comments = array_keys($comments); + $this->view->hostnames = $hostnames; + $this->view->downtimes = $downtimes; + $this->view->errors = $errors; } public function serviceAction() { $services = array(); - $warnings = array(); + $comments = array(); + $downtimes = array(); + + $errors = array(); foreach ($this->view->queries as $index => $query) { if (!array_key_exists('host', $query)) { - $warnings[] = 'Query ' . $index . ' misses property host.'; + $errors[] = 'Query ' . $index . ' misses property host.'; continue; } if (!array_key_exists('service', $query)) { - $warnings[] = 'Query ' . $index . ' misses property service.'; + $errors[] = 'Query ' . $index . ' misses property service.'; continue; } - $service = Service::fetch($this->backend, $query['host'], $query['service']); - $service->prefetch(); - $services[] = $service; - } + $service = Service::fetch($this->backend, $query['host'], $query['service']); + foreach ($service->comments as $comment) { + $comments[$comment->comment_id] = null; + } + if ($service->service_in_downtime) { + $downtimes[] += $service->service_in_downtime; + } + $hostnames[] = $service->host_name; + $services[] = $service; + } $this->view->objects = $this->view->services = $services; - $this->view->warnings = $warnings; + $this->view->comments = array_keys($comments); + $this->view->downtimes = $downtimes; + $this->view->errors = $errors; } public function notificationAction() @@ -102,7 +116,7 @@ class Monitoring_MultiController extends ActionController public function historyAction() { - + } /** diff --git a/modules/monitoring/application/forms/Command/MultiFlagForm.php b/modules/monitoring/application/forms/Command/MultiFlagForm.php new file mode 100644 index 000000000..ccfe1c59c --- /dev/null +++ b/modules/monitoring/application/forms/Command/MultiFlagForm.php @@ -0,0 +1,15 @@ +commandInformation[$command]; + + } + /** * Information about interface commands * @@ -85,14 +98,15 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { */ private static $commandInformation = array( self::CMD_DISABLE_ACTIVE_CHECKS => array( - 'Disable Active Checks For This %s', // Long description (mandatory) - 'Disable Active Checks', // Short description (mandatory) - '', // Icon anything (optional) - '' // Button css cls (optional) + 'Disable Active Checks For This %s', + 'Disable Active Checks', + '', + '' ), self::CMD_ENABLE_ACTIVE_CHECKS => array( 'Enable Active Checks For This %s', 'Enable Active Checks', + '', '' ), self::CMD_RESCHEDULE_NEXT_CHECK => array( @@ -104,66 +118,79 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { self::CMD_SUBMIT_PASSIVE_CHECK_RESULT => array( 'Submit Passive Check Result', 'Submit Check Result', + '', '' ), self::CMD_STOP_OBSESSING => array( 'Stop Obsessing Over This %s', 'Stop Obsessing', + '', '' ), self::CMD_START_OBSESSING => array( 'Start Obsessing Over This %s', 'Start Obsessing', + '', '' ), self::CMD_STOP_ACCEPTING_PASSIVE_CHECKS => array( 'Stop Accepting Passive Checks For This %s', 'Stop Passive Checks', + '', '' ), self::CMD_START_ACCEPTING_PASSIVE_CHECKS => array( 'Start Accepting Passive Checks For This %s', 'Start Passive Checks', + '', '' ), self::CMD_DISABLE_NOTIFICATIONS => array( 'Disable Notifications For This %s', 'Disable Notifications', + '', '' ), self::CMD_ENABLE_NOTIFICATIONS => array( 'Enable Notifications For This %s', 'Enable Notifications', + '', '' ), self::CMD_SEND_CUSTOM_NOTIFICATION => array( 'Send Custom %s Notification', 'Send Notification', + '', '' ), self::CMD_SCHEDULE_DOWNTIME => array( 'Schedule Downtime For This %s', 'Schedule Downtime', + '', '' ), self::CMD_SCHEDULE_DOWNTIMES_TO_ALL => array( 'Schedule Downtime For This %s And All Services', 'Schedule Services Downtime', + '', '' ), self::CMD_REMOVE_DOWNTIMES_FROM_ALL => array( 'Remove Downtime(s) For This %s And All Services', 'Remove Downtime(s)', + '', '' ), self::CMD_DISABLE_NOTIFICATIONS_FOR_ALL => array( 'Disable Notification For All Service On This %s', 'Disable Service Notifications', + '', '' ), self::CMD_ENABLE_NOTIFICATIONS_FOR_ALL => array( 'Enable Notification For All Service On This %s', 'Enable Service Notifications', + '', '' ), self::CMD_RESCHEDULE_NEXT_CHECK_TO_ALL => array( @@ -175,36 +202,43 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { self::CMD_DISABLE_ACTIVE_CHECKS_FOR_ALL => array( 'Disable Checks For All Services On This %s', 'Disable Service Checks', + '', '' ), self::CMD_ENABLE_ACTIVE_CHECKS_FOR_ALL => array( 'Enable Checks For All Services On This %s', 'Enable Service Checks', + '', '' ), self::CMD_DISABLE_EVENT_HANDLER => array( 'Disable Event Handler For This %s', 'Disable Event Handler', + '', '' ), self::CMD_ENABLE_EVENT_HANDLER => array( 'Enable Event Handler For This %s', 'Enable Event Handler', + '', '' ), self::CMD_DISABLE_FLAP_DETECTION => array( 'Disable Flap Detection For This %s', 'Disable Flap Detection', + '', '' ), self::CMD_ENABLE_FLAP_DETECTION => array( 'Enable Flap Detection For This %s', 'Enable Flap Detection', + '', '' ), self::CMD_ADD_COMMENT => array( 'Add New %s Comment', 'Add Comment', + '', '' ), self::CMD_RESET_ATTRIBUTES => array( @@ -228,7 +262,8 @@ class Zend_View_Helper_CommandButton extends Zend_View_Helper_Abstracts { self::CMD_DELAY_NOTIFICATION => array( 'Delay Next %s Notification', 'Delay Notification', + '', '' - ), + ) ); } \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/multi/components/comments.phtml b/modules/monitoring/application/views/scripts/multi/components/comments.phtml index b3d9bbc7f..2b81ad9e6 100644 --- a/modules/monitoring/application/views/scripts/multi/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/comments.phtml @@ -1 +1,24 @@ - +