Page 3 of 6
Re: Sending Data Between Nagios Servers
Posted: Mon Jun 04, 2018 5:59 am
by optionstechnology
OK, so I put this in place but it just doesn't work - I stripped out all of the macros as global event handlers have their own macros that are different from the standard macros...for some reason
But even when I strip these out and hard code it all it still does nothing
So, I have this set in my Nagios.cfg -
obsess_over_hosts=1
obsess_over_services=1
ocsp_timeout=5
I have this set in the Global Event Handler -
/usr/local/nrdp/clients/send_nrdp.sh -u
https://NAGSERVER/nrdp -t TOKEN -H HOSTNAME -s "Port - WAN Test" -S ok -o "This is a test global event handler"
And I have ticket the box to enable it
The service named above has 'obsess over service' set to on
When I run that command from the command line it works perfectly fine, so it is definitely a problem with it being executed
Is there another checkbox somewhere I am missing?
I can see this error in nagios.cfg but I'm not sure if its related as it looks like it has been happening for some time
[1528109693] wproc: GLOBAL SERVICE EVENTHANDLER job 7425 from worker Core Worker 26246 is a non-check helper but exited with return code 7
[1528109693] wproc: early_timeout=0; exited_ok=1; wait_status=1792; error_code=0;
[1528109693] wproc: stderr line 01: execvp(/usr/bin/php, ...) failed. errno is 7: Argument list too long
Re: Sending Data Between Nagios Servers
Posted: Mon Jun 04, 2018 10:48 am
by cdienger
@
@vazudevan that explains it

I think a feature request would be appropriate for this as well and I'll file one.
@
@optionstechnology, you do not want to set the global event handler. Instead, create the two commands under Configure > Core Config Manager > Commands > _Commands and edit the hosts/services/templates/etc... to set the $_CUSTNAG$ and $_CUSTTOKEN$ variables(Misc Settings > Manage Free Variables):
https://assets.nagios.com/downloads/nag ... gement.pdf
Re: Sending Data Between Nagios Servers
Posted: Tue Jun 05, 2018 3:20 am
by optionstechnology
How do I attach the commands to the services?
Re: Sending Data Between Nagios Servers
Posted: Tue Jun 05, 2018 1:09 pm
by cdienger
By editing the nagios.cfg(Configure > Core Config Manager > CCM Admin > Core Configs > General. For example:
obsess_over_hosts=1
obsess_over_services=1
ochp_command=send_nrdp_host
ocsp_command=send_nrdp_service
Re: Sending Data Between Nagios Servers
Posted: Wed Jun 06, 2018 10:08 am
by optionstechnology
OK, I have set the following in nagios.cfg -
obsess_over_hosts=1
obsess_over_services=1
ochp_command=send_nrdp_host
ocsp_command=send_nrdp_service
This is the host command -
send_nrdp_host
/usr/local/nrdp/clients/send_nrdp.sh -u
https://NAGSERVER/nrdp -t TOKEN -H HOSTNAME -S up -o "test host up"
This is the service command -
send_nrdp_service
/usr/local/nrdp/clients/send_nrdp.sh -u
https://NAGSERVER/nrdp -t TOKEN -H HOSTNAME -s "Port - WAN Test" -S ok -o "This is a test from event handler"
(should these be designated as check commands or misc commands or does it matter?)
I have set the service and the host to obsess
I have restarted the nagios service
I still get nothing
It works fine from command line
I'm getting loads of these events in the nagios log-
[1528297143] wproc: OCSP job 1180 from worker Core Worker 1550 is a non-check helper but exited with return code 2
[1528297143] wproc: host=HOSTNAME; service=CPU - Usage; contact=(none)
[1528297143] wproc: early_timeout=0; exited_ok=1; wait_status=512; error_code=0;
[1528297143] wproc: stdout line 01: ERROR: The NRDP Server said BAD XML
Is the nagios scrambling the command? does it need escape characters or something?
Re: Sending Data Between Nagios Servers
Posted: Wed Jun 06, 2018 10:28 am
by optionstechnology
Actually just figured it out
its a known bug with nrdp -
https://github.com/NagiosEnterprises/nrdp/issues/19
Fixed in the latest issue
Nagios Support - you should update this addon in your OVF
Re: Sending Data Between Nagios Servers
Posted: Wed Jun 06, 2018 10:40 am
by optionstechnology
Just one more thing (Always something!)
I use HTML <BR>'s in my status output
When i run this from command line it sends the characters over fine
When I run it from Nagios it strips out the '<' '>' characters....
How do I tell it not to do that?
Re: Sending Data Between Nagios Servers
Posted: Wed Jun 06, 2018 2:06 pm
by scottwilkerson
Admin -> System Settings
check "Allow HTML Tags in Host/Service Status "
Save
Re: Sending Data Between Nagios Servers
Posted: Thu Jun 07, 2018 3:11 am
by optionstechnology
Yeah that is set already - it seems to remove them when it passes them to the nrdp command
Re: Sending Data Between Nagios Servers
Posted: Thu Jun 07, 2018 9:45 am
by scottwilkerson
I just realized that your send_nrdp_host & send_nrdp_service commands are using send_nrdp.php and when you run it form the command line you are using /usr/local/nrdp/clients/send_nrdp.sh
Can you change the commands to use the latter? I think there may be a bug in the php version stripping them out where the .sh version works correctly.