Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handler for CheckmkHandlerScheduleCheck
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Norbert Thoden, SLSE, 2022-11-03
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include "logger.h"
|
||||
#include <ComponentMonitor/cmo_fts.h>
|
||||
#include <ComponentMonitor/cmo.hpp>
|
||||
#include <QTimer>
|
||||
#include <QTcpSocket>
|
||||
#include <QDataStream>
|
||||
|
||||
namespace DDSConnector
|
||||
{
|
||||
class DdsConnector;
|
||||
}
|
||||
|
||||
namespace ComponentMonitor
|
||||
{
|
||||
class DdsHandler;
|
||||
|
||||
// Maybe helpful:
|
||||
// https://docs.checkmk.com/latest/de/livestatus.html
|
||||
// https://docs.checkmk.com/latest/de/livestatus_references.html
|
||||
// https://github.com/sileht/check_mk/blob/master/livestatus/api/python/livestatus.py
|
||||
|
||||
class CheckmkHandlerScheduleCheck : public QObject
|
||||
, protected Interface::Fts::TriggerUpdateRequestHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CheckmkHandlerScheduleCheck(const std::shared_ptr<DdsHandler> &ddsHandler);
|
||||
~CheckmkHandlerScheduleCheck();
|
||||
|
||||
bool initialize(const QString &checkMkServerHostname, int checkMkServerPort);
|
||||
|
||||
void run(int timoutMsec = 100);
|
||||
void stop();
|
||||
bool doConnect();
|
||||
void addScheduleCheckHostnames(const QStringList &hostnames);
|
||||
|
||||
private:
|
||||
bool writeScheduleUpdateRequest();
|
||||
|
||||
Q_SIGNALS:
|
||||
void newCheckScheduled();
|
||||
void updateLastCheckTimeDirect(QStringList hostnamesForLastCheckTime, qint64 lastCheckSec);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onTimeout();
|
||||
void onConnected();
|
||||
void onStateChanged(const QAbstractSocket::SocketState &newState);
|
||||
void onSocketError(const QAbstractSocket::SocketError &socketError);
|
||||
|
||||
private:
|
||||
void onTriggerUpdateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TriggerUpdate &request) override;
|
||||
|
||||
|
||||
protected:
|
||||
bool processLine(const QByteArray &line);
|
||||
|
||||
private:
|
||||
// checkMkServer
|
||||
QString m_checkMkHost;
|
||||
quint16 m_checkMkPort{0};
|
||||
QTimer *m_timer{nullptr};
|
||||
|
||||
QStringList m_scheduleCheckHostnames;
|
||||
|
||||
QTcpSocket *m_socket{nullptr};
|
||||
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
} // namespace ComponentMonitor
|
||||
Reference in new issue
Block a user