Forwarding status and events from one server to another

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: Forwarding status and events from one server to another

Postby rjconroy » Thu Feb 15, 2018 11:38 am

the event handlers do not appear to be off.

If I'm understanding you right in the commands.cfg it would appear that the notification commands run prior to the host check commands per the file structure. I assume you are referring to something other than that?

This should be an easy thing, I don't get why this seems so tricky and poorly documented. Yes, getting a little frustrated.
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am

Re: Forwarding status and events from one server to another

Postby rjconroy » Thu Feb 15, 2018 11:41 am

At this point i have 2 issues...

#1 I see the packets per tcpdump when the command is executed manually under wither the php or sh options. They are received at the parent, but none are being generated by the service at the child.

#2 Additionally the remote commands are not updating parent, the local checks do under the nrdp web page, but the remote commands based on the packets received do not. I had this working but it now appears to have dropped off again and I'm unsure why.
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am

Re: Forwarding status and events from one server to another

Postby rjconroy » Thu Feb 15, 2018 1:43 pm

update, once again the send_nrdp.sh command run manually seems to work, but the send_nrdp.php does not.
I'm going to try to edit the commands to use that, but, editing of this file is less clear, where do I add the url and token or is that only in the commands.cfg syntax?

After changing the commands in the commands.cfg to use the .sh over the .php and restarting Nagios I'm still not observing anything sent from the client automated. Manual send at command prompt works and updates accordingly but nothing is apparently sending from the commands.
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am

Re: Forwarding status and events from one server to another

Postby tgriep » Fri Feb 16, 2018 9:08 am

Go and enable debugging in the nagios.cfg file and restart the process.
Wait for a host or service to change state and see if the command is executed and if there are any errors.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8212
Joined: Thu Oct 30, 2014 9:02 am

Re: Forwarding status and events from one server to another

Postby rjconroy » Fri Feb 16, 2018 11:09 am

after setting debug this is the results I'm observing below. It seems to be trying and doesn't appear to be giving an error, but I don't see any packets parent server side and no updates are logged.

Code: Select all
[1518797112.096389] [256.1] [pid=25232] Running command '/usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="localhost" --service="Current Users" --state=0 --output="USERS OK - 2 users currently logged in"'...
[1518797112.210186] [256.1] [pid=25232] Execution time=0.113 sec, early timeout=0, result=0, output=(null)
[1518797118.215593] [2320.2] [pid=25232] Raw Command Input: /usr/lib/nagios/plugins/check_load --warning='$ARG1$,$ARG2$,$ARG3$' --critical='$ARG4$,$ARG5$,$ARG6$'
[1518797118.215625] [2320.2] [pid=25232] Expanded Command Output: /usr/lib/nagios/plugins/check_load --warning='$ARG1$,$ARG2$,$ARG3$' --critical='$ARG4$,$ARG5$,$ARG6$'
[1518797122.217415] [2320.2] [pid=25232] Raw Command Input: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --state=$HOSTSTATEID$ --output="$HOSTOUTPUT$"
[1518797122.217427] [2320.2] [pid=25232] Expanded Command Output: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --state=$HOSTSTATEID$ --output="$HOSTOUTPUT$"
[1518797122.217437] [256.1] [pid=25232] Running command '/usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="CentOS2" --state=1 --output="CRITICAL - Host Unreachable (192.168.1.94)"'...
[1518797122.378532] [256.1] [pid=25232] Execution time=0.161 sec, early timeout=0, result=0, output=(null)
[1518797122.378599] [2320.2] [pid=25232] Raw Command Input: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
[1518797122.378604] [2320.2] [pid=25232] Expanded Command Output: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
[1518797122.378614] [256.1] [pid=25232] Running command '/usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="localhost" --service="Current Load" --state=0 --output="OK - load average: 0.17, 0.25, 0.21"'...
[1518797122.542026] [256.1] [pid=25232] Execution time=0.163 sec, early timeout=0, result=0, output=(null)
[1518797141.049280] [2320.2] [pid=25232] Raw Command Input: /usr/lib/nagios/plugins/check_procs -w '$ARG1$' -c '$ARG2$'
[1518797141.049308] [2320.2] [pid=25232] Expanded Command Output: /usr/lib/nagios/plugins/check_procs -w '$ARG1$' -c '$ARG2$'
[1518797142.050189] [2320.2] [pid=25232] Raw Command Input: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
[1518797142.050201] [2320.2] [pid=25232] Expanded Command Output: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
[1518797142.050212] [256.1] [pid=25232] Running command '/usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="localhost" --service="Total Processes" --state=0 --output="PROCS OK: 107 processes"'...
[1518797142.174798] [256.1] [pid=25232] Execution time=0.124 sec, early timeout=0, result=0, output=(null)
[1518797148.177206] [2320.2] [pid=25232] Raw Command Input: /usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e
[1518797148.177229] [2320.2] [pid=25232] Expanded Command Output: /usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e
[1518797152.178950] [2320.2] [pid=25232] Raw Command Input: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
[1518797152.178962] [2320.2] [pid=25232] Expanded Command Output: /usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
[1518797152.178973] [256.1] [pid=25232] Running command '/usr/local/nrdp/clients/send_nrdp.php --url=https://w.x.z.z/nrdp/ --token=token1 --host="localhost" --service="Disk Space" --state=0 --output="DISK OK"'...
[1518797152.272201] [256.1] [pid=25232] Execution time=0.093 sec, early timeout=0, result=0, output=(null)


