2013-01-22 08:34:29 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2013-09-25 07:43:57 +02:00
|
|
|
* Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/) *
|
2013-01-22 08:34:29 +01:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-01-29 15:00:39 +01:00
|
|
|
#ifndef EXTERNALCOMMANDPROCESSOR_H
|
|
|
|
#define EXTERNALCOMMANDPROCESSOR_H
|
2013-01-22 08:34:29 +01:00
|
|
|
|
2013-03-17 20:19:29 +01:00
|
|
|
#include "icinga/i2-icinga.h"
|
|
|
|
#include "base/qstring.h"
|
|
|
|
#include <boost/thread/mutex.hpp>
|
|
|
|
#include <boost/thread/once.hpp>
|
2013-03-18 11:02:18 +01:00
|
|
|
#include <boost/function.hpp>
|
2013-09-30 19:32:32 +02:00
|
|
|
#include <boost/signals2.hpp>
|
2013-03-18 11:02:18 +01:00
|
|
|
#include <vector>
|
2013-03-17 20:19:29 +01:00
|
|
|
|
2013-01-22 08:34:29 +01:00
|
|
|
namespace icinga
|
|
|
|
{
|
2013-02-09 15:20:10 +01:00
|
|
|
|
2013-01-29 15:00:39 +01:00
|
|
|
class I2_ICINGA_API ExternalCommandProcessor {
|
2013-01-22 08:34:29 +01:00
|
|
|
public:
|
2013-01-24 23:42:02 +01:00
|
|
|
static void Execute(const String& line);
|
2013-03-16 21:18:53 +01:00
|
|
|
static void Execute(double time, const String& command, const std::vector<String>& arguments);
|
2013-01-22 08:34:29 +01:00
|
|
|
|
2013-09-30 19:32:32 +02:00
|
|
|
static boost::signals2::signal<void (double, const String&, const std::vector<String>&)> OnNewExternalCommand;
|
|
|
|
|
2013-02-17 19:14:34 +01:00
|
|
|
private:
|
2013-03-16 21:18:53 +01:00
|
|
|
typedef boost::function<void (double time, const std::vector<String>& arguments)> Callback;
|
2013-02-17 19:14:34 +01:00
|
|
|
|
|
|
|
static boost::once_flag m_InitializeOnce;
|
|
|
|
static boost::mutex m_Mutex;
|
2013-03-16 21:18:53 +01:00
|
|
|
static std::map<String, Callback> m_Commands;
|
2013-02-17 19:14:34 +01:00
|
|
|
|
|
|
|
ExternalCommandProcessor(void);
|
|
|
|
|
|
|
|
static void Initialize(void);
|
|
|
|
|
|
|
|
static void RegisterCommand(const String& command, const Callback& callback);
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
static void ProcessHostCheckResult(double time, const std::vector<String>& arguments);
|
|
|
|
static void ProcessServiceCheckResult(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleHostCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleForcedHostCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleSvcCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleForcedSvcCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableSvcCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableSvcCheck(double time, const std::vector<String>& arguments);
|
|
|
|
static void ShutdownProcess(double time, const std::vector<String>& arguments);
|
2013-08-30 14:27:24 +02:00
|
|
|
static void RestartProcess(double time, const std::vector<String>& arguments);
|
2013-03-16 21:18:53 +01:00
|
|
|
static void ScheduleForcedHostSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleHostSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void AcknowledgeSvcProblem(double time, const std::vector<String>& arguments);
|
|
|
|
static void AcknowledgeSvcProblemExpire(double time, const std::vector<String>& arguments);
|
|
|
|
static void RemoveSvcAcknowledgement(double time, const std::vector<String>& arguments);
|
|
|
|
static void AcknowledgeHostProblem(double time, const std::vector<String>& arguments);
|
|
|
|
static void AcknowledgeHostProblemExpire(double time, const std::vector<String>& arguments);
|
|
|
|
static void RemoveHostAcknowledgement(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostgroupSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostgroupSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableServicegroupSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableServicegroupSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnablePassiveHostChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisablePassiveHostChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnablePassiveSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisablePassiveSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableServicegroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableServicegroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostgroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostgroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void ProcessFile(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleSvcDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelSvcDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleHostDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelHostDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleHostSvcDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleHostgroupHostDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleHostgroupSvcDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleServicegroupHostDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void ScheduleServicegroupSvcDowntime(double time, const std::vector<String>& arguments);
|
|
|
|
static void AddHostComment(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelHostComment(double time, const std::vector<String>& arguments);
|
|
|
|
static void AddSvcComment(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelSvcComment(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelAllHostComments(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelAllSvcComments(double time, const std::vector<String>& arguments);
|
|
|
|
static void SendCustomHostNotification(double time, const std::vector<String>& arguments);
|
|
|
|
static void SendCustomSvcNotification(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelayHostNotification(double time, const std::vector<String>& arguments);
|
|
|
|
static void DelaySvcNotification(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostNotifications(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostNotifications(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableSvcNotifications(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableSvcNotifications(double time, const std::vector<String>& arguments);
|
2013-04-15 10:23:06 +02:00
|
|
|
static void DisableHostgroupHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostgroupPassiveHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void DisableServicegroupHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void DisableServicegroupPassiveHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostgroupHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostgroupPassiveHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void EnableServicegroupHostChecks(double, const std::vector<String>& arguments);
|
|
|
|
static void EnableServicegroupPassiveHostChecks(double, const std::vector<String>& arguments);
|
2013-06-21 10:28:21 +02:00
|
|
|
static void EnableSvcFlapping(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableSvcFlapping(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableHostFlapping(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostFlapping(double time, const std::vector<String>& arguments);
|
2013-10-08 11:57:35 +02:00
|
|
|
static void EnableNotifications(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableNotifications(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableFlapDetection(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableFlapDetection(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableEventHandlers(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableEventHandlers(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnablePerformanceData(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisablePerformanceData(double time, const std::vector<String>& arguments);
|
|
|
|
static void StartExecutingSvcChecks(double time, const std::vector<String>& arguments);
|
|
|
|
static void StopExecutingSvcChecks(double time, const std::vector<String>& arguments);
|
2013-10-16 12:09:45 +02:00
|
|
|
static void ChangeSvcModattr(double time, const std::vector<String>& arguments);
|
|
|
|
static void ChangeHostModattr(double time, const std::vector<String>& arguments);
|
2013-10-16 13:02:21 +02:00
|
|
|
static void ChangeNormalSvcCheckInterval(double time, const std::vector<String>& arguments);
|
|
|
|
static void ChangeNormalHostCheckInterval(double time, const std::vector<String>& arguments);
|
|
|
|
static void ChangeRetrySvcCheckInterval(double time, const std::vector<String>& arguments);
|
|
|
|
static void ChangeRetryHostCheckInterval(double time, const std::vector<String>& arguments);
|
2013-10-16 15:20:14 +02:00
|
|
|
static void EnableHostEventHandler(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableHostEventHandler(double time, const std::vector<String>& arguments);
|
|
|
|
static void EnableSvcEventHandler(double time, const std::vector<String>& arguments);
|
|
|
|
static void DisableSvcEventHandler(double time, const std::vector<String>& arguments);
|
2013-11-26 12:31:17 +01:00
|
|
|
static void ChangeHostEventHandler(double time, const std::vector<String>& arguments);
|
|
|
|
static void ChangeSvcEventHandler(double time, const std::vector<String>& arguments);
|
2013-11-26 12:56:42 +01:00
|
|
|
static void ChangeHostCheckCommand(double time, const std::vector<String>& arguments);
|
|
|
|
static void ChangeSvcCheckCommand(double time, const std::vector<String>& arguments);
|
2013-01-22 08:34:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-01-29 15:00:39 +01:00
|
|
|
#endif /* EXTERNALCOMMANDPROCESSOR_H */
|