Page 1 of 1

help monitoring linux bandwidth

Posted: Fri May 27, 2016 6:02 pm
by spyder13337
so this seem to be rather simple so i assume i forgetting something or overlook something

i need to monitor the bandwidth of serval linux machine i found this plugin at the Exchange called "check_traffic_limit"

seem to be correct i also need to install vnstat which is a program required by the plugin to function correcly so i copy the plugin and istall the necciary software for it to work

so i run this command

./check_traffic_limit -w 500 -c 600

and get this output

TRAFFICLIMIT CRITICAL - em2: 1556.48 MB | TOTAL=1556.48;500;600 IN=669.04;500;600 OUT=891.54;500;600 (i need to adjust the warn and crit but that latter)

here is the part missing something

on my server (nagios machine)

/usr/local/nagios/libexec/check_traffic_limit

nrpe.cfg

command[check_traffic_limit]=/usr/local/nagios/libexec/check_traffic_limit -w 500 -c 600

service.cfg

define service{
use generic-service,srv-pnp
service_description Local Bandwidth
check_command check_nrpe!check_traffic_limit -w 500 -c 600
max_check_attempts 3
check_interval 5
retry_interval 1
check_period workhours
hostgroups FreeSWITCH Servers,Ten Count Servers,Telefonetica UNidial,Elastix PBX,UNidial Servers,My Sequel,Monitoring,Celerity Servers,MY Dialer,LCR,Kamailo,Kazoo,PBX,Available,Yare Unidial,LATA Connect
contacts nagiosadmin
}

on my remote machine (machine i am trying to monitor)

/usr/local/nagios/libexec/check_traffic_limit

nrpe.cfg

command[check_traffic_limit]=/usr/local/nagios/libexec/check_traffic_limit -w 500 -c 600


output or nrpe

(No output returned from plugin)
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
\nUsage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
\nOptions:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
<bindaddr> = bind to local address
-4 = user ipv4 only
-6 = user ipv6 only
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
\nNote:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.

Re: help monitoring linux bandwidth

Posted: Mon May 30, 2016 2:35 am
by Box293
spyder13337 wrote:on my server (nagios machine)

/usr/local/nagios/libexec/check_traffic_limit

nrpe.cfg

command[check_traffic_limit]=/usr/local/nagios/libexec/check_traffic_limit -w 500 -c 600

service.cfg

define service{
use generic-service,srv-pnp
service_description Local Bandwidth
check_command check_nrpe!check_traffic_limit -w 500 -c 600
max_check_attempts 3
check_interval 5
retry_interval 1
check_period workhours
hostgroups FreeSWITCH Servers,Ten Count Servers,Telefonetica UNidial,Elastix PBX,UNidial Servers,My Sequel,Monitoring,Celerity Servers,MY Dialer,LCR,Kamailo,Kazoo,PBX,Available,Yare Unidial,LATA Connect
contacts nagiosadmin
}
You've hard coded the warning and critical in the command itself, so don't make it part of the service:

check_command check_nrpe!check_traffic_limit

HOWEVER I suspect that the NRPE command defintion has -a and no arguments are being provided. This is because of this:

check_command check_nrpe!check_traffic_limit -w 500 -c 600

You have not separated the thresholds from the check being performed. What's probably being executed is:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H xxxx -c check_traffic_limit -w 500 -c 600 -a
Instead of:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H xxxx -c check_traffic_limit -a -w 500 -c 600
The ! separates the arguments

check_command check_nrpe!check_traffic_limit!-w 500 -c 600

I suggest the following:
Service Definition:

Code: Select all

check_command check_nrpe!check_traffic_limit!500!600
NRPE Client Definition:

Code: Select all

command[check_traffic_limit]=/usr/local/nagios/libexec/check_traffic_limit -w $ARG1$ -c $ARG2$