- 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
Nagios Custom Object Variables
In large Nagios environments, configuring everything at the host level can be cumbesome. Nagios has nice grouping / templating features that make deploying checks alot faster as well as easier to manager. Sometimes you may need to "customize" the check to the specific host. For example, specify the databasename on the indivudal database server to query. This is where Nagios "Custom Object Variables" come into play.
As always, you can find some very useful information in the Nagios documentation.
In my case, we will start with defining the custom object variable on the host object by adding a like in the "define host {" block like so:
define host{
use server-template
host_name dbserver1
alias DB Server 1
address dbserver1.domain.local
_DATABASE1 DB01
}
I have a hostgroup definition for "Database Servers" and a list of common checks for each database server. You can see how I have my Nagios check configured to use the local variable in the hostgroup definition....
define hostgroup{
hostgroup_name database-servers
alias Database Servers
members dbserver1,dbserver2,dbserver3
}
define service{
use template
hostgroup_name database-servers
service_description database-test
check_command check_mssql!username!password!-p 1433 -D \
$_HOSTDATABASE1$ -w 3 -c 5 -q "exec \
$_HOSTDATABASE1$.dbo.sp_test" -s -W 10 -C 20
}
Note that the backslashes are only for readability here, and the check is a single line in my definition.
Remeber when using the custom variables, they always start with the underscore and then prefixed with the type of variable... HOST, SERVICE, CONTACT, etc.
- MWalker's blog
- Printer-friendly version
- Login or register to post comments
-

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