Commit 74cd4457 authored by David Boucher's avatar David Boucher
Browse files

fix(redis): Criticalities and acl are implemented with redis

parent 4b3752b1
......@@ -302,7 +302,7 @@ class Service extends AbstractService {
$this->getImages($this->service_cache[$service_id]);
$this->getMacros($this->service_cache[$service_id]);
$this->service_cache[$service_id]['macros']['_SERVICE_ID'] = $service_id;
$this->service_cache[$service_id]['macros']['_SERVICE_ID'] = $service_id;
# useful for servicegroup on servicetemplate
$service_template = ServiceTemplate::getInstance();
$service_template->resetLoop();
......@@ -320,7 +320,7 @@ class Service extends AbstractService {
# By default in centengine 1.4.15
$this->getContactsFromHost($host_id, $service_id, $this->service_cache[$service_id]['service_use_only_contacts_from_host']);
$this->getSeverity($host_id, $service_id);
$this->getServiceGroups($service_id, $host_id, $host_name);
$this->getServiceGroups($service_id, $host_id, $host_name);
$this->generateObjectInFile($this->service_cache[$service_id] + array('host_name' => $host_name), $host_id . '.' . $service_id);
$this->addGeneratedServices($host_id, $service_id);
$this->clean($this->service_cache[$service_id]);
......
......@@ -34,8 +34,7 @@
// JavaScript Document
//var _adrrsearchC = "./include/monitoring/status/TopCounter/xml/statusCounter.php";
var _adrrsearchC = "./include/monitoring/status/TopCounter/xml/statusCounter-redis.php";
var _adrrsearchC = "./include/monitoring/status/TopCounter/xml/statusCounter.php";
function getXhrC(){
if (window.XMLHttpRequest) {
......
......@@ -455,7 +455,7 @@ $redis->unlink($store);
$numRows = $redis->get($store . ':size');
$redis->unlink($store . ':size');
$criticalityUsed = $redis->scard("host_criticalities") > 0 ? 1 : 0;
$criticalityUsed = $redis->scard('host_criticalities') > 0 ? 1 : 0;
$obj->XML->startElement('reponse');
$obj->XML->startElement('i');
......
......@@ -443,6 +443,8 @@ $field = array(
'service_description',
'service_id',
'state_type',
'criticality_id',
'criticality_level',
);
$field1 = array('SORT', $store, 'BY', 'NOSORT');
......@@ -462,7 +464,7 @@ $rows = build_search_rows($RESULT, $field);
//$critRes = $obj->DBC->query(
// "SELECT value, service_id FROM customvariables WHERE name = 'CRITICALITY_ID' AND service_id IS NOT NULL"
// );
$criticalityUsed = $redis->scard('service_criticalities') ? 1 : 0;
$criticalityUsed = $redis->scard('service_criticalities') > 0 ? 1 : 0;
//$critCache = array();
//if ($critRes->numRows()) {
......@@ -725,7 +727,7 @@ foreach ($rows as $row) {
$row['current_check_attempt'] . '/' . $row['max_check_attempts']
. ' (' . $obj->stateType[$row['state_type']] . ')'
);
if (isset($row['criticality_id'])) {
if (isset($row['criticality_id']) && $row['criticality_id'] != 0) {
$obj->XML->writeElement('hci', 1); // has criticality
$critData = $criticality->getData($row['criticality_id'], true);
$obj->XML->writeElement('ci', $media->getFilename($critData['icon_id']));
......
......@@ -171,6 +171,16 @@ $tmp = $redis->rawCommand('TABULAR.COUNT', $svc_source,
'acknowledged', 'EQUAL', '0',
'scheduled_downtime_depth', 'EQUAL', '0');
$svc_ok = 0;
$svc_warning = 0;
$svc_warn_ack_dt = 0;
$svc_critical = 0;
$svc_crit_ack_dt = 0;
$svc_unknown = 0;
$svc_unkn_ack_dt = 0;
$svc_pending = 0;
$svc_pend_ack_dt = 0;
for ($i = 0; $i < count($tmp); $i += 6) {
if ($tmp[$i + 1] == 0) {
$svc_ok = $tmp[$i + 3];
......@@ -184,27 +194,18 @@ for ($i = 0; $i < count($tmp); $i += 6) {
if (isset($tmp[$i + 5]) && isset($tmp[$i + 5]->$tmp[5])) {
$svc_crit_ack_dt = $tmp[$i + 5]->$tmp[5]->$tmp[1];
}
else {
$svc_crit_ack_dt = 0;
}
}
elseif ($tmp[$i + 1] == 3) {
$svc_unknown = $tmp[$i + 3];
if (isset($tmp[$i + 5]) && isset($tmp[$i + 5]->$tmp[5])) {
$svc_unkn_ack_dt = $tmp[$i + 5]->$tmp[5]->$tmp[1];
}
else {
$svc_unkn_ack_dt = 0;
}
}
elseif ($tmp[$i + 1] == 4) {
$svc_pending = $tmp[$i + 3];
if (isset($tmp[$i + 5]) && isset($tmp[$i + 5]->$tmp[5])) {
$svc_pend_ack_dt = $tmp[$i + 5]->$tmp[5]->$tmp[1];
}
else {
$svc_pend_ack_dt = 0;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment