2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-10-17 15:13:17 +02:00
|
|
|
|
2015-06-24 14:13:54 +02:00
|
|
|
#ifndef NODEUTILITY_H
|
|
|
|
#define NODEUTILITY_H
|
2014-10-17 18:55:34 +02:00
|
|
|
|
|
|
|
#include "base/i2-base.hpp"
|
2015-02-26 11:04:57 +01:00
|
|
|
#include "cli/i2-cli.hpp"
|
2014-10-18 21:06:28 +02:00
|
|
|
#include "base/dictionary.hpp"
|
2014-10-21 21:33:21 +02:00
|
|
|
#include "base/array.hpp"
|
|
|
|
#include "base/value.hpp"
|
2014-10-18 21:06:28 +02:00
|
|
|
#include "base/string.hpp"
|
2014-10-21 13:54:56 +02:00
|
|
|
#include <vector>
|
2014-10-17 15:13:17 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup cli
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
class NodeUtility
|
2014-10-17 18:55:34 +02:00
|
|
|
{
|
2014-10-17 15:13:17 +02:00
|
|
|
public:
|
2018-01-04 04:25:35 +01:00
|
|
|
static String GetConstantsConfPath();
|
2018-04-06 19:18:19 +02:00
|
|
|
static String GetZonesConfPath();
|
2017-11-28 13:38:53 +01:00
|
|
|
|
2018-04-06 19:18:19 +02:00
|
|
|
static bool CreateBackupFile(const String& target, bool isPrivate = false);
|
2014-10-22 15:29:54 +02:00
|
|
|
|
2014-10-31 11:38:16 +01:00
|
|
|
static bool WriteNodeConfigObjects(const String& filename, const Array::Ptr& objects);
|
2014-10-21 21:33:21 +02:00
|
|
|
|
2018-08-23 22:08:02 +02:00
|
|
|
static bool GetConfigurationIncludeState(const String& value, bool recursive);
|
2018-05-08 16:06:10 +02:00
|
|
|
static bool UpdateConfiguration(const String& value, bool include, bool recursive);
|
2014-10-23 15:05:12 +02:00
|
|
|
static void UpdateConstant(const String& name, const String& value);
|
2014-10-22 19:27:21 +02:00
|
|
|
|
2014-10-31 11:53:44 +01:00
|
|
|
/* node setup helpers */
|
2018-04-06 19:18:19 +02:00
|
|
|
static int GenerateNodeIcingaConfig(const String& endpointName, const String& zoneName,
|
|
|
|
const String& parentZoneName, const std::vector<std::string>& endpoints,
|
|
|
|
const std::vector<String>& globalZones);
|
2018-04-06 17:29:37 +02:00
|
|
|
static int GenerateNodeMasterIcingaConfig(const String& endpointName, const String& zoneName,
|
|
|
|
const std::vector<String>& globalZones);
|
2014-10-22 15:29:54 +02:00
|
|
|
|
2014-10-17 18:55:34 +02:00
|
|
|
private:
|
2018-01-04 04:25:35 +01:00
|
|
|
NodeUtility();
|
2014-10-21 21:33:21 +02:00
|
|
|
|
2015-11-25 17:41:03 +01:00
|
|
|
static void SerializeObject(std::ostream& fp, const Dictionary::Ptr& object);
|
2014-10-17 15:13:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-06-24 14:13:54 +02:00
|
|
|
#endif /* NODEUTILITY_H */
|