Sender-host=ARG

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Dearl1988
Posts: 4
Joined: Wed Oct 18, 2017 6:29 am

Sender-host=ARG

Post 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!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Sender-host=ARG

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Dearl1988
Posts: 4
Joined: Wed Oct 18, 2017 6:29 am

Re: Sender-host=ARG

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Sender-host=ARG

Post 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.
Former Nagios employee
https://www.mcapra.com/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Sender-host=ARG

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked