[Nagiosplug-help] How to get NSCA running? Any HOWTO's out there?

Andreas Ericsson ae at op5.se
Thu Feb 17 00:20:22 CET 2005


Hastings, Spencer wrote:
> I'm running into issues trying to get NSCA up and running. I looked through
> the archives and saw a few posts that deal with what looks to me like the
> same issue, but no response that actually makes things click.
> 
> I'm trying to run a utility, any utility, in this case though I am using
> check_disk on another node and send back the results via NSCA. (I'm using
> this over NRPE or check_by_ssh because eventually I will need applications
> to submit their results back to the master-server if they encounter an
> error. So I thought testing a simple Nagios plugin and sending back the
> results would be fine to test it).
> 
> So this is a passive check test.
> 
> I read the notes, compiled the mcrypt libraries, and then compiled the NSCA
> plugin. I set the passwords and encryption level, configured NSCA to run a a
> daemon. Made the nsca_send client, populated it, etc. No issues.
> 
> I turned on check_external_commands in the nagios.cfg file.. no issue there
> either.
> 
> So I run this on my remote host by manual execution and format it and pipe
> it into NSCA.. 
> My line basically looks like this : 
> 
> testserver1 check_remote_disk 1 DISK CRITICAL - free space: /usr 93 MB
> (5%);| /usr=1636MB;1209;1555;0;1728
> 
> cat bob|./send_nsca -H xx.xx.xx.xx -p 5667 -c send_nsca.cfg
> And its accepted after my formatting.. : 1 data packet(s) sent to host
> successfully.
> 
> It appears in my $NAGIOS/rw/nagios.cmd dir : [1108561917]
> PROCESS_HOST_CHECK_RESULT;testserver1 check_remote_disk;1;DISK CRITICAL -
> free space: /usr 93 MB (5%);| /usr=1636MB;1209;1555;0;1728
> 
> In the Nagios log file on the master server I get : 
> 
> [1108559934] Warning: Unrecognized external command ->
> PROCESS_HOST_CHECK_RESULT;testserver1 check_remote_disk;1;DISK CRITICAL -
> free space: /usr 93 MB (5%);| /usr=1636MB;1209;1555;0;1728
> 

Which means you screwed up. Read up on submitting passive service checks 
(I would believe it would be PROCESS_SERVICE_CHECK_RESULT, for 
starters). If you can't find proper documentation, look in either 
cgi/cmd.c or base/commands.c and I'm sure you'll be able to work 
something out.

> I define a passive service template in services.cfg.
> 
> define service{
>         name                            generic-service-passive ; The 'name'
> of this service template
>         active_checks_enabled           0       ; Active service checks are
> enabled
>         passive_checks_enabled          1       ; Passive service checks are
> enabled/accepted
>         parallelize_check               1       ; Active service checks
> should be parallelized 
>         obsess_over_service             1       ; We should obsess over this
> service (if necessary)
>         check_freshness                 0       ; Default is to NOT check
> service 'freshness'
>         notifications_enabled           1       ; Service notifications are
> enabled
>         event_handler_enabled           1       ; Service event handler is
> enabled
>         flap_detection_enabled          1       ; Flap detection is enabled
>         process_perf_data               1       ; Process performance data
>         retain_status_information       1       ; Retain status information
> across program restarts
>         retain_nonstatus_information    1       ; Retain non-status
> information across program restarts
>         register                        0       ; TEMPLATE, DO NOT REGISTER!
>         }
> 
> I define utility2 as a valid machine with this template..  but I'm having
> some difficulty figuring out "how" to define this. (assuming the template I
> have above is even right)
> 
> define service{
>         use    generic-service-passive
> 
>         host_name   testserver1
>         service_description  check_remote_disk
>         is_volatile   0
>         check_period   24x7
>         max_check_attempts  3
>         normal_check_interval  5
>         retry_check_interval  1
>         contact_groups   aixadmin
>         notification_interval  120
>         notification_period  24x7
>         notification_options  w,u,c,r
>         check_command   check_disk  <--- what should this be?
>         }
> 
> [1108561237] Warning: Unrecognized external command ->
> PROCESS_HOST_CHECK_RESULT;utility2 check_remote_disk;1;DISK CRITICAL - free
> space: /usr 93 MB (5%);| /usr=1636MB;1209;1555;0;1728
> 
> I'm not sure what all I need to do here.
> 
> I've tried multiple ways to define the service including putting it into
> checkcommands.cfg and then redoing the entry : 
> define service{
>         use    generic-service-passive
> 
>         host_name   utility2
>         service_description  check_remote_disk
>         is_volatile   0
>         check_period   24x7
>         max_check_attempts  3
>         normal_check_interval  5
>         retry_check_interval  1
>         contact_groups   aixadmin
>         notification_interval  120
>         notification_period  24x7
>         notification_options  w,u,c,r
>         check_command   check_remote_disk
>         }
> 
> I've tried adding the check_remote_disk command to the checkcommands.cfg
> file as well...
> 
> # 'check_remote_disk' command definition
> define command{
>         command_name    check_remote_disk
>         command_line    $USER$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
>         }
> 
> I'm kind of puzzled as to how I make the nagios server process what is in
> that external commands file.. I know that its making it there and its
> getting inserted. The documentation says you have to define a service with
> it.. but it doesn't say very much on "how" to do that. I tried looking for
> some howto's on this subject, but none of them seem to address this. I tried
> to drop the whole "check_command" stanza but Nagios didn't like that at all.
> (I'm not sure why I would need to have it though since I already passed it
> the return code for critical... and all it needs to do is put it into
> nagios. In fact if I code this into an application, it is definately not
> going to have the "agent" on the master server to even corrolate with, so I
> shouldn't need anything in checkcommands.cfg.. by my thinking).
> 
> ... on another note...
> The send_nsca command lists 2 ways of sending checks : 
> 
> 	Service Checks:
> 	
> <host_name>[tab]<svc_description>[tab]<return_code>[tab]<plugin_output>[newl
> ine]
> 
> 	Host Checks:
> 	<host_name>[tab]<return_code>[tab]<plugin_output>[newline]
> 
> I'm not sure what the difference is... 
> 
> Any help/wisdom/howto info you could drop upon me would be much appreciated!
> 
> 
> -Spencer
> 
> 
> 
> ***********************************************************************
> This message, including any attachments, may contain
> confidential information intended for a specific individual
> and purpose, and may be protected by law.  If you are not
> the intended recipient, please notify the sender by e-mail
> or telephone immediately, and then immediately delete this
> message.  Any disclosure, copying or distribution of this
> message, or the taking of any action based on it, by any
> unintended recipient is strictly prohibited.
> 
> Checked by the Safelite e-mail scanner which may have
> resulted in the attachments being modified or removed.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer




More information about the Help mailing list