Page 1 of 1

Nagios NSCA error

Posted: Wed Mar 21, 2012 7:42 am
by ayush1440
Hello Friends,

I am very newbie for Nagios and specially for NSCA. I configured nagios core & plugin successfully and works very well on Ubuntu Server.

Now requirement is to configure nsca for tomcat log4j monitor. I configure nsca as wiki & how to docs and works but I have some confusion on this.

Here is my configuration. : -

Templates.cfg - end Section

Code: Select all

define service{
        use                             generic-service
        name                            passive_service
        active_checks_enabled           0
        passive_checks_enabled          1
        flap_detection_enabled          0
        register                        0
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           3
        retry_check_interval            1
        check_freshness                 0
        freshness_threshold             180
        contact_groups                  admins
        notification_interval           60
        notification_period             24x7
        notification_options            w,u,c,r
        stalking_options                w,c,u
        }
Inside localhost.cfg

Code: Select all

define service{
        use                             passive_service
        service_description             TestMessage
        host_name                       Pompei
        check_command                   check_dummy!0
        }
Nagios Error Log

Code: Select all

[1332332789] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;localhost ;TestMessage ;3;This isdsfhksdfjskf a Test Error [return]
[1332332789] Warning:  Passive check result was received for service 'TestMessage ' on host 'localhost ', but the host could not be found!
[1332333079] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;localhost ;TestMessage ;3;This isdsfhksdfjskf a Test Error [return]
[1332333079] Warning:  Passive check result was received for service 'TestMessage ' on host 'localhost ', but the host could not be found!
I tried several things by Google but can't help anything.

Also on my web ui service last checked is shown but Next schedule check shown as a N/A.

kindly please help me on this.

Help would be really appreciated. Further information will be given if required.

Sorry for bad english.. :(

Thanks & Regards,

Re: Nagios NSCA error

Posted: Wed Mar 21, 2012 9:37 am
by mguthrie
I think you got bit by the empty whitespace. You're sending:

Code: Select all

localhost ;TestMessage ;3;This isdsfhksdfjskf a Test Error 
Try:

Code: Select all

localhost;TestMessage;3;This isdsfhksdfjskf a Test Error 
You don't want spaces in between the semi-colons.

Re: Nagios NSCA error

Posted: Thu Mar 22, 2012 1:11 am
by ayush1440
mguthrie wrote:I think you got bit by the empty whitespace. You're sending:

Code: Select all

localhost ;TestMessage ;3;This isdsfhksdfjskf a Test Error 
Try:

Code: Select all

localhost;TestMessage;3;This isdsfhksdfjskf a Test Error 
You don't want spaces in between the semi-colons.

Thanks a lot for replying.

I am using test.txt for testing purpose. Here is a test.txt detail

Code: Select all

localhost   TestMessage   3    This isdsfhksdfjskf a Test Error
I am using following command :
/usr/local/nagios/bin/send_nsca -H localhost -p 5667 -c /usr/local/nagios/etc/send_nsca.cfg < /root/test.txt
When I executing your code in text I receive .0 data packet(s) sent to host successfully.

Can you please give me some other string for check.

Also I show in my webui, configured Passive check service don't update automatically for this test.

Re: Nagios NSCA error

Posted: Thu Mar 22, 2012 11:52 am
by mguthrie
Try this in the text file:

Code: Select all

localhost;TestMessage;3;'This isdsfhksdfjskf a Test Error'

And this command:

Code: Select all

/usr/local/nagios/bin/send_nsca -H localhost -d ';' -p 5667 -c /usr/local/nagios/etc/send_nsca.cfg < /root/test.txt
(added a semi-colon as a delimiter). I would suggest always single quoting your plugin output as well.

Re: Nagios NSCA error

Posted: Fri Mar 23, 2012 4:18 am
by ayush1440
Thanks a lot for your help. Given code is looks like working but there is no change in WEB UI.

Here is log detail.

Code: Select all

[1332493662] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;localhost;TestMessage;3;'This isdsfhksdfjskf a Test Error'
[1332493662] Warning:  Passive check result was received for service 'TestMessage' on host 'localhost', but the host could not be found!
May be there is some mistake. Please help me on this too.

Again big big thanks for your help.