mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 06:34:42 +02:00
parent
844e2bf68c
commit
28b2345a3b
@ -161,28 +161,9 @@ void RedisWriter::SendConfigDelete(const ConfigObject::Ptr& object, const String
|
|||||||
|
|
||||||
String objectName = object->GetName();
|
String objectName = object->GetName();
|
||||||
|
|
||||||
redisReply *reply1 = reinterpret_cast<redisReply *>(redisCommand(m_Context, "DEL icinga:config:%s %s icinga:config:%s:checksum:%s icinga:status:%s %s",
|
ExecuteQuery({ "HDEL", "icinga:config:" + typeName, objectName });
|
||||||
typeName.CStr(), objectName.CStr(), typeName.CStr(), objectName.CStr(), typeName.CStr(), objectName.CStr()));
|
ExecuteQuery({ "HDEL", "icinga:config:" + typeName + ":checksum", objectName });
|
||||||
|
ExecuteQuery({ "HDEL", "icinga:status:" + typeName, objectName });
|
||||||
if (!reply1) {
|
|
||||||
redisFree(m_Context);
|
|
||||||
m_Context = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply1->type == REDIS_REPLY_ERROR) {
|
|
||||||
Log(LogInformation, "RedisWriter")
|
|
||||||
<< "DEL icinga:config:" << typeName << " " << objectName
|
|
||||||
<< " icinga:config:" << typeName << ":checksum:" << objectName
|
|
||||||
<< " icinga:status:" << typeName << " " << objectName << ": " << reply1->str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply1->type == REDIS_REPLY_ERROR) {
|
|
||||||
freeReplyObject(reply1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
freeReplyObject(reply1);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PUBLISH "icinga:config:dump" "Host"
|
PUBLISH "icinga:config:dump" "Host"
|
||||||
@ -190,25 +171,7 @@ void RedisWriter::SendConfigDelete(const ConfigObject::Ptr& object, const String
|
|||||||
PUBLISH "icinga:config:delete" "Host:__name"
|
PUBLISH "icinga:config:delete" "Host:__name"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
redisReply *reply2 = reinterpret_cast<redisReply *>(redisCommand(m_Context, "PUBLISH icinga:config:delete %s:%s", typeName.CStr(), objectName.CStr()));
|
ExecuteQuery({ "PUBLISH", "icinga:config:delete", typeName + ":" + objectName });
|
||||||
|
|
||||||
if (!reply2) {
|
|
||||||
redisFree(m_Context);
|
|
||||||
m_Context = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply2->type == REDIS_REPLY_ERROR) {
|
|
||||||
Log(LogInformation, "RedisWriter")
|
|
||||||
<< "PUBLISH icinga:config:delete " << typeName << ":" << objectName << ": " << reply2->str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply2->type == REDIS_REPLY_ERROR) {
|
|
||||||
freeReplyObject(reply2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
freeReplyObject(reply2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedisWriter::SendStatusUpdate(const ConfigObject::Ptr& object, const String& typeName)
|
void RedisWriter::SendStatusUpdate(const ConfigObject::Ptr& object, const String& typeName)
|
||||||
@ -222,25 +185,7 @@ void RedisWriter::SendStatusUpdate(const ConfigObject::Ptr& object, const String
|
|||||||
|
|
||||||
String objectName = object->GetName();
|
String objectName = object->GetName();
|
||||||
|
|
||||||
redisReply *reply = reinterpret_cast<redisReply *>(redisCommand(m_Context, "HSET icinga:status:%s %s %s", typeName.CStr(), objectName.CStr(), jsonBody.CStr()));
|
ExecuteQuery({ "HSET", "icinga:status:" + typeName, objectName, jsonBody });
|
||||||
|
|
||||||
if (!reply) {
|
|
||||||
redisFree(m_Context);
|
|
||||||
m_Context = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply->type == REDIS_REPLY_ERROR) {
|
|
||||||
Log(LogInformation, "RedisWriter")
|
|
||||||
<< "HSET icinga:status:" << typeName << " " << objectName << " " << jsonBody << ": " << reply->str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply->type == REDIS_REPLY_ERROR) {
|
|
||||||
freeReplyObject(reply);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
freeReplyObject(reply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedisWriter::StateChangedHandler(const ConfigObject::Ptr& object)
|
void RedisWriter::StateChangedHandler(const ConfigObject::Ptr& object)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user