Merge branch 'master' of git.icinga.org:icinga2

This commit is contained in:
Gunnar Beutner 2012-10-05 11:30:43 +02:00
commit 9df719f8b6
7 changed files with 185 additions and 9 deletions

View File

@ -45,7 +45,7 @@ icinga2libdir = ${libdir}/${PACKAGE}
icinga2lib_DATA =
EXTRA_DIST = $(icinga2doc_DATA) $(icinga2logdir) $(icinga2cachedir) $(icinga2varstatedir) $(icinga2rundir) $(icinga2sbindir) $(icinga2libdir) git_version.sh icinga2.spec
EXTRA_DIST = $(icinga2doc_DATA) git_version.sh icinga2.spec
# Remove doc directory on uninstall

View File

@ -243,6 +243,71 @@ void CompatIdoComponent::EndConfigDump(void)
m_IdoSocket->SendMessage(message.str());
}
/**
* enables host config object in ido
*/
void CompatIdoComponent::EnableHostObject(const Host::Ptr& host)
{
stringstream message;
message << "\n"
<< 500 << ":" << "\n" /* enableobject */
<< 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */
<< 53 << "=" << host->GetName() << "\n" /* host */
<< 999 << "\n\n"; /* enddata */
m_IdoSocket->SendMessage(message.str());
}
/**
* enables service config object in ido
*/
void CompatIdoComponent::EnableServiceObject(const Service::Ptr& service)
{
stringstream message;
message << "\n"
<< 500 << ":" << "\n" /* enableobject */
<< 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */
<< 53 << "=" << service->GetHost()->GetName() << "\n" /* host */
<< 114 << "=" << service->GetAlias() << "\n" /* service */
<< 999 << "\n\n"; /* enddata */
m_IdoSocket->SendMessage(message.str());
}
/**
* disables host config object in ido
*/
void CompatIdoComponent::DisableHostObject(const Host::Ptr& host)
{
stringstream message;
message << "\n"
<< 501 << ":" << "\n" /* disableobject */
<< 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */
<< 53 << "=" << host->GetName() << "\n" /* host */
<< 999 << "\n\n"; /* enddata */
m_IdoSocket->SendMessage(message.str());
}
/**
* disables service config object in ido
*/
void CompatIdoComponent::DisableServiceObject(const Service::Ptr& service)
{
stringstream message;
message << "\n"
<< 501 << ":" << "\n" /* disableobject */
<< 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */
<< 53 << "=" << service->GetHost()->GetName() << "\n" /* host */
<< 114 << "=" << service->GetAlias() << "\n" /* service */
<< 999 << "\n\n"; /* enddata */
m_IdoSocket->SendMessage(message.str());
}
/**
* dump host config to ido
*
@ -629,6 +694,8 @@ void CompatIdoComponent::DumpConfigObjects(void)
}
DumpHostObject(host);
//FIXME remove me, debug only XXX
//DisableHostObject(host);
}
pair<String, vector<String > > hgt;
@ -673,6 +740,8 @@ void CompatIdoComponent::DumpConfigObjects(void)
}
DumpServiceObject(service);
//FIXME remove me, debug only XXX
//DisableServiceObject(service);
}
pair<String, vector<Service::Ptr> > sgt;

View File

@ -53,6 +53,11 @@ private:
void StartConfigDump(void);
void EndConfigDump(void);
void EnableHostObject(const Host::Ptr& host);
void EnableServiceObject(const Service::Ptr& service);
void DisableHostObject(const Host::Ptr& host);
void DisableServiceObject(const Service::Ptr& service);
void DumpConfigObjects(void);
void DumpHostObject(const Host::Ptr& host);
void DumpServiceObject(const Service::Ptr& service);

Binary file not shown.

View File

@ -326,8 +326,8 @@ Example:
-------------------------------------------------------------------------------
local object IcingaApplication "icinga" {
cert = "my-cert.pem",
ca = "ca.crt",
cert_path = "my-cert.pem",
ca_path = "ca.crt",
node = "192.168.0.1",
service = 7777,
@ -342,15 +342,15 @@ local object IcingaApplication "icinga" {
}
-------------------------------------------------------------------------------
Attribute: cert
^^^^^^^^^^^^^^^
Attribute: cert_path
^^^^^^^^^^^^^^^^^^^^
This is used to specify the SSL client certificate Icinga 2 will use when
connecting to other Icinga 2 instances. This property is optional when you're
setting up a non-networked Icinga 2 instance.
Attribute: ca
^^^^^^^^^^^^^
Attribute: ca_path
^^^^^^^^^^^^^^^^^^
This is the public CA certificate that is used to verify connections from other
Icinga 2 instances. This property is optional when you're setting up a
@ -822,3 +822,5 @@ write status.dat and objects.cache files.
If you require an idomod connector for ido2db, outputting into idoutils database,
you may also load the "compatido" component (default: tcpsocket, 127.0.0.1:5668).
Make sure that ido2db is running and listening to the tcpsocket!
/* vim: set syntax=asciidoc filetype=asciidoc: */

View File

@ -0,0 +1,100 @@
/**
* Icinga 2 configuration file
* - this is where you define settings for the Icinga application including
* which hosts/services to check.
*
* The docs/icinga2-config.txt file in the source tarball has a detailed
* description of what configuration options are available.
*/
/**
* Global configuration settings
*/
local object IcingaApplication "icinga" {
pid_path = "icinga2.pid",
log_path = "icinga2.log",
state_path = "icinga2.state",
macros = {
plugindir = "C:\Plugins"
}
}
/**
* The checker component takes care of executing service checks.
*/
local object Component "checker" {
}
/**
* The delegation component assigns services to checkers. You need to load
* this component even if your Icinga setup only consists of a single instance.
*/
local object Component "delegation" {
}
/**
* The compat component periodically updates the status.dat and objects.cache
* files. These are used by the Icinga 1.x CGIs to display the state of
* hosts and services.
*/
local object Component "compat" {
status_path = "status.dat",
objects_path = "objects.cache",
}
/**
* The compatido component works as idomod connector to a running ido2db
* daemon, connected via tcp socket only. It will dump config and status
* information periodically for now. By default, this remains disabled.
*/
/*
local object Component "compatido" {
socket_address = "127.0.0.1",
socket_port = "5668",
instance_name = "i2-default",
}
*/
/**
* This template defines some basic parameters for services that use
* external plugins for their checks.
*/
abstract object Service "icinga-service" {
methods = {
check = "native::PluginCheck"
}
}
/**
* The service template for ping checks. In an Icinga 1.x environment
* this would be defined as a check command.
*/
abstract object Service "ping" inherits "icinga-service" {
/* using check_winping from https://www.itefix.no/i2/check_winping */
check_command = "$plugindir$\check_ping.exe -H $address$ -w $wrta$,$wpl$% -c $crta$,$cpl$%",
macros += {
wrta = 100,
wpl = 80,
crta = 250,
cpl = 100
}
}
/**
* And finally we define some host that should be checked.
*/
object Host "localhost" {
services = { "ping" },
macros = {
address = "127.0.0.1"
},
check_interval = 1m
}

View File

@ -90,8 +90,8 @@ int IcingaApplication::Main(const vector<String>& args)
}
}
m_CertificateFile = Get("cert");
m_CAFile = Get("ca");
m_CertificateFile = Get("cert_path");
m_CAFile = Get("ca_path");
m_Node = Get("node");
m_Service = Get("service");