centreon-plugins icon indicating copy to clipboard operation
centreon-plugins copied to clipboard

[os::linux::local::plugin] try to guess interface speed in traffic mode

Open sebastien-prudhomme opened this issue 3 years ago • 2 comments

Hi,

An improvement for the traffic mode of os::linux::local::plugin: it would be better if it can detect the speed of network interfaces instead of using a static value provided as an argument.

On new kernels (at least the one of CentOS 6 for instance), it's available in /sys/class/net/<interface_name>/speed

/sys/class/net/<interface_name>/speed may be empty or "-1" for down interfaces.

sebastien-prudhomme avatar Jan 19 '22 10:01 sebastien-prudhomme

I use ip addr or ifconfig command. And the speed is not present.

garnier-quentin avatar Jan 19 '22 11:01 garnier-quentin

OSI layer 1 or 2 I think, not layer 3 as TCP/IP.

You can display it with ethtool for Ethernet interfaces or iwconfig for WIFI interfaces, as in this old plugin: https://github.com/Sysnove/shinken-plugins/blob/master/check_netint.pl

As I said you can get the value in /sys/class/net/<interface_name>/speed (https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net) for Ethernet devices

What:		/sys/class/net/<iface>/speed
Date:		October 2009
KernelVersion:	2.6.33
Contact:	[email protected]
Description:
		Indicates the interface latest or current speed value. Value is
		an integer representing the link speed in Mbits/sec.

		Note: this attribute is only valid for interfaces that implement
		the ethtool get_link_ksettings method (mostly Ethernet).

sebastien-prudhomme avatar Jan 19 '22 12:01 sebastien-prudhomme

https://github.com/centreon/centreon-plugins/pull/3941

New option --guess-speed

garnier-quentin avatar Sep 29 '22 13:09 garnier-quentin