Page 1 of 1
Sender-host=ARG
Posted: Fri Mar 09, 2018 12:40 pm
by Dearl1988
I'm currently working on Windows Server 2016 with NSClient++ (x64) 0.5.0062
I have written a powershell script to send notifications to Nagios using this line of code
Code: Select all
Set-Alias nscp "C:\Program Files\NSClient++\nscp.exe" -Scope Global
nscp client --module NSCAClient address=172.22.50.9:5667 encryption=XOR command="MDI_zip_d" result=$status message="$global:statusInformation"
I have set the nsclient.ini on the section [/settings/NSCA/client] a new hostname, you see.. My current hostname on the server is all capitalized like this, MDIARCH03, the server on Nagios is configured in lowercase letter... Before this version of Nagios, I used to tell through the above command the server name through the line sender-host=mdiarch03 and that would work just fine. But ever since we upgraded to this new version the passive check won't work.
This is what I get from the event log
[09-03-2018 17:26:12] Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;MDIARCH03;MDI_zip_d;2;teste do nagios
[09-03-2018 17:26:11] Warning: Passive check result was received for service 'MDI_zip_d' on host 'MDIARCH03', but the host could not be found!
Re: Sender-host=ARG
Posted: Fri Mar 09, 2018 2:03 pm
by npolovenko
Hello,
@Dearl1988. I think the NSClient 0.5.x defaults to uppercase if a hostname is set to auto. Do you have the hostname set to auto in nsclient.ini file by chance?
Code: Select all
; HOSTNAME - The host name of the monitored computer. Set this to auto (default) to use the windows name of the computer. auto Hostname ${host} Hostname ${host_lc} Hostname in lowercase ${host_uc} Hostname in uppercase ${domain} Domainname ${domain_lc} Domainname in lowercase ${domain_uc} Domainname in uppercase
hostname = auto
I suggest trying the ${host_uc} variable instead.
Re: Sender-host=ARG
Posted: Fri Mar 16, 2018 9:09 am
by Dearl1988
npolovenko wrote:Hello,
@Dearl1988. I think the NSClient 0.5.x defaults to uppercase if a hostname is set to auto. Do you have the hostname set to auto in nsclient.ini file by chance?
Code: Select all
; HOSTNAME - The host name of the monitored computer. Set this to auto (default) to use the windows name of the computer. auto Hostname ${host} Hostname ${host_lc} Hostname in lowercase ${host_uc} Hostname in uppercase ${domain} Domainname ${domain_lc} Domainname in lowercase ${domain_uc} Domainname in uppercase
hostname = auto
I suggest trying the ${host_uc} variable instead.
Thanks for your suggestion, but I'd have to go with the external commands like source-host or sender-host like it used to work on previous version.
The reason for that is because I run my program on the server MDIARCH03 and the service I'm reporting to is set on server mdifs05 which is a host object I created on the Nagios server.
Re: Sender-host=ARG
Posted: Fri Mar 16, 2018 9:30 am
by mcapra
Dearl1988 wrote:I have set the nsclient.ini on the section [/settings/NSCA/client] a new hostname, you see.
Is that value
hostname=mdifs05?
If it's not, and that is the Nagios configuration object you would like to associate with this particular machine, then you'll need to do that. Or alter your
nscp command in the Powershell script to include
sender-host=mdifs05.
Perhaps I'm misunderstanding the problem, but if you want to update a particular Nagios configuration object via NSCA, NRDP, or external commands, you need to provide a valid object's
host_name value.
Re: Sender-host=ARG
Posted: Fri Mar 16, 2018 1:27 pm
by npolovenko
I agree with
@mcapra, we could use some clarification here.
I have set the nsclient.ini on the section [/settings/NSCA/client] a new hostname, you see..
What is the current value?