/****************************************************************************** * Icinga 2 * * Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/) * * * * 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. * ******************************************************************************/ #ifndef EXTERNALCOMMANDPROCESSOR_H #define EXTERNALCOMMANDPROCESSOR_H #include "icinga/i2-icinga.h" #include "base/qstring.h" #include #include #include #include #include namespace icinga { class I2_ICINGA_API ExternalCommandProcessor { public: static void Execute(const String& line); static void Execute(double time, const String& command, const std::vector& arguments); static boost::signals2::signal&)> OnNewExternalCommand; private: typedef boost::function& arguments)> Callback; static boost::once_flag m_InitializeOnce; static boost::mutex m_Mutex; static std::map m_Commands; ExternalCommandProcessor(void); static void Initialize(void); static void RegisterCommand(const String& command, const Callback& callback); static void ProcessHostCheckResult(double time, const std::vector& arguments); static void ProcessServiceCheckResult(double time, const std::vector& arguments); static void ScheduleHostCheck(double time, const std::vector& arguments); static void ScheduleForcedHostCheck(double time, const std::vector& arguments); static void ScheduleSvcCheck(double time, const std::vector& arguments); static void ScheduleForcedSvcCheck(double time, const std::vector& arguments); static void EnableHostCheck(double time, const std::vector& arguments); static void DisableHostCheck(double time, const std::vector& arguments); static void EnableSvcCheck(double time, const std::vector& arguments); static void DisableSvcCheck(double time, const std::vector& arguments); static void ShutdownProcess(double time, const std::vector& arguments); static void RestartProcess(double time, const std::vector& arguments); static void ScheduleForcedHostSvcChecks(double time, const std::vector& arguments); static void ScheduleHostSvcChecks(double time, const std::vector& arguments); static void EnableHostSvcChecks(double time, const std::vector& arguments); static void DisableHostSvcChecks(double time, const std::vector& arguments); static void AcknowledgeSvcProblem(double time, const std::vector& arguments); static void AcknowledgeSvcProblemExpire(double time, const std::vector& arguments); static void RemoveSvcAcknowledgement(double time, const std::vector& arguments); static void AcknowledgeHostProblem(double time, const std::vector& arguments); static void AcknowledgeHostProblemExpire(double time, const std::vector& arguments); static void RemoveHostAcknowledgement(double time, const std::vector& arguments); static void EnableHostgroupSvcChecks(double time, const std::vector& arguments); static void DisableHostgroupSvcChecks(double time, const std::vector& arguments); static void EnableServicegroupSvcChecks(double time, const std::vector& arguments); static void DisableServicegroupSvcChecks(double time, const std::vector& arguments); static void EnablePassiveHostChecks(double time, const std::vector& arguments); static void DisablePassiveHostChecks(double time, const std::vector& arguments); static void EnablePassiveSvcChecks(double time, const std::vector& arguments); static void DisablePassiveSvcChecks(double time, const std::vector& arguments); static void EnableServicegroupPassiveSvcChecks(double time, const std::vector& arguments); static void DisableServicegroupPassiveSvcChecks(double time, const std::vector& arguments); static void EnableHostgroupPassiveSvcChecks(double time, const std::vector& arguments); static void DisableHostgroupPassiveSvcChecks(double time, const std::vector& arguments); static void ProcessFile(double time, const std::vector& arguments); static void ScheduleSvcDowntime(double time, const std::vector& arguments); static void DelSvcDowntime(double time, const std::vector& arguments); static void ScheduleHostDowntime(double time, const std::vector& arguments); static void DelHostDowntime(double time, const std::vector& arguments); static void ScheduleHostSvcDowntime(double time, const std::vector& arguments); static void ScheduleHostgroupHostDowntime(double time, const std::vector& arguments); static void ScheduleHostgroupSvcDowntime(double time, const std::vector& arguments); static void ScheduleServicegroupHostDowntime(double time, const std::vector& arguments); static void ScheduleServicegroupSvcDowntime(double time, const std::vector& arguments); static void AddHostComment(double time, const std::vector& arguments); static void DelHostComment(double time, const std::vector& arguments); static void AddSvcComment(double time, const std::vector& arguments); static void DelSvcComment(double time, const std::vector& arguments); static void DelAllHostComments(double time, const std::vector& arguments); static void DelAllSvcComments(double time, const std::vector& arguments); static void SendCustomHostNotification(double time, const std::vector& arguments); static void SendCustomSvcNotification(double time, const std::vector& arguments); static void DelayHostNotification(double time, const std::vector& arguments); static void DelaySvcNotification(double time, const std::vector& arguments); static void EnableHostNotifications(double time, const std::vector& arguments); static void DisableHostNotifications(double time, const std::vector& arguments); static void EnableSvcNotifications(double time, const std::vector& arguments); static void DisableSvcNotifications(double time, const std::vector& arguments); static void DisableHostgroupHostChecks(double, const std::vector& arguments); static void DisableHostgroupPassiveHostChecks(double, const std::vector& arguments); static void DisableServicegroupHostChecks(double, const std::vector& arguments); static void DisableServicegroupPassiveHostChecks(double, const std::vector& arguments); static void EnableHostgroupHostChecks(double, const std::vector& arguments); static void EnableHostgroupPassiveHostChecks(double, const std::vector& arguments); static void EnableServicegroupHostChecks(double, const std::vector& arguments); static void EnableServicegroupPassiveHostChecks(double, const std::vector& arguments); static void EnableSvcFlapping(double time, const std::vector& arguments); static void DisableSvcFlapping(double time, const std::vector& arguments); static void EnableHostFlapping(double time, const std::vector& arguments); static void DisableHostFlapping(double time, const std::vector& arguments); static void EnableNotifications(double time, const std::vector& arguments); static void DisableNotifications(double time, const std::vector& arguments); static void EnableFlapDetection(double time, const std::vector& arguments); static void DisableFlapDetection(double time, const std::vector& arguments); static void EnableEventHandlers(double time, const std::vector& arguments); static void DisableEventHandlers(double time, const std::vector& arguments); static void EnablePerformanceData(double time, const std::vector& arguments); static void DisablePerformanceData(double time, const std::vector& arguments); static void StartExecutingSvcChecks(double time, const std::vector& arguments); static void StopExecutingSvcChecks(double time, const std::vector& arguments); static void ChangeSvcModAttr(double time, const std::vector& arguments); static void ChangeHostModAttr(double time, const std::vector& arguments); }; } #endif /* EXTERNALCOMMANDPROCESSOR_H */