Update ITL commands.

Refs #4865
This commit is contained in:
Gunnar Beutner 2014-04-12 08:18:38 +02:00
parent 06fdaeb2b2
commit 899b9da5b4
6 changed files with 64 additions and 16 deletions

View File

@ -151,18 +151,13 @@ void AgentListener::NewClientHandler(const Socket::Ptr& client, TlsRole role)
JsonRpc::SendMessage(tlsStream, request); JsonRpc::SendMessage(tlsStream, request);
} }
Dictionary::Ptr message;
try { try {
message = JsonRpc::ReadMessage(tlsStream); Dictionary::Ptr message = JsonRpc::ReadMessage(tlsStream);
MessageHandler(tlsStream, identity, message);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogWarning, "agent", "Error while reading JSON-RPC message for agent '" + identity + "': " + DiagnosticInformation(ex)); Log(LogWarning, "agent", "Error while reading JSON-RPC message for agent '" + identity + "': " + DiagnosticInformation(ex));
return;
} }
MessageHandler(tlsStream, identity, message);
tlsStream->Close(); tlsStream->Close();
} }

View File

@ -212,7 +212,7 @@ cgreater | **Optional.** The user count critical threshold. Defaults to 5
### <a id="itl-processes"></a> processes ### <a id="itl-processes"></a> processes
Check command object for the `check_processes` plugin. Check command object for the `check_procs` plugin.
Custom Attributes: Custom Attributes:
@ -221,6 +221,17 @@ Name | Description
wgreater | **Optional.** The process count warning threshold. Defaults to 250. wgreater | **Optional.** The process count warning threshold. Defaults to 250.
cgreater | **Optional.** The process count critical threshold. Defaults to 400. cgreater | **Optional.** The process count critical threshold. Defaults to 400.
### <a id="itl-swap"></a> swap
Check command object for the `check_swap` plugin.
Custom Attributes:
Name | Description
----------------|--------------
wfree | **Optional.** The free swap space warning threshold in %. Defaults to 50.
cfree | **Optional.** The free swap space critical threshold in %. Defaults to 25.
### <a id="itl-load"></a> load ### <a id="itl-load"></a> load
Check command object for the `check_load` plugin. Check command object for the `check_load` plugin.
@ -266,3 +277,8 @@ Check command for the built-in `icinga` check. This check returns performance
data for the current Icinga instance. data for the current Icinga instance.
The `icinga` check command does not support any vars. The `icinga` check command does not support any vars.
### <a id="itl-kernel"></a> kernel
Checks whether the version of the currently running kernel matches the
on-disk kernel image.

View File

@ -30,6 +30,7 @@ install_if_not_exists(icinga2/conf.d/localhost.conf ${CMAKE_INSTALL_SYSCONFDIR}/
install_if_not_exists(icinga2/conf.d/notifications.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) install_if_not_exists(icinga2/conf.d/notifications.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/timeperiods.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) install_if_not_exists(icinga2/conf.d/timeperiods.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/users.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) install_if_not_exists(icinga2/conf.d/users.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/features-available/agent.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available)
install_if_not_exists(icinga2/features-available/checker.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available) install_if_not_exists(icinga2/features-available/checker.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available)
install_if_not_exists(icinga2/features-available/command.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available) install_if_not_exists(icinga2/features-available/command.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available)
install_if_not_exists(icinga2/features-available/compatlog.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available) install_if_not_exists(icinga2/features-available/compatlog.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available)

View File

@ -66,3 +66,9 @@ object Service "disk" {
check_command = "disk" check_command = "disk"
} }
object Service "kernel" {
import "generic-service"
host_name = "localhost"
check_command = "kernel"
}

View File

@ -0,0 +1,11 @@
/**
* The agent listener accepts checks from agents.
*/
library "agent"
object AgentListener "agent" {
cert_path = SysconfDir + "/icinga2/pki/your-master.crt"
key_path = SysconfDir + "/icinga2/pki/your-master.key"
ca_path = SysconfDir + "/icinga2/pki/ca.crt"
}

View File

@ -199,7 +199,7 @@ object CheckCommand "disk" {
vars.cfree = 10, vars.cfree = 10,
} }
object CheckCommand "users"{ object CheckCommand "users" {
import "plugin-check-command", import "plugin-check-command",
command = [ command = [
@ -212,7 +212,7 @@ object CheckCommand "users"{
vars.cgreater = 50, vars.cgreater = 50,
} }
object CheckCommand "processes"{ object CheckCommand "processes" {
import "plugin-check-command", import "plugin-check-command",
command = [ command = [
@ -225,7 +225,20 @@ object CheckCommand "processes"{
vars.cgreater = 400, vars.cgreater = 400,
} }
object CheckCommand "load"{ object CheckCommand "swap" {
import "plugin-check-command",
command = [
PluginDir + "/check_swap",
"-w", "$wgreater$%",
"-c", "$cgreater$%"
],
vars.wfree = 50,
vars.cfree = 25,
}
object CheckCommand "load" {
import "plugin-check-command", import "plugin-check-command",
command = [ command = [
@ -243,7 +256,7 @@ object CheckCommand "load"{
vars.cload15 = 4.0 vars.cload15 = 4.0
} }
object CheckCommand "snmp"{ object CheckCommand "snmp" {
import "plugin-check-command", import "plugin-check-command",
command = [ command = [
@ -256,23 +269,23 @@ object CheckCommand "snmp"{
vars.community = "public" vars.community = "public"
} }
object CheckCommand "snmp-uptime"{ object CheckCommand "snmp-uptime" {
import "snmp", import "snmp",
vars.oid = "1.3.6.1.2.1.1.3.0" vars.oid = "1.3.6.1.2.1.1.3.0"
} }
object CheckCommand "icinga"{ object CheckCommand "icinga" {
import "icinga-check-command", import "icinga-check-command",
} }
object CheckCommand "cluster"{ object CheckCommand "cluster" {
import "cluster-check-command", import "cluster-check-command",
} }
object CheckCommand "snmp-extend"{ object CheckCommand "snmp-extend" {
import "plugin-check-command", import "plugin-check-command",
command = [ command = [
@ -285,6 +298,12 @@ object CheckCommand "snmp-extend"{
vars.community = "public" vars.community = "public"
} }
object CheckCommand "kernel" {
import "plugin-check-command"
command = [ SysconfDir + "/icinga2/scripts/check_kernel" ]
}
object CheckCommand "agent" { object CheckCommand "agent" {
import "agent-check-command" import "agent-check-command"
} }