Sending Data Between Nagios Servers

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Re: Sending Data Between Nagios Servers

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Sending Data Between Nagios Servers

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Re: Sending Data Between Nagios Servers

Post by optionstechnology »

How do I attach the commands to the services?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Sending Data Between Nagios Servers

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Re: Sending Data Between Nagios Servers

Post 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?
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Re: Sending Data Between Nagios Servers

Post 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
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Re: Sending Data Between Nagios Servers

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Sending Data Between Nagios Servers

Post by scottwilkerson »

Admin -> System Settings
check "Allow HTML Tags in Host/Service Status "
Save
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Re: Sending Data Between Nagios Servers

Post by optionstechnology »

Yeah that is set already - it seems to remove them when it passes them to the nrdp command
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Sending Data Between Nagios Servers

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked