mirror of https://github.com/Icinga/icinga2.git
parent
8105f51608
commit
d617c7b1f6
|
@ -295,7 +295,7 @@ Value HostsTable::NotesExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", host));
|
resolvers.push_back(std::make_pair("host", host));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers, CheckResult::Ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::NotesUrlAccessor(const Value& row)
|
Value HostsTable::NotesUrlAccessor(const Value& row)
|
||||||
|
@ -319,7 +319,7 @@ Value HostsTable::NotesUrlExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", host));
|
resolvers.push_back(std::make_pair("host", host));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(host->GetNotesUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(host->GetNotesUrl(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::ActionUrlAccessor(const Value& row)
|
Value HostsTable::ActionUrlAccessor(const Value& row)
|
||||||
|
@ -343,7 +343,7 @@ Value HostsTable::ActionUrlExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", host));
|
resolvers.push_back(std::make_pair("host", host));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(host->GetActionUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(host->GetActionUrl(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::PluginOutputAccessor(const Value& row)
|
Value HostsTable::PluginOutputAccessor(const Value& row)
|
||||||
|
@ -399,7 +399,7 @@ Value HostsTable::IconImageExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", host));
|
resolvers.push_back(std::make_pair("host", host));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(host->GetIconImage(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(host->GetIconImage(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::IconImageAltAccessor(const Value& row)
|
Value HostsTable::IconImageAltAccessor(const Value& row)
|
||||||
|
|
|
@ -315,7 +315,7 @@ Value ServicesTable::NotesExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(service->GetNotes(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(service->GetNotes(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::NotesUrlAccessor(const Value& row)
|
Value ServicesTable::NotesUrlAccessor(const Value& row)
|
||||||
|
@ -340,7 +340,7 @@ Value ServicesTable::NotesUrlExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(service->GetNotesUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(service->GetNotesUrl(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::ActionUrlAccessor(const Value& row)
|
Value ServicesTable::ActionUrlAccessor(const Value& row)
|
||||||
|
@ -365,7 +365,7 @@ Value ServicesTable::ActionUrlExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(service->GetActionUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(service->GetActionUrl(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::IconImageAccessor(const Value& row)
|
Value ServicesTable::IconImageAccessor(const Value& row)
|
||||||
|
@ -390,7 +390,7 @@ Value ServicesTable::IconImageExpandedAccessor(const Value& row)
|
||||||
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
resolvers.push_back(std::make_pair("host", service->GetHost()));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(service->GetIconImage(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
|
return MacroProcessor::ResolveMacros(service->GetIconImage(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::IconImageAltAccessor(const Value& row)
|
Value ServicesTable::IconImageAltAccessor(const Value& row)
|
||||||
|
|
|
@ -23,13 +23,13 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$".
|
||||||
wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100.
|
ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100.
|
||||||
wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5.
|
ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5.
|
||||||
crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200.
|
ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200.
|
||||||
cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15.
|
ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15.
|
||||||
packets | **Optional.** The number of packets to send. Defaults to 5.
|
ping_packets | **Optional.** The number of packets to send. Defaults to 5.
|
||||||
timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
|
ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
|
||||||
|
|
||||||
### <a id="itl-ping6"></a> ping6
|
### <a id="itl-ping6"></a> ping6
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address6 | **Required.** The host's IPv6 address.
|
ping_address | **Optional.** The host's IPv6 address. Defaults to "$address6$".
|
||||||
wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100.
|
ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100.
|
||||||
wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5.
|
ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5.
|
||||||
crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200.
|
ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200.
|
||||||
cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15.
|
ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15.
|
||||||
packets | **Optional.** The number of packets to send. Defaults to 5.
|
ping_packets | **Optional.** The number of packets to send. Defaults to 5.
|
||||||
timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
|
ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
|
||||||
|
|
||||||
### <a id="itl-hostalive"></a> hostalive
|
### <a id="itl-hostalive"></a> hostalive
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's IPv4 address.
|
ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$".
|
||||||
wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 3000.0.
|
ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 3000.
|
||||||
wpl | **Optional.** The packet loss warning threshold in %. Defaults to 80.
|
ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 80.
|
||||||
crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 5000.0.
|
ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 5000.
|
||||||
cpl | **Optional.** The packet loss critical threshold in %. Defaults to 100.
|
ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 100.
|
||||||
packets | **Optional.** The number of packets to send. Defaults to 5.
|
ping_packets | **Optional.** The number of packets to send. Defaults to 5.
|
||||||
timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
|
ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
|
||||||
|
|
||||||
### <a id="itl-dummy"></a> dummy
|
### <a id="itl-dummy"></a> dummy
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 0.
|
dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 0.
|
||||||
text | **Optional.** Plugin output. Defaults to "Check was successful.".
|
dummy_text | **Optional.** Plugin output. Defaults to "Check was successful.".
|
||||||
|
|
||||||
### <a id="itl-passive"></a> passive
|
### <a id="itl-passive"></a> passive
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 3.
|
dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 3.
|
||||||
text | **Optional.** Plugin output. Defaults to "No Passive Check Result Received.".
|
dummy_text | **Optional.** Plugin output. Defaults to "No Passive Check Result Received.".
|
||||||
|
|
||||||
### <a id="itl-tcp"></a> tcp
|
### <a id="itl-tcp"></a> tcp
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
tcp_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
port | **Required.** The port that should be checked.
|
tcp_port | **Required.** The port that should be checked.
|
||||||
|
|
||||||
### <a id="itl-udp"></a> udp
|
### <a id="itl-udp"></a> udp
|
||||||
|
|
||||||
|
@ -104,48 +104,24 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
udp_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
port | **Required.** The port that should be checked.
|
udp_port | **Required.** The port that should be checked.
|
||||||
|
|
||||||
### <a id="itl-http-vhost"></a> http_vhost
|
### <a id="itl-http-ip"></a> http
|
||||||
|
|
||||||
Check command object for the `check_http` plugin.
|
Check command object for the `check_http` plugin.
|
||||||
|
|
||||||
Custom Attributes:
|
Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
-------------------|--------------
|
||||||
vhost | **Required.** The name of the virtual host that should be checked.
|
http_address | **Optional.** The host's address. Defaults to "$address".
|
||||||
|
http_vhost | **Optional.** The virtual host that should be sent in the "Host" header.
|
||||||
### <a id="itl-http-ip"></a> http_ip
|
http_uri | **Optional.** The request URI.
|
||||||
|
http_port | **Optional.** The TCP port. Defaults to 80 when not using SSL, 443 otherwise.
|
||||||
Check command object for the `check_http` plugin.
|
http_ssl | **Optional.** Whether to use SSL. Defaults to false.
|
||||||
|
http_warn_time | **Optional.** The warning threshold.
|
||||||
Custom Attributes:
|
http_critical_time | **Optional.** The critical threshold.
|
||||||
|
|
||||||
Name | Description
|
|
||||||
----------------|--------------
|
|
||||||
address | **Required.** The host's address.
|
|
||||||
|
|
||||||
### <a id="itl-https-vhost"></a> https_vhost
|
|
||||||
|
|
||||||
Check command object for the `check_http` plugin.
|
|
||||||
|
|
||||||
Custom Attributes:
|
|
||||||
|
|
||||||
Name | Description
|
|
||||||
----------------|--------------
|
|
||||||
vhost | **Required.** The name of the virtual host that should be checked.
|
|
||||||
|
|
||||||
### <a id="itl-https-ip"></a> https_ip
|
|
||||||
|
|
||||||
Check command object for the `check_http` plugin.
|
|
||||||
|
|
||||||
Custom Attributes:
|
|
||||||
|
|
||||||
Name | Description
|
|
||||||
----------------|--------------
|
|
||||||
address | **Required.** The host's address.
|
|
||||||
|
|
||||||
### <a id="itl-smtp"></a> smtp
|
### <a id="itl-smtp"></a> smtp
|
||||||
|
|
||||||
|
@ -153,9 +129,9 @@ Check command object for the `check_smtp` plugin.
|
||||||
|
|
||||||
Custom Attributes:
|
Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
---------------------|--------------
|
||||||
address | **Required.** The host's address.
|
smtp_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
|
|
||||||
### <a id="itl-ssmtp"></a> ssmtp
|
### <a id="itl-ssmtp"></a> ssmtp
|
||||||
|
|
||||||
|
@ -165,8 +141,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
ssmtp_address | **Required.** The host's address. Defaults to "$address$".
|
||||||
port | **Optional.** The port that should be checked. Defaults to 465.
|
ssmtp_port | **Optional.** The port that should be checked. Defaults to 465.
|
||||||
|
|
||||||
### <a id="itl-ntp-time"></a> ntp_time
|
### <a id="itl-ntp-time"></a> ntp_time
|
||||||
|
|
||||||
|
@ -176,7 +152,7 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
ntp_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
|
|
||||||
### <a id="itl-ssh"></a> ssh
|
### <a id="itl-ssh"></a> ssh
|
||||||
|
|
||||||
|
@ -186,7 +162,7 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
ssh_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
|
|
||||||
### <a id="itl-disk"></a> disk
|
### <a id="itl-disk"></a> disk
|
||||||
|
|
||||||
|
@ -196,8 +172,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
wfree | **Optional.** The free space warning threshold in %. Defaults to 20.
|
disk_wfree | **Optional.** The free space warning threshold in %. Defaults to 20.
|
||||||
cfree | **Optional.** The free space critical threshold in %. Defaults to 10.
|
disk_cfree | **Optional.** The free space critical threshold in %. Defaults to 10.
|
||||||
|
|
||||||
### <a id="itl-users"></a> users
|
### <a id="itl-users"></a> users
|
||||||
|
|
||||||
|
@ -207,10 +183,10 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
wgreater | **Optional.** The user count warning threshold. Defaults to 20.
|
users_wgreater | **Optional.** The user count warning threshold. Defaults to 20.
|
||||||
cgreater | **Optional.** The user count critical threshold. Defaults to 50.
|
users_cgreater | **Optional.** The user count critical threshold. Defaults to 50.
|
||||||
|
|
||||||
### <a id="itl-processes"></a> processes
|
### <a id="itl-processes"></a> procs
|
||||||
|
|
||||||
Check command object for the `check_procs` plugin.
|
Check command object for the `check_procs` plugin.
|
||||||
|
|
||||||
|
@ -218,8 +194,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
wgreater | **Optional.** The process count warning threshold. Defaults to 250.
|
procs_wgreater | **Optional.** The process count warning threshold. Defaults to 250.
|
||||||
cgreater | **Optional.** The process count critical threshold. Defaults to 400.
|
procs_cgreater | **Optional.** The process count critical threshold. Defaults to 400.
|
||||||
|
|
||||||
### <a id="itl-swap"></a> swap
|
### <a id="itl-swap"></a> swap
|
||||||
|
|
||||||
|
@ -229,8 +205,8 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
wfree | **Optional.** The free swap space warning threshold in %. Defaults to 50.
|
swap_wfree | **Optional.** The free swap space warning threshold in %. Defaults to 50.
|
||||||
cfree | **Optional.** The free swap space critical threshold in %. Defaults to 25.
|
swap_cfree | **Optional.** The free swap space critical threshold in %. Defaults to 25.
|
||||||
|
|
||||||
### <a id="itl-load"></a> load
|
### <a id="itl-load"></a> load
|
||||||
|
|
||||||
|
@ -240,12 +216,12 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
wload1 | **Optional.** The 1-minute warning threshold. Defaults to 5.
|
load_wload1 | **Optional.** The 1-minute warning threshold. Defaults to 5.
|
||||||
wload5 | **Optional.** The 5-minute warning threshold. Defaults to 4.
|
load_wload5 | **Optional.** The 5-minute warning threshold. Defaults to 4.
|
||||||
wload15 | **Optional.** The 15-minute warning threshold. Defaults to 3.
|
load_wload15 | **Optional.** The 15-minute warning threshold. Defaults to 3.
|
||||||
cload1 | **Optional.** The 1-minute critical threshold. Defaults to 10.
|
load_cload1 | **Optional.** The 1-minute critical threshold. Defaults to 10.
|
||||||
cload5 | **Optional.** The 5-minute critical threshold. Defaults to 6.
|
load_cload5 | **Optional.** The 5-minute critical threshold. Defaults to 6.
|
||||||
cload15 | **Optional.** The 15-minute critical threshold. Defaults to 4.
|
load_cload15 | **Optional.** The 15-minute critical threshold. Defaults to 4.
|
||||||
|
|
||||||
### <a id="itl-snmp"></a> snmp
|
### <a id="itl-snmp"></a> snmp
|
||||||
|
|
||||||
|
@ -255,9 +231,9 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
snmp_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
oid | **Required.** The SNMP OID.
|
snmp_oid | **Required.** The SNMP OID.
|
||||||
community | **Optional.** The SNMP community. Defaults to "public".
|
snmp_community | **Optional.** The SNMP community. Defaults to "public".
|
||||||
|
|
||||||
### <a id="itl-snmp-uptime"></a> snmp-uptime
|
### <a id="itl-snmp-uptime"></a> snmp-uptime
|
||||||
|
|
||||||
|
@ -267,9 +243,9 @@ Custom Attributes:
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
----------------|--------------
|
----------------|--------------
|
||||||
address | **Required.** The host's address.
|
snmp_address | **Optional.** The host's address. Defaults to "$address$".
|
||||||
oid | **Optional.** The SNMP OID. Defaults to "1.3.6.1.2.1.1.3.0".
|
snmp_oid | **Optional.** The SNMP OID. Defaults to "1.3.6.1.2.1.1.3.0".
|
||||||
community | **Optional.** The SNMP community. Defaults to "public".
|
snmp_community | **Optional.** The SNMP community. Defaults to "public".
|
||||||
|
|
||||||
### <a id="itl-apt"></a> apt
|
### <a id="itl-apt"></a> apt
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ install_if_not_exists(icinga2/conf.d/hosts/localhost/http.conf ${CMAKE_INSTALL_S
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/icinga.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/icinga.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/kernel.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/kernel.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/load.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/load.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/processes.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/procs.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/ssh.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/ssh.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/swap.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/swap.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
install_if_not_exists(icinga2/conf.d/hosts/localhost/users.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
install_if_not_exists(icinga2/conf.d/hosts/localhost/users.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
|
||||||
|
|
|
@ -2,5 +2,5 @@ object Service "http" {
|
||||||
import "generic-service"
|
import "generic-service"
|
||||||
|
|
||||||
host_name = "localhost"
|
host_name = "localhost"
|
||||||
check_command = "http_ip"
|
check_command = "http"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
object Service "processes" {
|
|
||||||
import "generic-service"
|
|
||||||
|
|
||||||
host_name = "localhost"
|
|
||||||
check_command = "processes"
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
object Service "procs" {
|
||||||
|
import "generic-service"
|
||||||
|
|
||||||
|
host_name = "localhost"
|
||||||
|
check_command = "procs"
|
||||||
|
}
|
||||||
|
|
|
@ -17,58 +17,57 @@
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
object CheckCommand "ping4" {
|
template CheckCommand "ping-common" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
PluginDir + "/check_ping",
|
PluginDir + "/check_ping"
|
||||||
"-4",
|
]
|
||||||
"-H", "$address$",
|
|
||||||
"-w", "$wrta$,$wpl$%",
|
|
||||||
"-c", "$crta$,$cpl$%",
|
|
||||||
"-p", "$packets$",
|
|
||||||
"-t", "$timeout$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wrta = 100
|
arguments = {
|
||||||
vars.wpl = 5
|
"-H" = "$ping_address$"
|
||||||
vars.crta = 200
|
"-w" = "$ping_wrta$,$ping_wpl$%"
|
||||||
vars.cpl = 15
|
"-c" = "$ping_crta$,$ping_cpl$%"
|
||||||
vars.packets = 5
|
"-p" = {
|
||||||
vars.timeout = 0
|
value = "$ping_packets$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
"-t" = {
|
||||||
|
value = "$ping_timeout$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.ping_wrta = 100
|
||||||
|
vars.ping_wpl = 5
|
||||||
|
vars.ping_crta = 200
|
||||||
|
vars.ping_cpl = 15
|
||||||
|
}
|
||||||
|
|
||||||
|
object CheckCommand "ping4" {
|
||||||
|
import "ping-common",
|
||||||
|
|
||||||
|
command += [ "-4" ]
|
||||||
|
|
||||||
|
vars.ping_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "ping6" {
|
object CheckCommand "ping6" {
|
||||||
import "plugin-check-command",
|
import "ping-common",
|
||||||
|
|
||||||
command = [
|
command += [ "-6" ]
|
||||||
PluginDir + "/check_ping",
|
|
||||||
"-6",
|
|
||||||
"-H", "$address6$",
|
|
||||||
"-w", "$wrta$,$wpl$%",
|
|
||||||
"-c", "$crta$,$cpl$%",
|
|
||||||
"-p", "$packets$",
|
|
||||||
"-t", "$timeout$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wrta = 100,
|
vars.ping_address = "$address6$"
|
||||||
vars.wpl = 5,
|
|
||||||
|
|
||||||
vars.crta = 200,
|
|
||||||
vars.cpl = 15,
|
|
||||||
|
|
||||||
vars.packets = 5,
|
|
||||||
vars.timeout = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "hostalive" {
|
object CheckCommand "hostalive" {
|
||||||
import "ping4"
|
import "ping4"
|
||||||
|
|
||||||
vars.wrta = 3000.0,
|
vars.ping_wrta = 3000.0,
|
||||||
vars.wpl = 80,
|
vars.ping_wpl = 80,
|
||||||
|
|
||||||
vars.crta = 5000.0,
|
vars.ping_crta = 5000.0,
|
||||||
vars.cpl = 100
|
vars.ping_cpl = 100
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "dummy" {
|
object CheckCommand "dummy" {
|
||||||
|
@ -76,19 +75,19 @@ object CheckCommand "dummy" {
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
PluginDir + "/check_dummy",
|
PluginDir + "/check_dummy",
|
||||||
"$state$",
|
"$dummy_state$",
|
||||||
"$text$"
|
"$dummy_text$"
|
||||||
],
|
],
|
||||||
|
|
||||||
vars.state = 0,
|
vars.dummy_state = 0,
|
||||||
vars.text = "Check was successful."
|
vars.dummy_text = "Check was successful."
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "passive" {
|
object CheckCommand "passive" {
|
||||||
import "dummy",
|
import "dummy",
|
||||||
|
|
||||||
vars.state = 3,
|
vars.dummy_state = 3,
|
||||||
vars.text = "No Passive Check Result Received."
|
vars.dummy_text = "No Passive Check Result Received."
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "tcp" {
|
object CheckCommand "tcp" {
|
||||||
|
@ -96,9 +95,11 @@ object CheckCommand "tcp" {
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
PluginDir + "/check_tcp",
|
PluginDir + "/check_tcp",
|
||||||
"-H", "$address$",
|
"-H", "$tcp_address$",
|
||||||
"-p", "$port$"
|
"-p", "$tcp_port$"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
vars.tcp_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "udp" {
|
object CheckCommand "udp" {
|
||||||
|
@ -106,173 +107,194 @@ object CheckCommand "udp" {
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
PluginDir + "/check_udp",
|
PluginDir + "/check_udp",
|
||||||
"-H", "$address$",
|
"-H", "$udp_address$",
|
||||||
"-p", "$port$"
|
"-p", "$udp_port$"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
vars.udp_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "http_vhost" {
|
object CheckCommand "http" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_http"
|
||||||
PluginDir + "/check_http",
|
|
||||||
"-H", "$vhost$"
|
arguments = {
|
||||||
]
|
"-H" = {
|
||||||
}
|
value = "$http_vhost$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
"-I" = "$http_address$"
|
||||||
|
"-u" = {
|
||||||
|
value = "$http_uri$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
"-p" = {
|
||||||
|
value = "$http_port$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
"-S" = {
|
||||||
|
set_if = "$http_ssl$"
|
||||||
|
}
|
||||||
|
"-w" = {
|
||||||
|
value = "$http_warn_time$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
"-c" = {
|
||||||
|
value = "$http_critical_time$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
object CheckCommand "http_ip" {
|
vars.http_address = "$address$"
|
||||||
import "plugin-check-command",
|
vars.http_ssl = false
|
||||||
|
|
||||||
command = [
|
|
||||||
PluginDir + "/check_http",
|
|
||||||
"-H", "$address$"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
object CheckCommand "https_vhost" {
|
|
||||||
import "plugin-check-command",
|
|
||||||
|
|
||||||
command = [
|
|
||||||
PluginDir + "/check_http",
|
|
||||||
"-H", "$vhost$", "-S"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
object CheckCommand "https_ip" {
|
|
||||||
import "plugin-check-command",
|
|
||||||
|
|
||||||
command = [
|
|
||||||
PluginDir + "/check_http",
|
|
||||||
"-I", "$address$", "-S"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "smtp" {
|
object CheckCommand "smtp" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command"
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_smtp"
|
||||||
PluginDir + "/check_smtp",
|
|
||||||
"-H", "$address$"
|
arguments = {
|
||||||
]
|
"-H" = "$smtp_address$"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.smtp_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "ssmtp" {
|
object CheckCommand "ssmtp" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command"
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_ssmtp"
|
||||||
PluginDir + "/check_ssmtp",
|
|
||||||
"-H", "$address$",
|
|
||||||
"-p", "$port$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.port = 465
|
arguments = {
|
||||||
|
"-H" = "$ssmtp_address$"
|
||||||
|
"-p" = {
|
||||||
|
value = "$ssmtp_port$"
|
||||||
|
optional = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.ssmtp_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "ntp_time" {
|
object CheckCommand "ntp_time" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command"
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_ntp_time"
|
||||||
PluginDir + "/check_ntp_time",
|
|
||||||
"-H", "$address$"
|
arguments = {
|
||||||
]
|
"-H" = "$ntp_address$"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.ntp_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "ssh" {
|
object CheckCommand "ssh" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command"
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
PluginDir + "/check_ssh",
|
PluginDir + "/check_ssh",
|
||||||
"$address$"
|
"$ssh_address$"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
vars.ssh_address = "$address$"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "disk" {
|
object CheckCommand "disk" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_disk"
|
||||||
PluginDir + "/check_disk",
|
|
||||||
"-w", "$wfree$%",
|
|
||||||
"-c", "$cfree$%"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wfree = 20,
|
arguments = {
|
||||||
vars.cfree = 10,
|
"-w" = "$disk_wfree$%"
|
||||||
|
"-c" = "$disk_cfree$%"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.disk_wfree = 20
|
||||||
|
vars.disk_cfree = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "users" {
|
object CheckCommand "users" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_users"
|
||||||
PluginDir + "/check_users",
|
|
||||||
"-w", "$wgreater$",
|
|
||||||
"-c", "$cgreater$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wgreater = 20,
|
arguments = {
|
||||||
vars.cgreater = 50,
|
"-w" = "users_wgreater$"
|
||||||
|
"-c" = "$users_cgreater$"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.users_wgreater = 20
|
||||||
|
vars.users_cgreater = 50
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "processes" {
|
object CheckCommand "procs" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_procs"
|
||||||
PluginDir + "/check_procs",
|
|
||||||
"-w", "$wgreater$",
|
|
||||||
"-c", "$cgreater$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wgreater = 250,
|
arguments = {
|
||||||
vars.cgreater = 400,
|
"-w" = "$procs_wgreater$"
|
||||||
|
"-c" = "$procs_cgreater$"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.procs_wgreater = 250
|
||||||
|
vars.procs_cgreater = 400,
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "swap" {
|
object CheckCommand "swap" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_swap"
|
||||||
PluginDir + "/check_swap",
|
|
||||||
"-w", "$wfree$%",
|
|
||||||
"-c", "$cfree$%"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wfree = 50,
|
arguments = {
|
||||||
vars.cfree = 25,
|
"-w" = "$swap_wfree$%",
|
||||||
|
"-c" = "$swap_cfree$%"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.swap_wfree = 50
|
||||||
|
vars.swap_cfree = 25
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "load" {
|
object CheckCommand "load" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_load"
|
||||||
PluginDir + "/check_load",
|
|
||||||
"-w", "$wload1$,$wload5$,$wload15$",
|
|
||||||
"-c", "$cload1$,$cload5$,$cload15$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.wload1 = 5.0,
|
arguments = {
|
||||||
vars.wload5 = 4.0,
|
"-w" = "$load_wload1$,$load_wload5$,$load_wload15$"
|
||||||
vars.wload15 = 3.0,
|
"-c" = "$load_cload1$,$load_cload5$,$load_cload15$"
|
||||||
|
}
|
||||||
|
|
||||||
vars.cload1 = 10.0,
|
vars.load_wload1 = 5.0
|
||||||
vars.cload5 = 6.0,
|
vars.load_wload5 = 4.0
|
||||||
vars.cload15 = 4.0
|
vars.load_wload15 = 3.0
|
||||||
|
|
||||||
|
vars.load_cload1 = 10.0
|
||||||
|
vars.load_cload5 = 6.0
|
||||||
|
vars.load_cload15 = 4.0
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "snmp" {
|
object CheckCommand "snmp" {
|
||||||
import "plugin-check-command",
|
import "plugin-check-command",
|
||||||
|
|
||||||
command = [
|
command = PluginDir + "/check_snmp"
|
||||||
PluginDir + "/check_snmp",
|
|
||||||
"-H", "$address$",
|
|
||||||
"-o", "$oid$",
|
|
||||||
"-C", "$community$"
|
|
||||||
],
|
|
||||||
|
|
||||||
vars.community = "public"
|
arguments = {
|
||||||
|
"-H" = "$snmp_address$",
|
||||||
|
"-o" = "$snmp_oid$",
|
||||||
|
"-C" = "$snmp_community$"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars.snmp_address = "$address$"
|
||||||
|
vars.snmp_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.snmp_oid = "1.3.6.1.2.1.1.3.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
object CheckCommand "apt" {
|
object CheckCommand "apt" {
|
||||||
|
@ -285,15 +307,12 @@ object CheckCommand "apt" {
|
||||||
|
|
||||||
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 "agent" {
|
object CheckCommand "agent" {
|
||||||
import "agent-check-command"
|
import "agent-check-command"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,15 +45,13 @@ add_library(icinga SHARED
|
||||||
checkable-flapping.cpp checkcommand.cpp checkcommand.th checkresult.cpp checkresult.th
|
checkable-flapping.cpp checkcommand.cpp checkcommand.th checkresult.cpp checkresult.th
|
||||||
cib.cpp command.cpp command.th comment.cpp comment.th compatutility.cpp dependency.cpp dependency.th
|
cib.cpp command.cpp command.th comment.cpp comment.th compatutility.cpp dependency.cpp dependency.th
|
||||||
dependency-apply.cpp domain.cpp domain.th downtime.cpp downtime.th eventcommand.cpp eventcommand.th
|
dependency-apply.cpp domain.cpp domain.th downtime.cpp downtime.th eventcommand.cpp eventcommand.th
|
||||||
externalcommandprocessor.cpp host.cpp host.th hostgroup.cpp hostgroup.th
|
externalcommandprocessor.cpp host.cpp host.th hostgroup.cpp hostgroup.th icingaapplication.cpp
|
||||||
icingaapplication.cpp icingaapplication.th icingastatuswriter.cpp
|
icingaapplication.th icingastatuswriter.cpp icingastatuswriter.th legacytimeperiod.cpp macroprocessor.cpp
|
||||||
icingastatuswriter.th legacytimeperiod.cpp
|
notificationcommand.cpp notificationcommand.th notification.cpp notification.th notification-apply.cpp
|
||||||
macroprocessor.cpp macroresolver.cpp notificationcommand.cpp notificationcommand.th
|
perfdatavalue.cpp perfdatavalue.th pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.th
|
||||||
notification.cpp notification.th notification-apply.cpp perfdatavalue.cpp perfdatavalue.th
|
scheduleddowntime-apply.cpp service-apply.cpp checkable-check.cpp checkable-comment.cpp service.cpp
|
||||||
pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.th scheduleddowntime-apply.cpp
|
service.th servicegroup.cpp servicegroup.th checkable-notification.cpp timeperiod.cpp timeperiod.th
|
||||||
service-apply.cpp checkable-check.cpp checkable-comment.cpp service.cpp service.th
|
user.cpp user.th usergroup.cpp usergroup.th icinga-type.cpp
|
||||||
servicegroup.cpp servicegroup.th checkable-notification.cpp timeperiod.cpp timeperiod.th user.cpp user.th
|
|
||||||
usergroup.cpp usergroup.th icinga-type.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(icinga ${Boost_LIBRARIES} base config)
|
target_link_libraries(icinga ${Boost_LIBRARIES} base config)
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace icinga
|
||||||
abstract class Command : DynamicObject
|
abstract class Command : DynamicObject
|
||||||
{
|
{
|
||||||
[config] Value command (CommandLine);
|
[config] Value command (CommandLine);
|
||||||
|
[config] Value arguments;
|
||||||
[config] Value timeout {
|
[config] Value timeout {
|
||||||
default {{{ return 300; }}}
|
default {{{ return 300; }}}
|
||||||
};
|
};
|
||||||
|
|
|
@ -202,6 +202,15 @@
|
||||||
%attribute %array "command" {
|
%attribute %array "command" {
|
||||||
%attribute %string "*"
|
%attribute %string "*"
|
||||||
},
|
},
|
||||||
|
%attribute %dictionary "arguments" {
|
||||||
|
%attribute %string "*",
|
||||||
|
%attribute %dictionary "*" {
|
||||||
|
%attribute %string "value"
|
||||||
|
%attribute %string "description"
|
||||||
|
%attribute %number "optional"
|
||||||
|
%attribute %string "set_if"
|
||||||
|
}
|
||||||
|
},
|
||||||
%attribute %dictionary "env" {
|
%attribute %dictionary "env" {
|
||||||
%attribute %string "*"
|
%attribute %string "*"
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolvers,
|
Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolvers,
|
||||||
const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn)
|
const CheckResult::Ptr& cr, String *missingMacro,
|
||||||
|
const MacroProcessor::EscapeCallback& escapeFn)
|
||||||
{
|
{
|
||||||
Value result;
|
Value result;
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolv
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
if (str.IsScalar()) {
|
if (str.IsScalar()) {
|
||||||
result = InternalResolveMacros(str, resolvers, cr, escapeFn);
|
result = InternalResolveMacros(str, resolvers, cr, missingMacro, escapeFn);
|
||||||
} else if (str.IsObjectType<Array>()) {
|
} else if (str.IsObjectType<Array>()) {
|
||||||
Array::Ptr resultArr = make_shared<Array>();
|
Array::Ptr resultArr = make_shared<Array>();
|
||||||
Array::Ptr arr = str;
|
Array::Ptr arr = str;
|
||||||
|
@ -50,7 +51,7 @@ Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolv
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& arg, arr) {
|
BOOST_FOREACH(const Value& arg, arr) {
|
||||||
/* Note: don't escape macros here. */
|
/* Note: don't escape macros here. */
|
||||||
resultArr->Add(InternalResolveMacros(arg, resolvers, cr, EscapeCallback()));
|
resultArr->Add(InternalResolveMacros(arg, resolvers, cr, missingMacro, EscapeCallback()));
|
||||||
}
|
}
|
||||||
|
|
||||||
result = resultArr;
|
result = resultArr;
|
||||||
|
@ -150,7 +151,8 @@ bool MacroProcessor::ResolveMacro(const String& macro, const ResolverList& resol
|
||||||
}
|
}
|
||||||
|
|
||||||
String MacroProcessor::InternalResolveMacros(const String& str, const ResolverList& resolvers,
|
String MacroProcessor::InternalResolveMacros(const String& str, const ResolverList& resolvers,
|
||||||
const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn, int recursionLevel)
|
const CheckResult::Ptr& cr, String *missingMacro,
|
||||||
|
const MacroProcessor::EscapeCallback& escapeFn, int recursionLevel)
|
||||||
{
|
{
|
||||||
CONTEXT("Resolving macros for string '" + str + "'");
|
CONTEXT("Resolving macros for string '" + str + "'");
|
||||||
|
|
||||||
|
@ -179,12 +181,17 @@ String MacroProcessor::InternalResolveMacros(const String& str, const ResolverLi
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found) {
|
||||||
Log(LogWarning, "icinga", "Macro '" + name + "' is not defined.");
|
if (!missingMacro)
|
||||||
|
Log(LogWarning, "icinga", "Macro '" + name + "' is not defined.");
|
||||||
|
else
|
||||||
|
*missingMacro = name;
|
||||||
|
}
|
||||||
|
|
||||||
/* recursively resolve macros in the macro if it was a user macro */
|
/* recursively resolve macros in the macro if it was a user macro */
|
||||||
if (recursive_macro)
|
if (recursive_macro)
|
||||||
resolved_macro = InternalResolveMacros(resolved_macro, resolvers, cr, EscapeCallback(), recursionLevel + 1);
|
resolved_macro = InternalResolveMacros(resolved_macro,
|
||||||
|
resolvers, cr, missingMacro, EscapeCallback(), recursionLevel + 1);
|
||||||
|
|
||||||
if (escapeFn)
|
if (escapeFn)
|
||||||
resolved_macro = escapeFn(resolved_macro);
|
resolved_macro = escapeFn(resolved_macro);
|
||||||
|
|
|
@ -43,7 +43,8 @@ public:
|
||||||
typedef std::vector<ResolverSpec> ResolverList;
|
typedef std::vector<ResolverSpec> ResolverList;
|
||||||
|
|
||||||
static Value ResolveMacros(const Value& str, const ResolverList& resolvers,
|
static Value ResolveMacros(const Value& str, const ResolverList& resolvers,
|
||||||
const CheckResult::Ptr& cr, const EscapeCallback& escapeFn = EscapeCallback());
|
const CheckResult::Ptr& cr = CheckResult::Ptr(), String *missingMacro = NULL,
|
||||||
|
const EscapeCallback& escapeFn = EscapeCallback());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MacroProcessor(void);
|
MacroProcessor(void);
|
||||||
|
@ -52,7 +53,8 @@ private:
|
||||||
const CheckResult::Ptr& cr, String *result, bool *recursive_macro);
|
const CheckResult::Ptr& cr, String *result, bool *recursive_macro);
|
||||||
static String InternalResolveMacros(const String& str,
|
static String InternalResolveMacros(const String& str,
|
||||||
const ResolverList& resolvers, const CheckResult::Ptr& cr,
|
const ResolverList& resolvers, const CheckResult::Ptr& cr,
|
||||||
const EscapeCallback& escapeFn, int recursionLevel = 0);
|
String *missingMacro, const EscapeCallback& escapeFn,
|
||||||
|
int recursionLevel = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* Icinga 2 *
|
|
||||||
* Copyright (C) 2012-2014 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 "icinga/macroresolver.h"
|
|
||||||
|
|
||||||
using namespace icinga;
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
#include "base/scriptfunction.h"
|
#include "base/scriptfunction.h"
|
||||||
#include "base/utility.h"
|
#include "base/utility.h"
|
||||||
|
#include "base/convert.h"
|
||||||
#include "base/process.h"
|
#include "base/process.h"
|
||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
|
@ -35,6 +36,102 @@
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkable::Ptr& checkable,
|
||||||
|
const MacroProcessor::ResolverList& macroResolvers,
|
||||||
|
const boost::function<void(const Value& commandLine, const ProcessResult&)>& callback)
|
||||||
|
{
|
||||||
|
Value raw_command = commandObj->GetCommandLine();
|
||||||
|
Dictionary::Ptr raw_arguments = commandObj->GetArguments();
|
||||||
|
|
||||||
|
Value command;
|
||||||
|
if (!raw_arguments || raw_command.IsObjectType<Array>())
|
||||||
|
command = MacroProcessor::ResolveMacros(raw_command, macroResolvers, checkable->GetLastCheckResult(), NULL, Utility::EscapeShellArg);
|
||||||
|
else {
|
||||||
|
Array::Ptr arr = make_shared<Array>();
|
||||||
|
arr->Add(raw_command);
|
||||||
|
command = arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raw_arguments) {
|
||||||
|
ObjectLock olock(raw_arguments);
|
||||||
|
BOOST_FOREACH(const Dictionary::Pair& kv, raw_arguments) {
|
||||||
|
const String& argname = kv.first;
|
||||||
|
const Value& arginfo = kv.second;
|
||||||
|
|
||||||
|
bool optional = false;
|
||||||
|
String argval;
|
||||||
|
|
||||||
|
if (arginfo.IsObjectType<Dictionary>()) {
|
||||||
|
Dictionary::Ptr argdict = arginfo;
|
||||||
|
argval = argdict->Get("value");
|
||||||
|
optional = argdict->Get("optional");
|
||||||
|
|
||||||
|
String set_if = argdict->Get("set_if");
|
||||||
|
|
||||||
|
if (!set_if.IsEmpty()) {
|
||||||
|
String missingMacro;
|
||||||
|
String set_if_resolved = MacroProcessor::ResolveMacros(set_if, macroResolvers,
|
||||||
|
checkable->GetLastCheckResult(), &missingMacro);
|
||||||
|
|
||||||
|
if (!missingMacro.IsEmpty() || !Convert::ToLong(set_if_resolved))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
argval = arginfo;
|
||||||
|
|
||||||
|
String missingMacro;
|
||||||
|
String argresolved = MacroProcessor::ResolveMacros(argval, macroResolvers,
|
||||||
|
checkable->GetLastCheckResult(), &missingMacro);
|
||||||
|
|
||||||
|
if (!missingMacro.IsEmpty()) {
|
||||||
|
if (!optional) {
|
||||||
|
String message = "Non-optional macro '" + missingMacro + "' used in argument '" +
|
||||||
|
argname + "' is missing while executing command '" + commandObj->GetName() +
|
||||||
|
"' for object '" + checkable->GetName() + "'";
|
||||||
|
Log(LogWarning, "methods", message);
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
ProcessResult pr;
|
||||||
|
pr.ExecutionStart = Utility::GetTime();
|
||||||
|
pr.ExecutionStart = pr.ExecutionStart;
|
||||||
|
pr.Output = message;
|
||||||
|
callback(Empty, pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Array::Ptr command_arr = command;
|
||||||
|
command_arr->Add(argname);
|
||||||
|
if (!argval.IsEmpty())
|
||||||
|
command_arr->Add(argresolved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary::Ptr envMacros = make_shared<Dictionary>();
|
||||||
|
|
||||||
|
Dictionary::Ptr env = commandObj->GetEnv();
|
||||||
|
|
||||||
|
if (env) {
|
||||||
|
ObjectLock olock(env);
|
||||||
|
BOOST_FOREACH(const Dictionary::Pair& kv, env) {
|
||||||
|
String name = kv.second;
|
||||||
|
|
||||||
|
Value value = MacroProcessor::ResolveMacros(name, macroResolvers, checkable->GetLastCheckResult());
|
||||||
|
|
||||||
|
envMacros->Set(kv.first, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(command), envMacros);
|
||||||
|
process->SetTimeout(commandObj->GetTimeout());
|
||||||
|
process->Run(boost::bind(callback, command, _1));
|
||||||
|
}
|
||||||
|
|
||||||
ServiceState PluginUtility::ExitStatusToState(int exitStatus)
|
ServiceState PluginUtility::ExitStatusToState(int exitStatus)
|
||||||
{
|
{
|
||||||
switch (exitStatus) {
|
switch (exitStatus) {
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "icinga/i2-icinga.h"
|
#include "icinga/i2-icinga.h"
|
||||||
#include "icinga/service.h"
|
#include "icinga/service.h"
|
||||||
#include "icinga/checkcommand.h"
|
#include "icinga/checkcommand.h"
|
||||||
|
#include "icinga/macroprocessor.h"
|
||||||
|
#include "base/process.h"
|
||||||
#include "base/dictionary.h"
|
#include "base/dictionary.h"
|
||||||
#include "base/dynamicobject.h"
|
#include "base/dynamicobject.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -38,6 +40,10 @@ namespace icinga
|
||||||
class I2_ICINGA_API PluginUtility
|
class I2_ICINGA_API PluginUtility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static void ExecuteCommand(const Command::Ptr& commandObj, const Checkable::Ptr& checkable,
|
||||||
|
const MacroProcessor::ResolverList& macroResolvers,
|
||||||
|
const boost::function<void(const Value& commandLine, const ProcessResult&)>& callback = boost::function<void(const Value& commandLine, const ProcessResult&)>());
|
||||||
|
|
||||||
static ServiceState ExitStatusToState(int exitStatus);
|
static ServiceState ExitStatusToState(int exitStatus);
|
||||||
static std::pair<String, Value> ParseCheckOutput(const String& output);
|
static std::pair<String, Value> ParseCheckOutput(const String& output);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ REGISTER_SCRIPTFUNCTION(PluginCheck, &PluginCheckTask::ScriptFunc);
|
||||||
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr)
|
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr)
|
||||||
{
|
{
|
||||||
CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
|
CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
|
||||||
Value raw_command = commandObj->GetCommandLine();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -51,38 +50,15 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
||||||
resolvers.push_back(std::make_pair("command", commandObj));
|
resolvers.push_back(std::make_pair("command", commandObj));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, checkable->GetLastCheckResult(), Utility::EscapeShellArg);
|
PluginUtility::ExecuteCommand(commandObj, checkable, resolvers, boost::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2));
|
||||||
|
|
||||||
Dictionary::Ptr envMacros = make_shared<Dictionary>();
|
|
||||||
|
|
||||||
Dictionary::Ptr env = commandObj->GetEnv();
|
|
||||||
|
|
||||||
if (env) {
|
|
||||||
ObjectLock olock(env);
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, env) {
|
|
||||||
String name = kv.second;
|
|
||||||
|
|
||||||
Value value = MacroProcessor::ResolveMacros(name, resolvers, checkable->GetLastCheckResult());
|
|
||||||
|
|
||||||
envMacros->Set(kv.first, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cr->SetCommand(command);
|
|
||||||
|
|
||||||
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(command), envMacros);
|
|
||||||
|
|
||||||
process->SetTimeout(commandObj->GetTimeout());
|
|
||||||
|
|
||||||
process->Run(boost::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const ProcessResult& pr)
|
void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr)
|
||||||
{
|
{
|
||||||
String output = pr.Output;
|
String output = pr.Output;
|
||||||
output.Trim();
|
output.Trim();
|
||||||
std::pair<String, Value> co = PluginUtility::ParseCheckOutput(output);
|
std::pair<String, Value> co = PluginUtility::ParseCheckOutput(output);
|
||||||
|
cr->SetCommand(commandLine);
|
||||||
cr->SetOutput(co.first);
|
cr->SetOutput(co.first);
|
||||||
cr->SetPerformanceData(co.second);
|
cr->SetPerformanceData(co.second);
|
||||||
cr->SetState(PluginUtility::ExitStatusToState(pr.ExitStatus));
|
cr->SetState(PluginUtility::ExitStatusToState(pr.ExitStatus));
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
private:
|
private:
|
||||||
PluginCheckTask(void);
|
PluginCheckTask(void);
|
||||||
|
|
||||||
static void ProcessFinishedHandler(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const ProcessResult& pr);
|
static void ProcessFinishedHandler(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "methods/plugineventtask.h"
|
#include "methods/plugineventtask.h"
|
||||||
#include "icinga/eventcommand.h"
|
#include "icinga/eventcommand.h"
|
||||||
#include "icinga/macroprocessor.h"
|
#include "icinga/macroprocessor.h"
|
||||||
|
#include "icinga/pluginutility.h"
|
||||||
#include "icinga/icingaapplication.h"
|
#include "icinga/icingaapplication.h"
|
||||||
#include "base/dynamictype.h"
|
#include "base/dynamictype.h"
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
|
@ -35,7 +36,6 @@ REGISTER_SCRIPTFUNCTION(PluginEvent, &PluginEventTask::ScriptFunc);
|
||||||
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable)
|
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
EventCommand::Ptr commandObj = checkable->GetEventCommand();
|
EventCommand::Ptr commandObj = checkable->GetEventCommand();
|
||||||
Value raw_command = commandObj->GetCommandLine();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -48,26 +48,5 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable)
|
||||||
resolvers.push_back(std::make_pair("command", commandObj));
|
resolvers.push_back(std::make_pair("command", commandObj));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, checkable->GetLastCheckResult(), Utility::EscapeShellArg);
|
PluginUtility::ExecuteCommand(commandObj, checkable, resolvers);
|
||||||
|
|
||||||
Dictionary::Ptr envMacros = make_shared<Dictionary>();
|
|
||||||
|
|
||||||
Dictionary::Ptr env = commandObj->GetEnv();
|
|
||||||
|
|
||||||
if (env) {
|
|
||||||
ObjectLock olock(env);
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, env) {
|
|
||||||
String name = kv.second;
|
|
||||||
|
|
||||||
Value value = MacroProcessor::ResolveMacros(name, resolvers, checkable->GetLastCheckResult());
|
|
||||||
|
|
||||||
envMacros->Set(kv.first, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(command), envMacros);
|
|
||||||
|
|
||||||
process->SetTimeout(commandObj->GetTimeout());
|
|
||||||
|
|
||||||
process->Run();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "methods/pluginnotificationtask.h"
|
#include "methods/pluginnotificationtask.h"
|
||||||
#include "icinga/notification.h"
|
#include "icinga/notification.h"
|
||||||
#include "icinga/notificationcommand.h"
|
#include "icinga/notificationcommand.h"
|
||||||
|
#include "icinga/pluginutility.h"
|
||||||
#include "icinga/service.h"
|
#include "icinga/service.h"
|
||||||
#include "icinga/macroprocessor.h"
|
#include "icinga/macroprocessor.h"
|
||||||
#include "icinga/icingaapplication.h"
|
#include "icinga/icingaapplication.h"
|
||||||
|
@ -42,8 +43,6 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification, c
|
||||||
|
|
||||||
Checkable::Ptr checkable = notification->GetCheckable();
|
Checkable::Ptr checkable = notification->GetCheckable();
|
||||||
|
|
||||||
Value raw_command = commandObj->GetCommandLine();
|
|
||||||
|
|
||||||
Dictionary::Ptr notificationExtra = make_shared<Dictionary>();
|
Dictionary::Ptr notificationExtra = make_shared<Dictionary>();
|
||||||
notificationExtra->Set("type", Notification::NotificationTypeToString(type));
|
notificationExtra->Set("type", Notification::NotificationTypeToString(type));
|
||||||
notificationExtra->Set("author", author);
|
notificationExtra->Set("author", author);
|
||||||
|
@ -63,28 +62,7 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification, c
|
||||||
resolvers.push_back(std::make_pair("command", commandObj));
|
resolvers.push_back(std::make_pair("command", commandObj));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, cr, Utility::EscapeShellArg);
|
PluginUtility::ExecuteCommand(commandObj, checkable, resolvers, boost::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2));
|
||||||
|
|
||||||
Dictionary::Ptr envMacros = make_shared<Dictionary>();
|
|
||||||
|
|
||||||
Dictionary::Ptr env = commandObj->GetEnv();
|
|
||||||
|
|
||||||
if (env) {
|
|
||||||
ObjectLock olock(env);
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, env) {
|
|
||||||
String name = kv.second;
|
|
||||||
|
|
||||||
Value value = MacroProcessor::ResolveMacros(name, resolvers, checkable->GetLastCheckResult());
|
|
||||||
|
|
||||||
envMacros->Set(kv.first, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(command), envMacros);
|
|
||||||
|
|
||||||
process->SetTimeout(commandObj->GetTimeout());
|
|
||||||
|
|
||||||
process->Run(boost::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, command, _1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& command, const ProcessResult& pr)
|
void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& command, const ProcessResult& pr)
|
||||||
|
|
Loading…
Reference in New Issue