> On 19. Dec 2017, at 13:42, basti <mailingl...@unix-solution.de> wrote:
> 
> When I use a static part in the command it works:
> 
> icinga2:
> 
> root@icinga2:/etc/icinga2# /usr/lib/nagios/plugins/check_nrpe -t 30 -H
> firewall -c check_foo_ntp
> NTP OK: time difference 0.7s
> root@icinga2:/etc/icinga2#
> 
> static remote cmd:
> 
> object CheckCommand "nrpe-behind-parent" {
>        import "hostalive-common"
>        import "nrpe2"
>        command = [ PluginDir + "/check_nrpe" ]
> 
>        vars.nrpe_address = "$nrpe_parent$"
>        vars.nrpe_command = "check_" + "foo" + "_$name$"
> }
> 
> remote.cfg:
> 
> # test static
> command[check_foo_ntp]=/usr/lib/nagios/plugins/check_nrpe -H srv -c
> check_ntp_time
> 
> 
> what's the variable for the "hostname" (object Host "somehost") ??


You’re referring to a runtime macro, that’s $host.name$. See 
https://www.icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#host-runtime-macros

Kind regards,
Michael



> Am 19.12.2017 um 13:07 schrieb Michael Friedrich:
>> 
>> 
>>> On 19. Dec 2017, at 12:46, basti <mailingl...@unix-solution.de> wrote:
>>> 
>>> object CheckCommand "nrpe2" {
>>>       import "nrpe"
>>>       arguments["-2"] = {
>>>           set_if = "true"
>>>           description = "Only use Version 2 packets, not Version 3"
>>>       }
>>> }
>>> 
>>> I dont know where "hostalive-common" and "nrpe" come from.
>>> when i try define my one "nrpe" check command i get an error
>>> "redefine …."
>> 
>> Those are provided by the ITL, see the docs for their parameters.
>> 
>> The culprit lies in your “nrpe_command” attribute.
>> 
>> Hows that’s final compiled value for that specific check execution on the 
>> command line? I bet it doesn’t exist on the remote nrpe.cfg
>> 
>> Kind regards,
>> Michael
>> 
>>> 
>>> Am 19.12.2017 um 12:41 schrieb Michael Friedrich:
>>>> 
>>>> 
>>>>> On 19. Dec 2017, at 12:33, basti <mailingl...@unix-solution.de> wrote:
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> I have destroy my icinga2 config.
>>>>> Yesterday I have change something and after that nothing has worked again.
>>>>> I have search and try many thinks nothing helped.
>>>>> 
>>>>> A Host looks like:
>>>>> 
>>>>> 
>>>>> object Host "host-behind-firewall" {
>>>>> 
>>>>>   vars.check_ipv4 = true
>>>>>   vars.os = "Linux"
>>>>> 
>>>>>   vars.nrpe_parent = "firewall"
>>>>>   check_command    = "nrpe-behind-parent"
>>>>>   vars.checks_nrpe = [ "host",
>>>>>                        "apt",
>>>>>                        "ntp",
>>>>>                        "load",,
>>>>>                        "release",
>>>>>                        "disk_/",
>>>>>                      ]
>>>>> }
>>>>> 
>>>>> My check command looks like:
>>>>> 
>>>>> object CheckCommand "nrpe-behind-parent" {
>>>>>       import "hostalive-common"
>>>>>       import “nrpe2"
>>>> 
>>>> Where are these template definitions?
>>>> 
>>>>>       command = [ PluginDir + "/check_nrpe" ]
>>>>> 
>>>>>       vars.nrpe_address = "$nrpe_parent$"
>>>>>       vars.nrpe_command = "check_" + "$host$" + "_$name$"
>>>>> }
>>>>> 
>>>>> And there is the Problem I Think.
>>>>> 
>>>>> All checks return "NRPE v2.15".
>>>>> 
>>>>> When I try from commandline:
>>>>> 
>>>>> /usr/lib/nagios/plugins/check_nrpe -t 30 -H firewall  -c
>>>>> check_host-behind-firewall_ntp
>>>>> 
>>>>> I get a valid result.
>>>>> 
>>>>> NRPE v2.15 seems to be returned when no check is specified.
>>>>> 
>>>>> What's wrong in my checkCommand?
>>>>> 
>>>>> Best Regards,
>>>>> Basti
>>>>> 
>>>>> _______________________________________________
>>>>> icinga-users mailing list
>>>>> icinga-users@lists.icinga.org
>>>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>>> 
>>>> _______________________________________________
>>>> icinga-users mailing list
>>>> icinga-users@lists.icinga.org
>>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>>> 
>>> _______________________________________________
>>> icinga-users mailing list
>>> icinga-users@lists.icinga.org
>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>> 
>> _______________________________________________
>> icinga-users mailing list
>> icinga-users@lists.icinga.org
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>> 
> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to