mirror of https://github.com/Icinga/icinga2.git
parent
f6c5b777d9
commit
4135578903
|
@ -8,4 +8,5 @@ SUBDIRS = \
|
|||
demo \
|
||||
db_ido_mysql \
|
||||
livestatus \
|
||||
notification
|
||||
notification \
|
||||
perfdata
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
perfdata-type.cpp
|
|
@ -0,0 +1,37 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
|
||||
pkglib_LTLIBRARIES = \
|
||||
libperfdata.la
|
||||
|
||||
CLEANFILES = \
|
||||
perfdata-type.cpp
|
||||
|
||||
.conf.cpp: $(top_builddir)/tools/mkembedconfig/mkembedconfig
|
||||
$(top_builddir)/tools/mkembedconfig/mkembedconfig $< $@
|
||||
|
||||
libperfdata_la_SOURCES = \
|
||||
graphitewriter.cpp \
|
||||
graphitewriter.h \
|
||||
perfdatawriter.cpp \
|
||||
perfdatawriter.h \
|
||||
perfdata-type.conf
|
||||
|
||||
libperfdata_la_CPPFLAGS = \
|
||||
$(LTDLINCL) \
|
||||
$(BOOST_CPPFLAGS) \
|
||||
-I${top_srcdir}/lib \
|
||||
-I${top_srcdir}/components
|
||||
|
||||
libperfdata_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
libperfdata_la_LIBADD = \
|
||||
$(BOOST_THREAD_LIB) \
|
||||
$(BOOST_SYSTEM_LIB) \
|
||||
${top_builddir}/lib/base/libbase.la \
|
||||
${top_builddir}/lib/config/libconfig.la \
|
||||
${top_builddir}/lib/icinga/libicinga.la
|
|
@ -0,0 +1,219 @@
|
|||
/******************************************************************************
|
||||
* 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. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "perfdata/graphitewriter.h"
|
||||
#include "icinga/service.h"
|
||||
#include "icinga/macroprocessor.h"
|
||||
#include "icinga/icingaapplication.h"
|
||||
#include "icinga/compatutility.h"
|
||||
#include "base/tcpsocket.h"
|
||||
#include "base/dynamictype.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/application.h"
|
||||
#include "base/stream.h"
|
||||
#include "base/networkstream.h"
|
||||
#include "base/bufferedstream.h"
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_TYPE(GraphiteWriter);
|
||||
|
||||
void GraphiteWriter::Start(void)
|
||||
{
|
||||
DynamicObject::Start();
|
||||
|
||||
m_ReconnectTimer = boost::make_shared<Timer>();
|
||||
m_ReconnectTimer->SetInterval(10);
|
||||
m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&GraphiteWriter::ReconnectTimerHandler, this));
|
||||
m_ReconnectTimer->Start();
|
||||
m_ReconnectTimer->Reschedule(0);
|
||||
|
||||
Service::OnNewCheckResult.connect(boost::bind(&GraphiteWriter::CheckResultHandler, this, _1, _2));
|
||||
}
|
||||
|
||||
String GraphiteWriter::GetHost(void) const
|
||||
{
|
||||
if (m_Host.IsEmpty())
|
||||
return "127.0.0.1";
|
||||
else
|
||||
return m_Host;
|
||||
}
|
||||
|
||||
String GraphiteWriter::GetPort(void) const
|
||||
{
|
||||
if (m_Port.IsEmpty())
|
||||
return "2003";
|
||||
else
|
||||
return m_Port;
|
||||
}
|
||||
|
||||
void GraphiteWriter::ReconnectTimerHandler(void)
|
||||
{
|
||||
/* TODO try to write the stream, and catch the exception - not connected */
|
||||
if (m_Stream)
|
||||
return;
|
||||
|
||||
TcpSocket::Ptr socket = boost::make_shared<TcpSocket>();
|
||||
|
||||
Log(LogInformation, "icinga", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
|
||||
socket->Connect(GetHost(), GetPort());
|
||||
|
||||
NetworkStream::Ptr net_stream = boost::make_shared<NetworkStream>(socket);
|
||||
m_Stream = boost::make_shared<BufferedStream>(net_stream);
|
||||
}
|
||||
|
||||
void GraphiteWriter::CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr& cr)
|
||||
{
|
||||
if (!IcingaApplication::GetInstance()->GetEnablePerfdata())
|
||||
return;
|
||||
|
||||
Host::Ptr host = service->GetHost();
|
||||
|
||||
if (!host)
|
||||
return;
|
||||
|
||||
/* service metrics */
|
||||
std::vector<String> metrics;
|
||||
String metricName;
|
||||
Value metricValue;
|
||||
|
||||
/* basic metrics */
|
||||
AddServiceMetric(metrics, service, "current_attempt", service->GetCurrentCheckAttempt());
|
||||
AddServiceMetric(metrics, service, "max_check_attempts", service->GetMaxCheckAttempts());
|
||||
AddServiceMetric(metrics, service, "state_type", service->GetStateType());
|
||||
AddServiceMetric(metrics, service, "state", service->GetState());
|
||||
AddServiceMetric(metrics, service, "latency", Service::CalculateLatency(cr));
|
||||
AddServiceMetric(metrics, service, "execution_time", Service::CalculateExecutionTime(cr));
|
||||
|
||||
/* performance data metrics */
|
||||
String perfdata = CompatUtility::GetCheckResultPerfdata(cr);
|
||||
|
||||
if (!perfdata.IsEmpty()) {
|
||||
Log(LogDebug, "icinga", "GraphiteWriter: Processing perfdata: '" + perfdata + "'.");
|
||||
|
||||
/*
|
||||
* 'foo bar'=0;;; baz=0.0;;;
|
||||
* 'label'=value[UOM];[warn];[crit];[min];[max]
|
||||
*/
|
||||
std::vector<String> tokens;
|
||||
boost::algorithm::split(tokens, perfdata, boost::is_any_of(" "));
|
||||
|
||||
/* TODO deal with 'foo bar'=0;;; 'baz'=1.0;;; */
|
||||
BOOST_FOREACH(const String& token, tokens) {
|
||||
std::vector<String> key_val;
|
||||
boost::algorithm::split(key_val, token, boost::is_any_of("="));
|
||||
|
||||
if (key_val.size() == 0) {
|
||||
Log(LogWarning, "icinga", "GraphiteWriter: Invalid performance data: '" + token + "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
String metricName = key_val[0];
|
||||
|
||||
if (key_val.size() == 1) {
|
||||
Log(LogWarning, "icinga", "GraphiteWriter: Invalid performance data: '" + token + "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<String> perfdata_values;
|
||||
boost::algorithm::split(perfdata_values, key_val[1], boost::is_any_of(";"));
|
||||
|
||||
if (perfdata_values.size() == 0) {
|
||||
Log(LogWarning, "icinga", "GraphiteWriter: Invalid performance data: '" + token + "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO remove UOM from value */
|
||||
String metricValue = perfdata_values[0];
|
||||
|
||||
/* //TODO: Figure out how graphite handles warn/crit/min/max
|
||||
String metricValueWarn, metricValueCrit, metricValueMin, metricValueMax;
|
||||
|
||||
if (perfdata_values.size() > 1)
|
||||
metricValueWarn = perfdata_values[1];
|
||||
if (perfdata_values.size() > 2)
|
||||
metricValueCrit = perfdata_values[2];
|
||||
if (perfdata_values.size() > 3)
|
||||
metricValueMin = perfdata_values[3];
|
||||
if (perfdata_values.size() > 4)
|
||||
metricValueMax = perfdata_values[4];
|
||||
*/
|
||||
|
||||
AddServiceMetric(metrics, service, metricName, metricValue);
|
||||
}
|
||||
}
|
||||
|
||||
SendMetrics(metrics);
|
||||
}
|
||||
|
||||
void GraphiteWriter::AddServiceMetric(std::vector<String>& metrics, const Service::Ptr& service, const String& name, const Value& value)
|
||||
{
|
||||
/* TODO: sanitize host and service names */
|
||||
String hostName = service->GetHost()->GetName();
|
||||
String serviceName = service->GetShortName();
|
||||
String metricPrefix = hostName + "." + serviceName;
|
||||
String graphitePrefix = "icinga";
|
||||
|
||||
String metric = graphitePrefix + ".service." + metricPrefix + "." + name + " " + Convert::ToString(value) + " " + Convert::ToString(static_cast<long>(Utility::GetTime())) + "\n";
|
||||
Log(LogDebug, "icinga", "GraphiteWriter: Add to metric list:'" + metric + "'.");
|
||||
metrics.push_back(metric);
|
||||
}
|
||||
|
||||
void GraphiteWriter::SendMetrics(const std::vector<String>& metrics)
|
||||
{
|
||||
if (!m_Stream) {
|
||||
Log(LogWarning, "icinga", "GraphiteWriter not connected!");
|
||||
return;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const String& metric, metrics) {
|
||||
if (metric.IsEmpty())
|
||||
continue;
|
||||
|
||||
Log(LogDebug, "icinga", "GraphiteWriter: Sending metric '" + metric + "'.");
|
||||
m_Stream->Write(metric.CStr(), metric.GetLength());
|
||||
}
|
||||
}
|
||||
|
||||
void GraphiteWriter::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
|
||||
{
|
||||
DynamicObject::InternalSerialize(bag, attributeTypes);
|
||||
|
||||
if (attributeTypes & Attribute_Config) {
|
||||
bag->Set("host", m_Host);
|
||||
bag->Set("port", m_Port);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphiteWriter::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
|
||||
{
|
||||
DynamicObject::InternalDeserialize(bag, attributeTypes);
|
||||
|
||||
if (attributeTypes & Attribute_Config) {
|
||||
m_Host = bag->Get("host");
|
||||
m_Port = bag->Get("port");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/******************************************************************************
|
||||
* 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 GRAPHITEWRITER_H
|
||||
#define GRAPHITEWRITER_H
|
||||
|
||||
#include "icinga/service.h"
|
||||
#include "base/dynamicobject.h"
|
||||
#include "base/tcpsocket.h"
|
||||
#include "base/timer.h"
|
||||
#include <fstream>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* An Icinga graphite writer.
|
||||
*
|
||||
* @ingroup perfdata
|
||||
*/
|
||||
class GraphiteWriter : public DynamicObject
|
||||
{
|
||||
public:
|
||||
DECLARE_PTR_TYPEDEFS(GraphiteWriter);
|
||||
DECLARE_TYPENAME(GraphiteWriter);
|
||||
|
||||
String GetHost(void) const;
|
||||
String GetPort(void) const;
|
||||
|
||||
protected:
|
||||
virtual void Start(void);
|
||||
|
||||
virtual void InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const;
|
||||
virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);
|
||||
|
||||
private:
|
||||
String m_Host;
|
||||
String m_Port;
|
||||
Stream::Ptr m_Stream;
|
||||
|
||||
Timer::Ptr m_ReconnectTimer;
|
||||
|
||||
void CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr& cr);
|
||||
static void AddServiceMetric(std::vector<String> & metrics, const Service::Ptr& service, const String& name, const Value& value);
|
||||
void SendMetrics(const std::vector<String>& metrics);
|
||||
|
||||
void ReconnectTimerHandler(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* GRAPHITEWRITER_H */
|
|
@ -0,0 +1,29 @@
|
|||
/******************************************************************************
|
||||
* 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. *
|
||||
******************************************************************************/
|
||||
|
||||
type PerfdataWriter {
|
||||
%attribute string "perfdata_path",
|
||||
%attribute string "format_template",
|
||||
%attribute number "rotation_interval"
|
||||
}
|
||||
|
||||
type GraphiteWriter {
|
||||
%attribute string "host",
|
||||
%attribute string "port",
|
||||
}
|
|
@ -0,0 +1,224 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\openssl.1.0.1.24\build\native\openssl.props" Condition="Exists('..\..\packages\openssl.1.0.1.24\build\native\openssl.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="graphitewriter.cpp" />
|
||||
<ClCompile Include="perfdata-type.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="graphitewriter.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="perfdata-type.conf">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Preparing config fragment for embedding</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Preparing config fragment for embedding</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Preparing config fragment for embedding</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Preparing config fragment for embedding</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>icinga</RootNamespace>
|
||||
<ProjectName>icinga</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_ICINGA_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<PrecompiledHeaderFile>i2-icinga.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>base.lib;config.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_ICINGA_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<PrecompiledHeaderFile>i2-icinga.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>base.lib;config.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_ICINGA_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<PrecompiledHeaderFile>i2-icinga.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>base.lib;config.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_ICINGA_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<PrecompiledHeaderFile>i2-icinga.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>base.lib;config.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\packages\boost.1.54.0.1\build\native\boost.targets" Condition="Exists('..\..\packages\boost.1.54.0.1\build\native\boost.targets')" />
|
||||
<Import Project="..\..\packages\boost_thread.1.54.0.2\build\native\boost_thread.targets" Condition="Exists('..\..\packages\boost_thread.1.54.0.2\build\native\boost_thread.targets')" />
|
||||
<Import Project="..\..\packages\boost_system.1.54.0.2\build\native\boost_system.targets" Condition="Exists('..\..\packages\boost_system.1.54.0.2\build\native\boost_system.targets')" />
|
||||
<Import Project="..\..\packages\boost_exception.1.54.0.2\build\native\boost_exception.targets" Condition="Exists('..\..\packages\boost_exception.1.54.0.2\build\native\boost_exception.targets')" />
|
||||
<Import Project="..\..\packages\boost_program_options.1.54.0.2\build\native\boost_program_options.targets" Condition="Exists('..\..\packages\boost_program_options.1.54.0.2\build\native\boost_program_options.targets')" />
|
||||
<Import Project="..\..\packages\boost_unit_test_framework.1.54.0.2\build\native\boost_unit_test_framework.targets" Condition="Exists('..\..\packages\boost_unit_test_framework.1.54.0.2\build\native\boost_unit_test_framework.targets')" />
|
||||
<Import Project="..\..\packages\zlib.redist.1.2.8.6\build\native\zlib.redist.targets" Condition="Exists('..\..\packages\zlib.redist.1.2.8.6\build\native\zlib.redist.targets')" />
|
||||
<Import Project="..\..\packages\zlib.1.2.8.6\build\native\zlib.targets" Condition="Exists('..\..\packages\zlib.1.2.8.6\build\native\zlib.targets')" />
|
||||
<Import Project="..\..\packages\openssl.redist.1.0.1.24\build\native\openssl.redist.targets" Condition="Exists('..\..\packages\openssl.redist.1.0.1.24\build\native\openssl.redist.targets')" />
|
||||
<Import Project="..\..\packages\openssl.1.0.1.24\build\native\openssl.targets" Condition="Exists('..\..\packages\openssl.1.0.1.24\build\native\openssl.targets')" />
|
||||
<Import Project="..\..\packages\boost_date_time.1.54.0.2\build\native\boost_date_time.targets" Condition="Exists('..\..\packages\boost_date_time.1.54.0.2\build\native\boost_date_time.targets')" />
|
||||
<Import Project="..\..\packages\boost_chrono.1.54.0.2\build\native\boost_chrono.targets" Condition="Exists('..\..\packages\boost_chrono.1.54.0.2\build\native\boost_chrono.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="graphitewriter.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="graphitewriter.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Headerdateien">
|
||||
<UniqueIdentifier>{2c1a73da-f333-42fc-8809-0569990567e0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Quelldateien">
|
||||
<UniqueIdentifier>{f206b9b0-3aa5-4a62-b844-3228f4ff4baf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="perfdata-type.conf">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -17,7 +17,7 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "icinga/perfdatawriter.h"
|
||||
#include "perfdata/perfdatawriter.h"
|
||||
#include "icinga/service.h"
|
||||
#include "icinga/macroprocessor.h"
|
||||
#include "icinga/icingaapplication.h"
|
|
@ -180,6 +180,7 @@ components/db_ido_mysql/schema/Makefile
|
|||
components/db_ido_mysql/schema/upgrade/Makefile
|
||||
components/livestatus/Makefile
|
||||
components/notification/Makefile
|
||||
components/perfdata/Makefile
|
||||
doc/Doxyfile
|
||||
doc/Makefile
|
||||
doc/strapdownjs/Makefile
|
||||
|
|
|
@ -374,7 +374,9 @@ Attributes:
|
|||
Writes check result performance data to a defined path using macro
|
||||
pattern.
|
||||
|
||||
Example
|
||||
Example:
|
||||
|
||||
library "perfdata"
|
||||
|
||||
object PerfdataWriter "pnp" {
|
||||
perfdata_path = "/var/spool/icinga2/perfdata/service-perfdata",
|
||||
|
@ -397,6 +399,27 @@ Attributes:
|
|||
> When rotating the performance data file the current UNIX timestamp is appended to the path specified
|
||||
> in `perfdata\_path` to generate a unique filename.
|
||||
|
||||
### <a id="objecttype-graphitewriter"></a> GraphiteWriter
|
||||
|
||||
Writes check result metrics and performance data to a defined
|
||||
Graphite Carbon host.
|
||||
|
||||
Example:
|
||||
|
||||
library "perfdata"
|
||||
|
||||
object GraphiteWriter "graphite" {
|
||||
host = "127.0.0.1",
|
||||
port = 2003
|
||||
}
|
||||
|
||||
Attributes:
|
||||
|
||||
Name |Description
|
||||
----------------|----------------
|
||||
host |**Optional.** Graphite Carbon host address. Defaults to '127.0.0.1'.
|
||||
port |**Optional.** Graphite Carbon port. Defaults to 2003.
|
||||
|
||||
### <a id="objecttype-idomysqlconnection"></a> IdoMySqlConnection
|
||||
|
||||
IDO DB schema compatible output into MySQL database.
|
||||
|
|
|
@ -6,6 +6,7 @@ CONFIG_FILES = \
|
|||
checker.conf \
|
||||
command.conf \
|
||||
compat-log.conf \
|
||||
graphite.conf \
|
||||
ido-mysql.conf \
|
||||
livestatus.conf \
|
||||
notification.conf \
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* The GraphiteWriter type writes check result metrics and
|
||||
* performance data to a graphite tcp socket.
|
||||
*/
|
||||
|
||||
library "perfdata"
|
||||
|
||||
object GraphiteWriter "graphite" {
|
||||
// host = "127.0.0.1",
|
||||
// port = 2003
|
||||
}
|
|
@ -3,4 +3,6 @@
|
|||
* the in a regular interval.
|
||||
*/
|
||||
|
||||
library "perfdata"
|
||||
|
||||
object PerfdataWriter "perfdata" { }
|
||||
|
|
|
@ -31,7 +31,8 @@ icinga2_LDADD = \
|
|||
-dlopen ${top_builddir}/components/compat/libcompat.la \
|
||||
-dlopen ${top_builddir}/components/demo/libdemo.la \
|
||||
-dlopen ${top_builddir}/components/livestatus/liblivestatus.la \
|
||||
-dlopen ${top_builddir}/components/notification/libnotification.la
|
||||
-dlopen ${top_builddir}/components/notification/libnotification.la \
|
||||
-dlopen ${top_builddir}/components/perfdata/libperfdata.la
|
||||
|
||||
if PYTHON_USE
|
||||
icinga2_LDADD += \
|
||||
|
|
|
@ -39,7 +39,7 @@ enum CleanUpAge
|
|||
/**
|
||||
* A database connection.
|
||||
*
|
||||
* @ingroup ido
|
||||
* @ingroup db_ido
|
||||
*/
|
||||
class DbConnection : public DynamicObject
|
||||
{
|
||||
|
|
|
@ -49,8 +49,6 @@ libicinga_la_SOURCES = \
|
|||
nullchecktask.h \
|
||||
nulleventtask.cpp \
|
||||
nulleventtask.h \
|
||||
perfdatawriter.cpp \
|
||||
perfdatawriter.h \
|
||||
pluginchecktask.cpp \
|
||||
pluginchecktask.h \
|
||||
plugineventtask.cpp \
|
||||
|
|
|
@ -182,12 +182,6 @@ type TimePeriod {
|
|||
/* } */
|
||||
}
|
||||
|
||||
type PerfdataWriter {
|
||||
%attribute string "perfdata_path",
|
||||
%attribute string "format_template",
|
||||
%attribute number "rotation_interval"
|
||||
}
|
||||
|
||||
type Command {
|
||||
%require "methods",
|
||||
%attribute dictionary "methods" {
|
||||
|
|
Loading…
Reference in New Issue