You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 16, 2018. It is now read-only.
This issue has been migrated from Redmine: https://dev.icinga.com/issues/11028
Created by tepe on 2016-01-25 10:41:51 +00:00
Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-01-25 10:41:51 +00:00 (in Redmine)
Hey,
I would like to use an icinga function for nrpe_arguments.
https://github.com/Icinga/puppet-icinga2/blob/develop/templates/object\_apply\_service.conf.erb
<%- if
vars.any? -%>vars += <%= scope.function_icinga2_config_value([
vars]) %> <%- end -%>
example:
icinga2::object::apply_service {"check_load": display_name => 'load', check_command => 'nrpe', vars => { nrpe_command => 'check_load', nrpe_arguments => '{{ if (host.vars.cpu){ var warn=host.vars.cpu*1.5 + "," + host.vars.cpu*1.7 + "," + host.vars.cpu*1.9 var crit=host.vars.cpu*3 + "," + host.vars.cpu*3.5 + "," + host.vars.cpu*4 return warn + "!" + crit }else{ return "2,3,3.5!4,4.5,5" } }}', }, assign_where => 'host.vars.os == "Linux"', ignore_where => 'host.vars.zone == "uri" || host.name == "localhost"', }
result:
@~# cat /etc/icinga2/objects/applys/check_load.conf
/****
*/
/****
*/
apply Service "check_load" to Host {
import "generic-service"
display_name = "load"
assign where host.vars.os "Linux"
ignore where host.vars.zone "uri" || host.name == "localhost"
check_command = "nrpe"
vars += {
"nrpe_arguments" = "{{\n \tif (host.vars.cpu){\n \t\tvar warn=host.vars.cpu*1.5 + \",\" + host.vars.cpu*1.7 + \",\" + host.vars.cpu*1.9\n \t\tvar crit=host.vars.cpu*3 + \",\" + host.vars.cpu*3.5 + \",\" + host.vars.cpu*4\n \t\treturn warn + \"!\" + crit\n \t\t}else{\n \t\treturn \"2,3,3.5!4,4.5,5\n \t\t}\n \t}}"
"nrpe_command" = "check_load"
}
enable_notifications = true
}@
This result is unuseable for icinga2, check_load does not work. Follow works fine:
@/****
*/
/****
*/
apply Service "check_load" to Host {
import "generic-service"
display_name = "load"
assign where host.vars.os "Linux"
ignore where host.vars.zone "uri" || host.name == "localhost"
check_command = "nrpe"
vars += {
"nrpe_arguments" = {{ if (host.vars.cpu){
var warn=host.vars.cpu*1.5 + "," + host.vars.cpu*1.7 + "," + host.vars.cpu*1.9
var crit=host.vars.cpu*3 + "," + host.vars.cpu*3.5 + "," + host.vars.cpu*4
return warn + "!" + crit
}else{
return "2,3,3.5!4,4.5,5"
}
}}
"nrpe_command" = "check_load"
}
enable_notifications = true
}@
Perhaps a bug or I use icinga2::object::apply_service in a wrong way.
Viele Gruesse,
thomas.
The text was updated successfully, but these errors were encountered: