Welcome to docs.opsview.com

Differences

This shows you the differences between two versions of the page.

opsview4.6:nsca [2014/09/09 12:19]
127.0.0.1 external edit
opsview4.6:nsca [2015/05/28 15:42] (current)
tvoon
Line 1: Line 1:
====== Using NSCA with Opsview ====== ====== Using NSCA with Opsview ======
-====Background====+NSCA (Nagios Service Check Acceptor) is a way of receiving results from an external system into Nagios.
-A distributed monitoring setup with an Opsview master and six slaves. These slaves are connected to the master with reverse SSH tunnels.+Opsview uses [[opsview4.6:nrd-architecture|NRD]] instead of NSCA for sending slave results back to the master. However, Opsview will run an instance of NSCA on the master and slaves to receive results. You will need to create passive checks in Opsview for the relevant hosts to receive results.
-====Requirement====+<note warning> 
 +We recommend that instead of using NSCA, you use Opsview's [[opsview4.6:restapi:status#set_service_status|REST API]] as it has authentication (instead of a shared secret), authorisation (check for access to put results for a given service) and validation (checking data is valid) of the results that you are sending. 
 +</note>
-It was requested that a particular host on one of the slave networks be able to submit passive alerts. 
-====Solution==== 
-This was achieved by running an instance of the Nagios nsca daemon on the slave and installing the nsca-client package on the host which would submit the passive alerts.+===== Running a Separate Instance of NSCA ===== 
 +It is possible to run a different instance of NSCA on the master or slave so that host and service results can be proxied in. Note that you still need to configure the host in Opsview for it to be listed in status views.
-===Daemon===+You can also setup a [[opsview4.6:monitoringserver#passive|passive slave]].
-Because the slaves are already listening on the standard nsca port 5667 - which allows them to submit information to the master down the SSH tunnel - an instance was started on port 5668. The port is defined in a configuration file which is referenced when starting the daemon.+The rest of this section describes how you can configure a single host to forward results to Opsview. 
 + 
 +==== Setup a Separate NSCA Daemon ==== 
 +Opsview's NSCA will listen on the standard nsca port 5667, so you will need to configure a separate port - will use 5668. The port is defined in a configuration file which is referenced when starting the daemon.
An example configuration can be seen below: An example configuration can be seen below:
Line 29: Line 33:
append_to_file=0 append_to_file=0
max_packet_age=30 max_packet_age=30
-password=changeme+password=changeme  # You'll need to change based on the actual password value
decryption_method=2 decryption_method=2
</code> </code>
Line 37: Line 41:
<code>/usr/local/nagios/etc/nsca.cfg</code> <code>/usr/local/nagios/etc/nsca.cfg</code>
-**N.B.** You should not reference this particular file as it is actually the one from the master and will be overwritten upon an Opsview reload. So make a copy elsewhere and reference that.+Copy this file to a different location, eg: ''/etc/nagios/nsca.cfg''.
The nsca binary itself should also be on the slave - as provided by the master - so an example command to run the daemon might be: The nsca binary itself should also be on the slave - as provided by the master - so an example command to run the daemon might be:
Line 45: Line 49:
</code> </code>
-You can pass the --help flag to see the options available to you. +==== Client ====
- +
-===Client=== +
The send_nsca binary and associated config file was installed on the host where passive alerts were to be sent from. In this particular instance they were installed from an RPM package named **nsca-client** but you may be able to use the existing files from the slave. If not then they should be available as source from the nagios addons website within the NSCA tarball. The send_nsca binary and associated config file was installed on the host where passive alerts were to be sent from. In this particular instance they were installed from an RPM package named **nsca-client** but you may be able to use the existing files from the slave. If not then they should be available as source from the nagios addons website within the NSCA tarball.
[[http://www.nagios.org/download/addons/|http://www.nagios.org/download/addons/]] [[http://www.nagios.org/download/addons/|http://www.nagios.org/download/addons/]]
-The config file is commented with the options available but in this instance just two lines were required **that should match those in the config of the nsca daemon:**+The config file is commented with the options available but in this instance just two lines were required **that should match those in the config of the nsca daemon**:
<code> <code>
Line 60: Line 61:
</code> </code>
-===Sending Passive Alerts===+==== Sending Passive Alerts ====
By passing the --help flag to send_nsca you can see the options available to you but a simple example is shown below: By passing the --help flag to send_nsca you can see the options available to you but a simple example is shown below:
Line 74: Line 75:
</code> </code>
-So you are sending a tab delimited string with a newline character to stdin of the send_nsca binary. The arguments passed to the send_nsca binary are the IP address of the server running the nsca daemon, the port that daemon is running on and the local configuration file.+This sends a tab delimited string with a newline character to stdin of the send_nsca binary. The arguments passed to the send_nsca binary are the IP address of the server running the nsca daemon, the port that daemon is running on and the local configuration file.
On the host running the nsca daemon you should now see in the nagios log something similar to the following: On the host running the nsca daemon you should now see in the nagios log something similar to the following:
Line 80: Line 81:
<code> <code>
[user@uk00servername00 ]# tail -f /usr/local/nagios/var/nagios.log [user@uk00servername00 ]# tail -f /usr/local/nagios/var/nagios.log
- 
[1295891511] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;uk00hostname00;passive test;2;CRITICAL [1295891511] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;uk00hostname00;passive test;2;CRITICAL
[1295891512] PASSIVE SERVICE CHECK: uk00hostname00;passive test;2;CRITICAL [1295891512] PASSIVE SERVICE CHECK: uk00hostname00;passive test;2;CRITICAL
Line 87: Line 87:
</code> </code>
-**N.B. This requires that you have defined the passive service check and associated it with the respective host.**+**Note:** This requires that you have defined the passive service check and associated it with the respective host.
-Document contributed by Andrew Hall on 2011/02/04 16:44+Thanks to Andrew Hall for contributions to this document.
Navigation
Print/export
Toolbox