Private GIT

Skip to content
Snippets Groups Projects
Commit 51cb6269 authored by loiclau's avatar loiclau Committed by Kev
Browse files

add multi hg dt

parent 0ee3a69d
Branches
Tags
No related merge requests found
......@@ -578,20 +578,27 @@ class CentreonRtDowntime extends CentreonObject
if ($resource === "") {
throw new CentreonClapiException(self::MISSINGPARAMETER);
}
if ($withServices == 1) {
$withServices = true;
} else {
$withServices = false;
}
$existingHg = array();
$unknownHg = array();
$listHg = explode('|', $resource);
$hostList = $this->hgObject->getHostsByHostgroupName($resource);
//check add services with host
if (count($hostList) == 0) {
throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ' : ' . $resource);
// check if service exist
foreach ($listHg as $hg) {
if ($this->hgObject->getHostgroupId($hg)) {
$existingHg[] = $hg;
} else {
$unknownHg[] = $hg;
}
}
foreach ($existingHg as $hg) {
$hostList = $this->hgObject->getHostsByHostgroupName($hg);
//check add services with host
foreach ($hostList as $host) {
$this->externalCmdObj->addHostDowntime(
$host['host'],
......@@ -603,7 +610,11 @@ class CentreonRtDowntime extends CentreonObject
$withServices
);
}
}
if (count($unknownHg)) {
throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ' HG : ' . implode('|', $unknownHg));
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment