- Nagios Network Monitoring
- General Information and TidBits
- Installation Tips & Tricks
- Addons, Plugins, Tweaks & Customizations
- Checking Drupal Status with Nagios and WebInject
- AddOn - NRPE / NSClient
- AddOn - Nagios Event Log aka NagEventLog
- Addon - Nagios Passive Checks with NSCA
- Nagios Custom Object Variables
- Nagios Event Handler - Restart Remote Service
- Nagios Event Handler - Restarting a Local Service
- Plugin: check_dns_secondary - Checking NS Servers
- Plugin: check_http_requisites - Page Size, Files, and Loadtime
- Plugin: check_mem - Linux Memory Usage
- Plugin: check_sql - Check MSSQL and MYSQL servers
- Plugin: check_svn - Check Subversion
- Tweak - Nagios Jabber / XMPP Notifications
- Tweak - Nagios SMS Messaging
- Tweak - check_file_age to check_file_modified
- Tweak: Using NagiosGraph's SHOW.CGI
- Tweak: check_sql - Allow decimal values
- Common Errors & Fixes
Addon - Nagios Passive Checks with NSCA
Using Nagios with NSCA, you can configure some complex scripts / tasks to output status codes and messages to be sent to your Nagios server for collection / reporting. To start, you will need to install NSCA package on your Nagios server and configure the listening server as outlined in the documenation.
NOTE: You will need libmcrypt and libmcrypt-devel packages installed to compile successfully.
You will most likely want to create a template or two to use with your passive checks. Below is the example template I created for testing passive checks...
define service{
name passive-service
use generic-service
check_freshness 1
passive_checks_enabled 1
active_checks_enabled 0
is_volatile 0
flap_detection_enabled 0
notification_options w,u,c,s
freshness_threshold 57600 ;12hr
}
Then configure a service like so...
define service{
use passive-service
host_name localhost
service_description test
check_command check_dummy!3!"No Data Received"
}
On the remote server, you will need to do the same to compile the components. You will only need the send_nsca binary and the send_nsca.cfg file. You will need to tweak your send_nsca config file to match the information you configured on your NSCA server.
Now the fun begins where you can create/modify scripts to send these passive check results to Nagios via the NSCA server. I used a simple perl script below for my testing.
#!/usr/bin/perl
#############################################################
# RETURN CODES:
# 0-OK, 1-WARNING, 2-CRITICAL, 3-UNKNOWN
#############################################################
#CONFIG FILES
#$debug=1;
$config="/usr/local/nagios/etc/send_nsca.cfg";
# LOCAL SYSTEM CONFIG OPTIONS
$nsca_host="nagios.hubteam.com";
$host="host_name";
$service="service_name";
# DEFAULT RETURNS
$code=3;
$result="WHAT THE HECK?";
# COMMAND LINE
$send_nsca="/usr/local/nagios/bin/send_nsca -c $config -H $nsca_host";
# Start
# INSERT YOUR FUN CODE HERE, Setting a $code and $result value
# End
if ($debug) {print "SENDING: $host\t$service\t$code\t$result\n";}
open(SEND,"|$send_nsca") || die "Could not run $send_nsca: $!\n";
print SEND "$host\t$service\t$code\t$result\n";
close SEND;
There are several points to consider.
- If the script takes < 10 seconds, you may also consider running checks via NRPE and custom command defintions.
- You can have multiple checks report passive checks back to the SAME host/service combo. Eg, running various nightly jobs and direct any errors go to a single "nightly-jobs" monitor.
- Read the Nagios documenation on passive checks and freshness.
- MWalker's blog
- Printer-friendly version
- Login or register to post comments
-

Recent comments
7 weeks 3 days ago
24 weeks 6 days ago
28 weeks 5 hours ago
37 weeks 6 days ago
45 weeks 2 days ago
45 weeks 4 days ago
50 weeks 1 day ago
1 year 1 week ago