forums.meulie.net

Problems with NSCA

I have nsca compiled on two machines right now (eventually there will be more but I want to have two working before I bother with the others). The problem is when I send from the distributed server I get:

0 data packet(s) sent to host successfully

The initial communication with the daemon seems to be working fine. When I run send_nsca manually from the command line it times me out after 10 seconds. I am also able to type in info and ctrl-D but I still get the 0 data packets error.

I get the same exact error when using the nsca daemon through xinetd.

did you check this thread?
meulie.net/forum_viewtopic.php?21.1341

Luca

YOu didn’t add the IPS to your /etc/xinetd.d/nsca file
like this:
service nsca
{
flags = REUSE
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nsca
server_args = -c /usr/local/nagios/etc/nsca.cfg --inetd
cps = 9000 30
instances = UNLIMITED
log_on_failure += USERID
disable = no
only_from = ipaddy1 ipaddy2
}

I’m still having the same problem. I have checked my config against that which I was directed too. I also changed my nsca config for xinetd to match the previous suggestion. I am still getting a connection but the data packets aren’t being sent.

I can’t tell you any more that the docs for nsca do. But I’ll see if any of this helps.

On the remote host is the send_nsca.cfg file. It should be setup correctly with the same encoding as the daemon config file.

On the remote host, you should have a checkcommands.cfg with:
define command{
command_name submit_check_result
command_line $USER1$/eventhandlers/submit_check_result $HOSTNAME$ ‘$SERVICEDESC$’ $SERVICESTATE$ ‘$OUTPUT$|$PERFDATA$’
}
On the remote host, you should have a file in
$USER1$/eventhandlers named submit_check_result.
That file should be like this:
#!/bin/sh

    # Arguments:
    #  $1 = host_name (Short name of host that the service is
    #       associated with)
    #  $2 = svc_description (Description of the service)
    #  $3 = state_string (A string representing the status of
    #       the given service - "OK", "WARNING", "CRITICAL"
    #       or "UNKNOWN")
    #  $4 = plugin_output (A text string that should be used
    #       as the plugin output for the service checks)
    #

    # Convert the state string to the corresponding return code
    return_code=-1

    case "$3" in
        OK)
                    return_code=0
                ;;
            WARNING)
                return_code=1
                    ;;
            CRITICAL)
                return_code=2
                    ;;
            UNKNOWN)
                return_code=-1
                    ;;
    esac

    # pipe the service check info into the send_nsca program, which
    # in turn transmits the data to the nsca daemon on the central
    # monitoring server

    /bin/echo "$1\\t$2\\t$return_code\\t$4\\n" | /export/home/nagios/bin/send_nsca ipofnagiosserver -c /export/home/nagios/etc/send_nsca.cfg

You should be able to use the contents of this file as a guide on how to sent the file from a unix prompt on the remote host.
The contents of that test would have to have a real hostname as defined on the nagios server plus a valid service description, a valid return code, and then finally some fake plugin output.

If you can’t succesfully run the command, then check your configs again.

Yeah I’m already at that point. I’ve run the command from the command line a few times now but to no avail. Still the same wierd error message. I have emailed Ethan and he is trying to help me with it right now. I think I’m going to try a clean compile/installation of nsca and see if that helps with anything.

The most bizzare part is that I get the connection fine but it tells me that it didn’t send any data which I believe since the external command file/pipe doesn’t change in size at all and nagios keeps saying that the service checks are stale.

Thanks for all the advice/help though.

Thanks for all the advice/help though.

In the web interface, clik the link to disable/enable passive service checks please.

It is currently claiming that service checks are dissabled. However I can’t find a link in the interface to toggle the state of passive service checks. Where would it be located? I’m using 2.0

