icinga2/lib/perfdata/graphitewriter.hpp

58 lines
1.6 KiB
C++
Raw Permalink Normal View History

Replace all existing copyright headers with `SPDX` headers I've used the following command to replace the original copyright header lines in a C-style comment block: ``` $ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f -exec perl -pi -e 's{/\*[^*]*\(\s*c\s*\)\s*(\d{4})\s*Icinga\s+GmbH[^*]*\*/}{// SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n// SPDX-License-Identifier: GPL-2.0-or-later}gi' {} + ``` For files that use shell-style comments (#) like CMakeLists.txt, I've used this command: ``` $ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f -exec perl -pi -e 's{#.*\(\s*c\s*\)\s(\d{4})\sIcinga\s+GmbH.*}{# SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n# SPDX-License-Identifier: GPL-2.0-or-later}gi' {} + ``` And for SQL files: ``` $ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f \( -name '*.sql' \) -exec perl -pi -e 's{--.*\(c\)\s(\d{4})\sIcinga\sGmbH.*}{-- SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n-- SPDX-License-Identifier: GPL-2.0-or-later}gi' {} + $ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f \( -name '*.sql' \) -exec perl -pi -e 's{-- Copyright \(c\)\s(\d{4})\sIcinga\s+Development\sTeam.*}{-- SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n-- SPDX-License-Identifier: GPL-2.0-or-later}gi' {} + ```
2026-01-27 09:06:40 -05:00
// SPDX-FileCopyrightText: 2012 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-2.0-or-later
2013-02-28 05:45:47 -05:00
2013-10-14 14:12:42 -04:00
#ifndef GRAPHITEWRITER_H
#define GRAPHITEWRITER_H
2013-02-28 05:45:47 -05:00
2018-01-18 07:50:38 -05:00
#include "perfdata/graphitewriter-ti.hpp"
#include "icinga/checkable.hpp"
#include "base/configobject.hpp"
#include "base/workqueue.hpp"
#include "perfdata/perfdatawriterconnection.hpp"
2013-03-16 16:18:53 -04:00
2013-02-28 05:45:47 -05:00
namespace icinga
{
/**
2013-10-14 14:12:42 -04:00
* An Icinga graphite writer.
2013-02-28 05:45:47 -05:00
*
2013-10-14 14:12:42 -04:00
* @ingroup perfdata
2013-02-28 05:45:47 -05:00
*/
2018-01-04 00:11:04 -05:00
class GraphiteWriter final : public ObjectImpl<GraphiteWriter>
2013-02-28 05:45:47 -05:00
{
public:
2014-11-02 18:44:04 -05:00
DECLARE_OBJECT(GraphiteWriter);
DECLARE_OBJECTNAME(GraphiteWriter);
2013-02-28 05:45:47 -05:00
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
void ValidateHostNameTemplate(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
void ValidateServiceNameTemplate(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
2013-02-28 05:45:47 -05:00
protected:
void OnConfigLoaded() override;
void Resume() override;
void Pause() override;
2013-02-28 05:45:47 -05:00
private:
PerfdataWriterConnection::Ptr m_Connection;
WorkQueue m_WorkQueue{10000000, 1};
boost::signals2::connection m_HandleCheckResults;
2013-02-28 05:45:47 -05:00
2014-04-03 09:36:13 -04:00
void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
2019-01-17 02:53:55 -05:00
void SendMetric(const Checkable::Ptr& checkable, const String& prefix, const String& name, double value, double ts);
void SendPerfdata(const Checkable::Ptr& checkable, const String& prefix, const CheckResult::Ptr& cr);
static String EscapeMetric(const String& str);
static String EscapeMetricLabel(const String& str);
static Value EscapeMacroMetric(const Value& value);
void AssertOnWorkQueue();
void ExceptionHandler(boost::exception_ptr exp);
2013-02-28 05:45:47 -05:00
};
}
2013-10-14 14:12:42 -04:00
#endif /* GRAPHITEWRITER_H */