If I use the .sh command I get the following:
Code: Select all
[1518796971.071226] [256.1] [pid=20351] Running command '/usr/local/nrdp/clients/send_nrdp.sh --url=https://10.67.68.1/nrdp/ --token=cloudaccess1 --host="localhost" --service="HTTP" --state=0 --output="HTTP OK: HTTP/1.1 200 OK - 10975 bytes in 0.000 second response time"'...
[1518796971.075976] [256.1] [pid=20351] Execution time=0.004 sec, early timeout=0, result=0, output=
send_nrdp.sh Revision 0.6.1 - Send NRDP script for Nagios

Usage: send_nrdp.sh -u URL -t token [options]

Usage: send_nrdp.sh -h display help


This script is used to send NRDP data to a Nagios server

Required:
    -u,    URL of NRDP server.  Usually http://<IP_ADDRESS>/nrdp/
    -t,    Shared token.  Must be the same token set in NRDP Server

Options:
    Single Check:
        -H    host name
        -s    service name
        -S    State
        -o     output

    STDIN:
        [-d    delimiter] (default -d "\t")
        With only the required parameters send_nrdp.sh is capable of
        processing data piped to it either from a file or other
        process.  By default, we use \t as the delimiter however this
        may be specified with the -d option data should be in the
        following formats one entry per line.
        For Host checks:
        hostname    State    output
        For Service checks
        hostname    servicename    State    output

    File:
        -f /full/path/to/file
        This file will be sent to the NRDP server specified in -u
        The file should be an XML file in the following format
        ##################################################

        <?xml version='1.0'?>
        <checkresults>
          <checkresult type="host" checktype="1">
            <hostname>YOUR_HOSTNAME</hostname>
            <state>0</state>
            <output>OK|perfdata=1.00;5;10;0</output>
          </checkresult>
          <checkresult type="service" checktype="1">
            <hostname>YOUR_HOSTNAME</hostname>
            <servicename>YOUR_SERVICENAME</servicename>
            <state>0</state>
            <output>OK|perfdata=1.00;5;10;0</output>
          </checkresult>
        </checkresults>
        ##################################################

    Directory:
        -D /path/to/temp/dir
        This is a directory that contains XML files in the format
        above.  Additionally, if the -d flag is specified, send_nrdp.sh
        will create temp files here if the server could not be reached.
        On additional calls with the same -D path, if a connection to
        the server is successful, all temp files will be sent.
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am

Re: Forwarding status and events from one server to another

Postby rjconroy » Fri Feb 16, 2018 12:24 pm

update:
ok, I think I solved part of it regarding the sytnax on the .sh usage and I am seeing packets sent now using https. I can see the Nagios.log on the parent updating as the packets are coming in.

What I'm not seeing is the status updates being reflected.

If I look in the Nagios.log on the receiving parent I see the following...
[1518801715] Warning: Check result queue contained results for service 'HTTPS' on host 'CentOS1', but the service could not be found! Perhaps you forgot to define the service in your config files?
[1518801745] Warning: Check result queue contained results for service 'HTTPS' on host 'Windows2008', but the service could not be found! Perhaps you forgot to define the service in your config files?
Which indicates it pulled the results from the checkrulsts for those hosts, however, the oeverall state of the host isn't updating and is still showing as down.

Here are the updated commands in use in commands.cfg:
Code: Select all
define command{
   command_name send_nrdp_host
   command_line /usr/local/nrdp/clients/send_nrdp.sh -u https://10.67.68.1/nrdp/ -t cloudaccess1 -H "$HOSTNAME$" -S $HOSTSTATEID$ -o"$HOSTOUTPUT$"
   }

define command{
    command_name send_nrdp_service
    command_line /usr/local/nrdp/clients/send_nrdp.sh -u https://10.67.68.1/nrdp/ -t cloudaccess1 -H "$HOSTNAME$" -s "$SERVICEDESC$" -S $SERVICESTATEID$ -o "$SERVICEOUTPUT$"
   }
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am

Re: Forwarding status and events from one server to another

Postby rjconroy » Fri Feb 16, 2018 1:11 pm

Update.... I think I finally got it.
I found a syntax error in the command when I shifted it from the php file to the sh file, once adjusted its working.
I've now set it to use https over http and I am seeing remote status for both hosts and services.
Thank you very much to all who replied and helped.
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am

Re: Forwarding status and events from one server to another

Postby tgriep » Fri Feb 16, 2018 4:03 pm

Yes! Glad it is working. Kind of strange that the php script doesn't work.
I have a Centos7 system running Core 3.5.1 and it works just fine.
Let us know if it is OK to close the post for you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8212
Joined: Thu Oct 30, 2014 9:02 am

Re: Forwarding status and events from one server to another

Postby rjconroy » Tue Feb 20, 2018 3:34 pm

Is there any way I can get a transcript of the thread for my reference material?
Yes it can be closed, assuming it remains online for reference :) at least for a little while
rjconroy
 
Posts: 38
Joined: Fri Feb 02, 2018 11:57 am


PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 9 guests