You have to replace hostname with a host in icinga2 and 
icinga_internal_servicename with the name of the service.

Kind Regards,
Ivo Kidze

-----Original Message-----
From: Xavier Humbert [mailto:xavier.humb...@ac-nancy-metz.fr] 
Sent: Wednesday, January 23, 2019 1:51 AM
To: Icinga User's Corner <icinga-users@lists.icinga.org>; Ivo Kidze 
<ivo.ki...@duke.edu>
Subject: Re: [icinga-users] Nagios plugin fails to execute, but OK in command 
line


On 22/01/2019 21:11, Xavier Humbert wrote:
> On 22/01/2019 18:00, Ivo Kidze wrote:
>> Hi Xavier,
>>
>> Try the following as system sudo user or system root user
>>
>> 1. ICINGA2_API_PASSWORD=api_user_password icinga2 console --connect 
>> 'https://api_user@localhost:5665/'
>> 2. s = 
>> get_service("hostname","icinga_internal_servicename").last_check_resu
>> lt.command
>> 3. s
>>
>> Post your result if you can't see what is wrong.
>>
>> Kind Regards,
>> Ivo Kidze
[...]
>> Thanks Ivo, I'll take look tomorrow
>>
>> Regards,
>>
>> Xavier

OK, tried your command :

ICINGA2_API_PASSWORD=xxxxxxxxxxxxx icinga2 console --connect 
'https://root@localhost:5665/'
Icinga 2 (version: r2.10.2-1)
Type $help to view available commands.
<1> => s =
get_service("hostname","icinga_internal_servicename").last_check_result.command
null
<2> => s
null

Thanks for your help

--
Xavier Humbert
CRT Supervision et Exploitation de Niveau 1 Rectorat de Nancy-Metz
03 83 86 27 39


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

Reply via email to