-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable and disable services notifications during the automatic downtime
- Loading branch information
Showing
2 changed files
with
11 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,8 @@ | |
* Icinga Editor - Downtime or Uptime confirm | ||
* | ||
* @package IcingaEditor | ||
* @subpackage WebUI | ||
* @author Vitex <[email protected]> | ||
* @copyright 2012 [email protected] (G) | ||
* @copyright 2012-2016 [email protected] (G) | ||
*/ | ||
require_once 'includes/IEInit.php'; | ||
|
||
|
@@ -19,7 +18,8 @@ | |
$state = $oPage->getRequestValue('state'); | ||
|
||
if ($host_id && $state) { | ||
$host = new Engine\Host($host_id); | ||
$host = new Engine\Host($host_id); | ||
$servicesAssigned = $host->getServices(); | ||
$now = time(); | ||
$extCmd = new ExternalCommand(); | ||
switch ($state) { | ||
|
@@ -29,17 +29,23 @@ | |
$extCmd->addCommand('SCHEDULE_HOST_DOWNTIME;'.$host->getName().';'.$now.';'.($now | ||
+ $oneYear).';0;0;'.$oneYear.';'.$owner->getUserLogin().';remote downtime invoke'); | ||
$extCmd->addCommand('DISABLE_HOST_NOTIFICATIONS;'.$host->getName()); | ||
foreach ($servicesAssigned as $serviceDescription) { | ||
$extCmd->addCommand('DISABLE_SVC_NOTIFICATIONS;'.$host->getName().';'.$serviceDescription); | ||
} | ||
$extCmd->addCommand('PROCESS_HOST_CHECK_RESULT;'.$host->getName().';1;Host go Down'); | ||
break; | ||
case 'stop': | ||
$extCmd->addCommand('PROCESS_HOST_CHECK_RESULT;'.$host->getName().';0;Host go Up'); | ||
$extCmd->addCommand('DEL_DOWNTIME_BY_HOST_NAME;'.$host->getName()); | ||
$extCmd->addCommand('ENABLE_HOST_NOTIFICATIONS;'.$host->getName()); | ||
foreach ($servicesAssigned as $serviceDescription) { | ||
$extCmd->addCommand('ENABLE_SVC_NOTIFICATIONS;'.$host->getName().';'.$serviceDescription); | ||
} | ||
break; | ||
default : | ||
$oPage->addStatusMessage(sprintf(_('Unknown state %s.'), $state)); | ||
die(_('State can be only start or stop')); | ||
break; | ||
} | ||
echo implode("\n", $extCmd->executeAll()); | ||
echo implode("<br/>\n", $extCmd->executeAll()); | ||
} |