2014-10-17 15:13:17 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2018-01-02 12:06:00 +01:00
|
|
|
* Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
|
2014-10-17 15:13:17 +02: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. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
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();
|
2017-11-28 13:38:53 +01:00
|
|
|
|
2015-02-09 14:04:00 +01:00
|
|
|
static bool CreateBackupFile(const String& target, bool is_private = 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
|
|
|
|
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 */
|
2017-10-30 19:49:54 +01:00
|
|
|
static int GenerateNodeIcingaConfig(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 */
|