Open obeleh opened 6 years ago
Depends what you mean.
Both list_network_interfaces
and list_hardware
have a "speed" field corresponding to the link speed.
The list_hardware
speed is "live," meaning it shows the actual interface speed right now. This is the value of "Link" when you hover over an ethernet port in the GUI's health graphic. The list_network_interfaces
speed is the speed configured on the port.
Here's an example of how the two can differ:
ct0.eth0
list_network_interfaces speed: 1.00 Gb/s
list_hardware speed: 1.00 Gb/s
ct0.eth1
list_network_interfaces speed: 1.00 Gb/s
list_hardware speed: 0.00 b/s <-- nothing is plugged into this port
ct0.eth8
list_network_interfaces speed: 10.00 Gb/s
list_hardware speed: 10.00 Gb/s
ct0.eth9
list_network_interfaces speed: 10.00 Gb/s
list_hardware speed: 10.00 Gb/s
ct1.eth0
list_network_interfaces speed: 1.00 Gb/s
list_hardware speed: 1.00 Gb/s
ct1.eth1
list_network_interfaces speed: 1.00 Gb/s
list_hardware speed: 0.00 b/s
ct1.eth2
list_network_interfaces speed: 10.00 Gb/s
list_hardware speed: 10.00 Gb/s
ct1.eth3
list_network_interfaces speed: 10.00 Gb/s
list_hardware speed: 10.00 Gb/s
ct1.eth8
list_network_interfaces speed: 10.00 Gb/s
list_hardware speed: 10.00 Gb/s
ct1.eth9
list_network_interfaces speed: 10.00 Gb/s
list_hardware speed: 10.00 Gb/s
Source:
import purestorage
array = purestorage.FlashArray("dogfood-snausage", "miranda", "****")
network_ifaces = array.list_network_interfaces()
hardware_ifaces = array.list_hardware()
network_speed_val_to_suffix = {
1: 'b/s',
pow(10, 3) : 'Kb/s',
pow(10, 6) : 'Mb/s',
pow(10, 9) : 'Gb/s'
}
def display_speed(val):
suffix = network_speed_val_to_suffix[1]
for multiplier in reversed(sorted(network_speed_val_to_suffix.keys())):
if val >= multiplier:
suffix = network_speed_val_to_suffix[multiplier]
val = float(val) / multiplier
return '%.2f %s' % (val, suffix)
return '%.2f %s' % (val, suffix)
for network_iface in network_ifaces:
for hardware_iface in hardware_ifaces:
if network_iface["name"] == hardware_iface["name"].lower():
print("{}".format(network_iface["name"]))
print("\t list_network_interfaces speed: {}".format(display_speed(network_iface["speed"])))
print("\t list_hardware speed: {}".format( display_speed(hardware_iface["speed"]) ))
Hope that helps... Anything more than that (latencies, read/write stats) do not exist in the API right now.
Thanks for your answer. I was really looking for throughput and latency. The speeds, I've already found those.
Where / how can I get the network interface throughput and latencies?