Bandwidth monitoring
-
nottheadmin
- Posts: 53
- Joined: Thu Dec 19, 2013 9:51 am
- Location: Amsterdam, NL
Re: Bandwidth monitoring
Appreciate the help, when do you think sreinhardt will be able to look at this, just so i know when to plan for it?
Thanks
M
Thanks
M
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Bandwidth monitoring
I was planning on it yesterday, but had a few things come up. Hopefully I can have it done by mid afternoon for you!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Bandwidth monitoring
OK, so here is what works for me, see if this suites your needs.
Use this to get your interface names:
Then run this to test the interface initially, and configure warning and critical values as needed:
If I wanted to warn on bytes sent per second, I would use the command (notice the removal of --nokeepstate):
This is all of the help the plugin provides on additional parameters and warning/critical values to check.
Use this to get your interface names:
Code: Select all
./check_wmi_plus.pl -H 192.168.5.xxx -u [domain/user] -p [password] --nokeepstate -m checknetworkCode: Select all
./check_wmi_plus.pl -H 192.168.5.xxx -u [domain/user] -p [password] --nokeepstate -m checknetwork -a 'Intel[R] 82579LM Gigabit Network Connection'Code: Select all
./check_wmi_plus.pl -H 192.168.5.xxx -u [domain/user] -p [password] -m checknetwork -a 'Intel[R] 82579LM Gigabit Network Connection' -w _BytesSentPersec=200Code: Select all
checknetwork
These network checks use WMI Raw counters to calculate values over a given timeperiod.
This is much more accurate than taking Formatted WMI values.
ARG1 Specify with network adapter the stats are collected for.
The name of the network adaptors as seen from WMI are similar to what is seen in the output of the
ipconfig/all command on Windows. However, its not exactly the same. Run without -a to list the adapter
names according to WMI. Typically you need to use '' around the adapter name when specifying.
eg -a 'Intel[R] PRO_1000 T Server Adapter _2 - Packet Scheduler Miniport'
DELAY (optional) specifies the number of seconds over which the utilisation is calculated. The longer you can make this without timing out, the more accurate it will be. If specifying longer values. You may also need to use the -t parameter to set a longer script timeout. Only valid if also specifying --nokeepstate ie you are not using the state keeping feature. We recommend that you do keep state and hence do not use --nokeepstate.
WARN/CRIT can be used as described below.
Valid Warning/Critical Fields are: CurrentBandwidth (Default), _PacketsSentPersec, _PacketsReceivedPersec, OutputQueueLength, PacketsReceivedErrors, _BytesSentPersec, _BytesReceivedPersec
BYTEFACTOR defaults to 1000 for this mode. You can override this if you wish.Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
nottheadmin
- Posts: 53
- Joined: Thu Dec 19, 2013 9:51 am
- Location: Amsterdam, NL
Re: Bandwidth monitoring
Thanks Spenser, I had a play with this. My goal is to log bandwidth use so that at the end of the month, I can see how much bandwidth we used.
I can list the adapters
ok,
I'm getting this with a few different hosts.
Any ideas?
Perhaps WMI is not the best way to do this, it seems plagued with unhelpful errors and timeouts
Thanks
Matt
I can list the adapters
Code: Select all
./check_wmi_plus.pl -H anotherhost-u domain/user -p password --nokeepstate -m checknetwork
Valid Adapter Names are:
HP Ethernet 1Gb 4-port 331FLR Adapter
HP Ethernet 1Gb 4-port 331FLR Adapter _2
HP Ethernet 1Gb 4-port 331FLR Adapter _3
HP Ethernet 1Gb 4-port 331FLR Adapter _4
Specify the -a parameter with an adapter name. Use ' ' around the adapter name.
For example: -a 'HP Ethernet 1Gb 4-port 331FLR Adapter'
Code: Select all
[root@localhost libexec]# ./check_wmi_plus.pl -H hostsname -u domain/user -p password --nokeepstate -m checknetwork -a 'HP Ethernet 1Gb 4-port 331FLR Adapter'
UNKNOWN - Plugin Timed out (15 sec)Any ideas?
Perhaps WMI is not the best way to do this, it seems plagued with unhelpful errors and timeouts
Thanks
Matt
Re: Bandwidth monitoring
Have you tried increasing the timeout?
Does this time out as well?
Code: Select all
./check_wmi_plus.pl -H hostsname -u domain/user -p password --nokeepstate -m checknetwork -a 'HP Ethernet 1Gb 4-port 331FLR Adapter' -t 180Be sure to check out our Knowledgebase for helpful articles and solutions!
-
nottheadmin
- Posts: 53
- Joined: Thu Dec 19, 2013 9:51 am
- Location: Amsterdam, NL
Re: Bandwidth monitoring
Ah ok, yes, now i get some results
Now what I want is to be able to produce graphs.
eg, bandwidth used in GB's over a period of time.
Also, to run this check, do I add it in manually into Service Management?, using the check command pulldown menu and adding the arguments?
Thanks for your help with this so far, it is appreciated.
Code: Select all
OK - Interface: HP NC373i Multifunction Gigabit Server Adapter (Speed:1.000Gbit/s Rate=4.642KB/sec, Byte Receive Rate=7.406KB/sec, Packet Send Rate=21.000packet/s Receive Rate=39.000packet/sec, Output Queue Length=0, Packets Received Errors=0|' ersec'=4642; '_BytesReceivedPersec'=7406; '_PacketsSentPersec'=21; '_PacketsRecei 39; 'OutputQueueLength'=0; 'PacketsReceivedErrors'=0;
eg, bandwidth used in GB's over a period of time.
Also, to run this check, do I add it in manually into Service Management?, using the check command pulldown menu and adding the arguments?
Thanks for your help with this so far, it is appreciated.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Bandwidth monitoring
Yes you would need to add the services\command arguments manually within CCM. Getting the overall usage is probably going to be more tricky though. You probably would want to write a wrapper script that combines the data over a period of time. Otherwise I would suggest looking into nagios network analyzer, as it is specifically geared towards this type of information.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
nottheadmin
- Posts: 53
- Joined: Thu Dec 19, 2013 9:51 am
- Location: Amsterdam, NL
Re: Bandwidth monitoring
Thanks Spenser.
A couple more questions if i may.
When adding this as a check in CCM>Services>Service Management, $ARG5$, in my case the -t 180 timeout, is not passed through.
Here is a screenshot of the config but with the passwords etc.. changed.

Second question, do you have a link for some info on wrapping in this into a script, an example maybe?
Thanks
M
A couple more questions if i may.
When adding this as a check in CCM>Services>Service Management, $ARG5$, in my case the -t 180 timeout, is not passed through.
Code: Select all
COMMAND: /usr/local/nagios/libexec/check_wmi_plus.pl -H hostname -u mydom.com/user -p password --nokeepstate -m checknetwork -a 'HP NC373i Multifunction Gigabit Server Adapter'
OUTPUT: UNKNOWN - Plugin Timed out (15 sec)
Second question, do you have a link for some info on wrapping in this into a script, an example maybe?
Thanks
M
Last edited by nottheadmin on Thu Mar 06, 2014 4:33 am, edited 1 time in total.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Bandwidth monitoring
To include $ARG5$ you will need to modify the command definition to include $ARG5$ and not stop at arg4. Alternatively, you can just append it to the end of arg4 and it should apply just the same.
Unfortunately I do no have any examples for this specifically. I think the route I would take is to write a shell script that accepts hostname\IP, interface name, and timeout. Then you can use those to call the plugin as normal but from the script. Once you get the results back of the current usage, you could add this amount to a file in /tmp or /var, etc, and continue to return this result to nagios for a cumulative bandwidth total. That is just an initial "outloud" thought process of how I would go about handling what you are looking to do.
Unfortunately I do no have any examples for this specifically. I think the route I would take is to write a shell script that accepts hostname\IP, interface name, and timeout. Then you can use those to call the plugin as normal but from the script. Once you get the results back of the current usage, you could add this amount to a file in /tmp or /var, etc, and continue to return this result to nagios for a cumulative bandwidth total. That is just an initial "outloud" thought process of how I would go about handling what you are looking to do.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
nottheadmin
- Posts: 53
- Joined: Thu Dec 19, 2013 9:51 am
- Location: Amsterdam, NL
Re: Bandwidth monitoring
understood, i'll add that to my list of things to do, if and when i get it working i'll post it back here in case in helps someone else.
new question just came up so will start a new thread for that.
new question just came up so will start a new thread for that.