Nagios: howto become a happy network and system monitoring engineer

Nagios: howto become a happy network and system monitoring engineer

Nagios: howto become a happy network and system monitoring engineer 150 150 Roderick Derks

 

Check Windows nodes by executing remote scripts

There is more than one way to get there. There is the pNSClient.exe you can use. I used NRPE_NT.exe. On the Windows host this service will be installed. The scripts to get the info from the host that I used are chkwin_cputime.wsf and check_disk.wsf. You can get them from nagiosexchange.org.

This is the config file for the NRPE_NT service on the Windows host:

#############################################################################
# Sample NRPE Config File
#
# NOTES:
# This is a sample configuration file for the NRPE_NT service. It needs to be
# located on the remote host that is running the NRPE_NT service, not the host
# from which the check_nrpe client is being executed.
#############################################################################

# PORT NUMBER
# Port number we should wait for connections on.

server_port=5666

# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.

#server_address=192.168.1.1

# ALLOWED HOST ADDRESSES
# This is a comma-delimited list of IP address of hosts that are allowed
# to talk to the NRPE daemon.
#
# NOTE: The daemon only does rudimentary checking of the client’s IP
# address.

#allowed_hosts=10.10.9.100,10.10.9.101,192.168.1.100
allowed_hosts=10.0.2.16

# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE_NT service will allow clients
# to specify arguments to commands that are executed
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
#
# Values: 0=do not allow arguments, 1=allow command arguments

dont_blame_nrpe=0

# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# eventlog.
# Values: 0=debugging off, 1=debugging on

debug=1

# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE_NT service will
# allow plugins to finish executing before killing them off.

command_timeout=30

# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.

#include=<somefile.cfg>

# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).
#NOTE: This option is currently ignored with NRPE_NT!
#include_dir=<somedirectory>
#include_dir=<someotherdirectory>

# LOGLEVEL / NRPE_NT only
# severity of events logged to nrpe_nt.log if debug = 1
# Useful Values:
# 1: Log Critical
# 4: Log Errors (Default)
# 6: Log Informational
# 7: Log Debug
loglevel=4

# USE_WIN_METACHARS / NRPE_NT only
# use NASTY_METACHARS_WIN, allow \ and ” to allow easier passing of
# pathnames as parameter
# Values: 0=use default NASTY_METACHARS definition, 1=use relaxed NASTY_METACHARS_WIN definition
use_win_metachars=1

# RRD: my commands

# The values for options c and w indicate the free space that is left
# this command uses the return value to determine the status: 0 OK, 1 warning, 2 critical
# Execute on the Nagios server:
# # /usr/lib/nagios/plugins/check_nrpe -H rainier.r71.nl -p 5666 -c check_disk_c
# # echo $?
command[check_disk_c]=C:\WINDOWS\system32\cscript.exe //NoLogo //T:10 “C:\Program Files\nrpe_nt\bin\check_disk.wsf” /drive:”c:\” /w:10% /c:5%

# The values for options c and w indicate the cpu utilization maximum thresholds
# This command uses the return value to determine the status: 0 OK, 1 warning, 2 critical
# Execute on the Nagios server:
# # /usr/lib/nagios/plugins/check_nrpe -H rainier.r71.nl -p 5666 -c check_cputime
# # echo $?
command[check_cputime]=C:\WINDOWS\system32\cscript.exe //NoLogo //T:30 “C:\Program Files\nrpe_nt\bin\chkwin_cputime.wsf” /w:60 /c:90

Go to the Nagios server and edit the config files:

# vi /etc/nagios/r71_commands.cfg

# ‘check_nrpe’ command defenition to check windows hosts
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c $ARG1$
}

 

# vi /etc/nagios/r71_services.cfg

define service {
name check-nrpe-disk-util
service_description DISK UTIL
use basic-service
notification_interval 60
contact_groups r71
notification_options c,w,r
notification_period 24×7
check_command check_nrpe!check_disk_c
register 0
}

define service{
use check-nrpe-disk-util
hostgroup_name windows-servers
}

define service {
name check-nrpe-cpu-util
service_description CPU UTIL
use basic-service
notification_interval 60
contact_groups r71
notification_options c,w,r
notification_period 24×7
check_command check_nrpe!check_cputime
register 0
}

define service{
use check-nrpe-cpu-util
hostgroup_name windows-servers
}

 

 

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message