From OpenNMS
Contents |
Topic
This example describes how you can collect Win perf-data with OpenNMS and NSClient++.
The gathered data can be displayed in a graphical report with OpenNMS.
Product Versions
Author: Mschneider
Works with
OpenNMS/Revision: 9432
NSClient++/Version: 0.3.2
Download NSClient++
Last Update: 2008-06-23 20:11:00/Mschneider
OpenNMS Configuration
capsd-configuration.xml
Make the following entry in OpenNMS capsd-configuration.xml to discover the service. In current releases this configuration is already done and shipped by default.
<protocol-plugin protocol="NSClientpp"
class-name="org.opennms.netmgt.capsd.plugins.NsclientPlugin" scan="on"
user-defined="false">
<property key="banner" value="*" />
<property key="port" value="12489" />
<property key="timeout" value="3000" />
<property key="retry" value="1" />
</protocol-plugin>
poller-configuration.xml
Define the Service in the OpenNMS poller-configuration.xml (shipped by default in current releases)
<service name="NSClientpp" interval="300000" user-defined="false" status="on">
<parameter key="retry" value="2"/>
<parameter key="port" value="12489"/>
<parameter key="timeout" value="3000"/>
</service>
nsclient-config.xml
In the nsclient-config.xml you have to define on which port NSClient++ can be
polled by OpenNMS.
NSClient++ is using "12489" as the default port.
<?xml version="1.0"?>
<nsclient-config port="12489" retry="3" timeout="3000">
</nsclient-config>
collectd-configuration.xml
In the collectd-configuration we have to define a further package of the name "example2" which contains the filter and service definition. The ip-address in the 'specific' tag is the Win host where NSClient++ is running.
<?xml version="1.0"?>
<?castor class-name="org.opennms.netmgt.collectd.CollectdConfiguration"?>
<collectd-configuration
threads="50">
<package name="example1">
<filter>IPADDR != '0.0.0.0'</filter>
<include-range begin="1.1.1.1" end="254.254.254.254"/>
<service name="SNMP" interval="300000" user-defined="false" status="on">
<parameter key="collection" value="default"/>
</service>
</package>
<package name="example2">
<filter>IPADDR IPLIKE *.*.*.*</filter>
<specific>192.168.71.111</specific>
<service name="NSClientpp" interval="150000" user-defined="false" status="on">
<parameter key="nsclient-collection" value="default"/>
<parameter key="port" value="12489"/>
<parameter key="retry" value="3"/>
<parameter key="timeout" value="3000"/>
</service>
</package>
<collector service="SNMP" class-name="org.opennms.netmgt.collectd.SnmpCollector"/>
<collector service="NSClientpp" class-name="org.opennms.netmgt.collectd.NSClientCollector"/>
</collectd-configuration>
nsclient-datacollection-config.xml
In this example we want to collect data from the performance counter "\LogicalDisk(C:)\% Free Space" on the Win host where NSClient++ is running.
<?xml version="1.0"?>
<nsclient-datacollection-config rrdRepository="/opt/opennms/share/rrd/snmp/">
<nsclient-collection name="default">
<rrd step="300">
<rra>RRA:AVERAGE:0.5:1:8928</rra>
<rra>RRA:AVERAGE:0.5:12:8784</rra>
<rra>RRA:MIN:0.5:12:8784</rra>
<rra>RRA:MAX:0.5:12:8784</rra>
</rrd>
<wpms>
<!-- A group for collecting processor stats.
Check the keyvalue "\LogicalDisk(C:)\% Free Space"
Check every recheckInterval milliseconds (300000 = 1hr) -->
<wpm name="LDCFreeSpace" keyvalue="\LogicalDisk(C:)\% Free Space" recheckInterval="300000">
<!-- Collect these attributes. Name is the name to pass to NSClient.
Alias is the local name for the RRD file
Type is used to convert values around
maxval/minval are optional-->
<attrib name="\LogicalDisk(C:)\% Free Space" alias="LD_C_FreeSpace" type="Gauge"/>
</wpm>
</wpms>
</nsclient-collection>
</nsclient-datacollection-config>
NSClient++ Configuration
You can list all perf-counters you can collect data from with the following command:
C:\> NSClient++ CheckSystem listpdh
[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
; You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; * *
; * N O T I C E ! ! ! - Y O U H A V E T O E D I T T H I S *
; * *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
;
; CheckWMI IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;CheckWMI.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;RemoteConfiguration.dll
[Settings]
;# OBFUSCATED PASSWORD
; This is the same as the password option but here you can store the password in an obfuscated manner.
; *NOTICE* obfuscation is *NOT* the same as encryption, someone with access to this file can still figure out the
; password. Its just a bit harder to do it at first glance.
;obfuscated_password=Jw0KAUUdXlAAUwASDAAB
;
;# PASSWORD
; This is the password (-s) that is required to access NSClient remotely. If you leave this blank everyone will be able to access the daemon remotly.
password=
;
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons.
; If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password).
; The syntax is host or ip/mask so 192.168.0.0/24 will allow anyone on that subnet access
allowed_hosts=192.168.0.0/24
;
;# USE THIS FILE
; Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1
; the registry will be used instead.
use_file=1
[log]
;# LOG DEBUG
; Set to 1 if you want debug message printed in the log file (debug messages are always printed to stdout when run with -test)
debug=1
;
;# LOG FILE
; The file to print log statements to
file=NSC.log
;
;# LOG DATE MASK
; The format to for the date/time part of the log entry written to file.
date_mask=%Y-%m-%d %H:%M:%S
[NSClient]
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to NSClient deamon.
; If you leave this blank the global version will be used instead.
allowed_hosts=192.168.71.21
;
;# NSCLIENT PORT NUMBER
; This is the port the NSClientListener.dll will listen to.
;port=12489
port=12489
;
;# BIND TO ADDRESS
; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
; Leaving this blank will bind to all avalible IP adresses.
bind_to_address=192.168.71.111
[Check System]
;# CPU BUFFER SIZE
; Can be anything ranging from 1s (for 1 second) to 10w for 10 weeks. Notice that a larger buffer will waste memory
; so don't use a larger buffer then you need (ie. the longest check you do +1).
CPUBufferSize=1h
;
;# CHECK RESOLUTION
; The resolution to check values (currently only CPU).
; The value is entered in 1/10:th of a second and the default is 10 (which means ones every second)
CheckResolution=10
;# CHECK SystemTotalProcessorTime
;SystemTotalProcessorTime=\Processor(_total)\% Processor Time
[NRPE]
;# NRPE PORT NUMBER
; This is the port the NRPEListener.dll will listen to.
;port=5666
;
;# COMMAND TIMEOUT
; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off.
;command_timeout=60
;
;# COMMAND ARGUMENT PROCESSING
; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.
;allow_arguments=0
;
;# COMMAND ALLOW NASTY META CHARS
; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
;allow_nasty_meta_chars=0
;
;# USE SSL SOCKET
; This option controls if SSL should be used on the socket.
;use_ssl=1
;
;# BIND TO ADDRESS
; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
; Leaving this blank will bind to all avalible IP adresses.
; bind_to_address=
;
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to NRPE deamon.
; If you leave this blank the global version will be used instead.
;allowed_hosts=
;
;# SCRIPT DIRECTORY
; All files in this directory will become check commands.
; *WARNING* This is undoubtedly dangerous so use with care!
;script_dir=scripts\
[NRPE Handlers]
;# COMMAND DEFINITIONS
;# Command definitions that this daemon will run.
;# Can be either NRPE syntax:
;command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
;# Or simplified syntax:
;test=c:\test.bat foo $ARG1$ bar
;check_disk1=/usr/local/nagios/libexec/check_disk -w 5 -c 10
;# Or even loopback (inject) syntax (to run internal commands)
;# This is a way to run "NSClient" commands and other internal module commands such as check eventlog etc.
;check_cpu=inject checkCPU warn=80 crit=90 5 10 15
;check_eventlog=inject CheckEventLog Application warn.require.eventType=error warn.require.eventType=warning critical.require.eventType=error critical.exclude.eventType=info truncate=1024 descriptions
;check_disk_c=inject CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M File:WIN=c:\ATI\*.*
;# But be careful:
; dont_check=inject dont_check This will "loop forever" so be careful with the inject command...
;# Check some escapings...
; check_escape=inject CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M "File: foo \" WIN=c:\\WINDOWS\\*.*"
;# Some real world samples
;nrpe_cpu=inject checkCPU warn=80 crit=90 5 10 15
;nrpe_ok=scripts\ok.bat
OpenNMS Report Creation
1. Choose "Reports" from the main menu
2. Choose the Win host where NSClient++ is running from the section "Custom Resource/Performance Reports"