Locate the service in the “service detail” link. Now you are looking at the “Service State Information” for that particular service. To the right are many links, one of which is “Stop accepting passive checks for this service” or “Start accepting passive checks for this service”. No matter what link is there what I want you to do, is to toggle it at least once. If it says “start” clik on start, if it says stop, clik on stop and then start. Between each clik, make sure you give it enough time, for the display to change the information found in the lower left of that window where it shows “Passive Checks: Enabled or Disabled”.

It toggles as would be expected but I still get 0 data packet(s) sent to host successfully. It happens whether it is on or off it doesn’t seem to matter if active checks are turned on or off either. I’m going to try a fresh install on a new machine I’m building and see if I have the same problem there. Seeing as how I seem to be the only person having this issue I have a very strong feeling it is with my system or configuration.

oops, on pg 2 now.
Edited Thu Nov 03 2005, 06:20AM ]

are you using the same encryption method, if not do so, and also, try using the default encryption method.

Please read your nsca config files.

Here is the send_nsca.cfg file on the distributed machine (with extra comments removed for brevity):

ENCRYPTION PASSWORD

password=deadbeef42

ENCRYPTION METHOD

encryption_method=1

And the nsca.cfg on the main server:

PORT NUMBER

server_port=5667

SERVER ADDRESS

server_address=192.168.8.73

ALLOWED HOST ADDRESSES

allowed_hosts=192.168.8.1

NSCA USER

nsca_user=nagios

NSCA GROUP

nsca_group=nagcmd

DEBUGGING OPTION

debug=1

COMMAND FILE

command_file=/usr/local/nagios/var/rw/nagios.cmd

ALTERNATE DUMP FILE

alternate_dump_file=/usr/local/nagios/var/rw/nsca.dump

AGGREGATED WRITES OPTION

aggregate_writes=0

APPEND TO FILE OPTION

append_to_file=0

MAX PACKET AGE OPTION

max_packet_age=30

DECRYPTION PASSWORD

password=deadbeef42

DECRYPTION METHOD

decryption_method=1

Here is the send_nsca.cfg file on the distributed machine (with extra comments removed for brevity):

ENCRYPTION PASSWORD

password=deadbeef42

ENCRYPTION METHOD

encryption_method=1

And the nsca.cfg on the main server:

PORT NUMBER

server_port=5667

SERVER ADDRESS

server_address=192.168.8.73

ALLOWED HOST ADDRESSES

allowed_hosts=192.168.8.1

NSCA USER

nsca_user=nagios

NSCA GROUP

nsca_group=nagcmd

DEBUGGING OPTION

debug=1

COMMAND FILE

command_file=/usr/local/nagios/var/rw/nagios.cmd

ALTERNATE DUMP FILE

alternate_dump_file=/usr/local/nagios/var/rw/nsca.dump

AGGREGATED WRITES OPTION

aggregate_writes=0

APPEND TO FILE OPTION

append_to_file=0

MAX PACKET AGE OPTION

max_packet_age=30

DECRYPTION PASSWORD

password=deadbeef42

DECRYPTION METHOD

decryption_method=1

[quote=“jakkedup”]YOu didn’t add the IPS to your /etc/xinetd.d/nsca file
like this:
service nsca
{
flags = REUSE
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nsca
server_args = -c /usr/local/nagios/etc/nsca.cfg --inetd
cps = 9000 30
instances = UNLIMITED
log_on_failure += USERID
disable = no
only_from = ipaddy1 ipaddy2
}
[/quote]

Did you put in your ipaddy of remote machine in this file? And did you restart xintetd?

Yep here is my xinetd config file for nsca

service nsca
{
flags = REUSE
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/sbin/nsca
server_args = -c /etc/nagios/nsca.cfg --inetd
cps = 9000 30
instances = UNLIMITED
log_on_failure += USERID
disable = no
only_from = 192.168.8.1
}

I just performed a clean install on another gentoo machine and am getting the same behavior. I am thoroughly confused.

I get the same exact behavior when running it as a stand alone daemon rather than via xinetd.

Firewall is blocking connections?