Header
 
» Nagios Plugins

Nagios Plugin: check_win_net_usage (Windows Network Usage)

Last Update: January 26, 2012

This plugin uses check_nt, which is part of the official Nagios plugin collection. However with check_nt you only get to check one value (e.g. Bytes sent/s), if one wants to create graphics with Bytes_in and Bytes_out, there is need to bundle two checks in one. This is where this plugin plays its part. It launches two check_nt checks (one for Bytes sent/s and one for Bytes received/s) and bundles both checks to one common output.

Download check_win_net_usage.sh check_win_net_usage.sh
Download plugin and save it in your Nagios plugin folder (e.g. /usr/local/nagios/libexec)
155 downloads so far...

Version History
20111116 First version released
20120126 Bugfix in port check

Requirements
1) check_nt plugin
2) Set variable 'pluginlocation' at the begin of the plugin to your Nagios plugins path (e.g. /usr/local/nagios/libexec)

------------------------

Usage

On the command line as nagios user:

/usr/local/nagios/libexec # ./check_win_net_usage.sh -H gce4.fsp.ch -p 12489 -i "VMware Accelerated AMD PCNet Adapter" -o KB
Network OK - 14 Bytes Received/sec, 4 Bytes Sent/sec|bytes_in=14608;bytes_out=4196

------------------------

Definition of the parameters

-H Hostname of Windows server to check
-p Listening port of NSClient++ on target server (default 12489)
-s Password in case NSClient++ was defined to use a password
-i Name of network interface to use (not ethX, check Windows performance GUI)
-o Choose output of value in KB, MB (default Byte)
--help Help text

------------------------

Command definition in your commands.cfg:

# check_win_net_usage - Output in Bytes/s
define command {
command_name check_win_net_usage
command_line $USER1$/check_win_net_usage.sh -H $HOSTADDRESS$ -i $ARG1$ $ARG2$
}

# check_win_net_usage - Output in KBytes/s
define command {
command_name check_win_net_usage
command_line $USER1$/check_win_net_usage.sh -H $HOSTADDRESS$ -i $ARG1$ -o KB $ARG2$
}

------------------------

Service checks:

# Check Windows Network
define service{
use generic-service
host_name windows1
service_description Network Usage
check_command check_win_net_usage!"VMware Accelerated AMD PCNet Adapter"
}

In this example, we use all default settings. The name of the interface to check is "VMware Accelerated AMD PCNet Adapter".

# Check Windows Network
define service{
use generic-service
host_name windows1
service_description Network Usage
check_command check_win_net_usage!"VMware Accelerated AMD PCNet Adapter"!-p 1248
}

In this second example, NSClient++ is listening on port 1248. Default is 12489.

# Check Windows Network
define service{
use generic-service
host_name windows1
service_description Network Usage
check_command check_win_net_usage!"VMware Accelerated AMD PCNet Adapter"!-p 1248 -s passw -o MB
}

Here, NSClient++ listens to port 1248 and requires the password 'passw' to allow remote checks. Furthermore we want the output in MBytes/s instead of Bytes/s.

------------------------

Nagiosgraph map entry:

# Service Type: check_win_net_usage
# Regex by Claudio Kuenzler
# Nagios Output: Network OK - 9 KBytes received/sec, 0 KBytes sent/sec
# Perfdata: bytes_in=9988;bytes_out=367
/perfdata:bytes_in=(\d+);bytes_out=(\d+)/
and push @s, [nt_net,
['in_Bps', GAUGE, $1 ],
['out_Bps', GAUGE, $2 ] ];

------------------------

How to find the correct name of the network interface:

From the documentation of NSClient++ (CheckCounter):

Q: How do you list all instances of a counter?
A: Use the listCounterInstances command e.g. check_nrpe -c listCounterInstances -a "Network Interface"

Or check manually in Windows by using the 'Performance' application GUI.

------------------------

Nagiosgraph screenshot:


Go to Homepage home RSS Feed
About ck about
Linux Howtos how to's
Nagios Plugins nagios plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

9376 Days
until Death of Computers
Why?