Merge "Remove meter hardware.network.bandwidth.bytes"
This commit is contained in:
commit
dc1cd53ec0
@ -59,20 +59,19 @@ DiskStats = collections.namedtuple('DiskStats', ['size', 'used'])
|
||||
# name: the name of the interface
|
||||
# mac: the MAC of the interface
|
||||
# ip: the IP of the interface
|
||||
# speed: the speed of the interface (bytes/s)
|
||||
#
|
||||
Interface = collections.namedtuple('Interface', ['name', 'mac', 'ip'])
|
||||
Interface = collections.namedtuple('Interface', ['name', 'mac', 'ip', 'speed'])
|
||||
|
||||
|
||||
# Named tuple representing network interface statistics.
|
||||
#
|
||||
# bandwidth: current bandwidth (bytes/s)
|
||||
# rx_bytes: total number of octets received (bytes)
|
||||
# tx_bytes: total number of octets transmitted (bytes)
|
||||
# error: number of outbound packets not transmitted because of errors
|
||||
#
|
||||
InterfaceStats = collections.namedtuple(
|
||||
'InterfaceStats',
|
||||
['bandwidth', 'rx_bytes', 'tx_bytes', 'error'])
|
||||
InterfaceStats = collections.namedtuple('InterfaceStats',
|
||||
['rx_bytes', 'tx_bytes', 'error'])
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
|
@ -67,7 +67,7 @@ class SNMPInspector(base.Inspector):
|
||||
# Network Interface OIDs
|
||||
_interface_index_oid = "1.3.6.1.2.1.2.2.1.1"
|
||||
_interface_name_oid = "1.3.6.1.2.1.2.2.1.2"
|
||||
_interface_bandwidth_oid = "1.3.6.1.2.1.2.2.1.5"
|
||||
_interface_speed_oid = "1.3.6.1.2.1.2.2.1.5"
|
||||
_interface_mac_oid = "1.3.6.1.2.1.2.2.1.6"
|
||||
_interface_ip_oid = "1.3.6.1.2.1.4.20.1.2"
|
||||
_interface_received_oid = "1.3.6.1.2.1.2.2.1.10"
|
||||
@ -162,10 +162,10 @@ class SNMPInspector(base.Inspector):
|
||||
mac_oid = "%s.%s" % (self._interface_mac_oid,
|
||||
str(value))
|
||||
mac = self._get_value_from_oid(mac_oid, host)
|
||||
bw_oid = "%s.%s" % (self._interface_bandwidth_oid,
|
||||
str(value))
|
||||
speed_oid = "%s.%s" % (self._interface_speed_oid,
|
||||
str(value))
|
||||
# bits/s to byte/s
|
||||
bandwidth = self._get_value_from_oid(bw_oid, host) / 8
|
||||
speed = self._get_value_from_oid(speed_oid, host) / 8
|
||||
rx_oid = "%s.%s" % (self._interface_received_oid,
|
||||
str(value))
|
||||
rx_bytes = self._get_value_from_oid(rx_oid, host)
|
||||
@ -179,9 +179,9 @@ class SNMPInspector(base.Inspector):
|
||||
adapted_mac = mac.prettyPrint().replace('0x', '')
|
||||
interface = base.Interface(name=str(name),
|
||||
mac=adapted_mac,
|
||||
ip=str(ip))
|
||||
stats = base.InterfaceStats(bandwidth=int(bandwidth),
|
||||
rx_bytes=int(rx_bytes),
|
||||
ip=str(ip),
|
||||
speed=int(speed))
|
||||
stats = base.InterfaceStats(rx_bytes=int(rx_bytes),
|
||||
tx_bytes=int(tx_bytes),
|
||||
error=int(error))
|
||||
yield (interface, stats)
|
||||
|
@ -29,20 +29,6 @@ class _Base(plugin.HardwarePollster):
|
||||
INSPECT_METHOD = 'inspect_network'
|
||||
|
||||
|
||||
class BandwidthBytesPollster(_Base):
|
||||
|
||||
@staticmethod
|
||||
def generate_one_sample(host, c_data):
|
||||
(nic, info) = c_data
|
||||
return util.make_sample_from_host(host,
|
||||
name='network.bandwidth.bytes',
|
||||
type=sample.TYPE_GAUGE,
|
||||
unit='B',
|
||||
volume=info.bandwidth,
|
||||
res_metadata=nic,
|
||||
)
|
||||
|
||||
|
||||
class IncomingBytesPollster(_Base):
|
||||
|
||||
@staticmethod
|
||||
|
@ -30,9 +30,9 @@ class InspectorBaseTest(object):
|
||||
|
||||
network = [(base.Interface(name='eth0',
|
||||
mac='112233445566',
|
||||
ip='10.0.0.1'),
|
||||
base.InterfaceStats(bandwidth=1250000 / 8,
|
||||
rx_bytes=1000,
|
||||
ip='10.0.0.1',
|
||||
speed=1250000 / 8),
|
||||
base.InterfaceStats(rx_bytes=1000,
|
||||
tx_bytes=2000,
|
||||
error=1)),
|
||||
]
|
||||
|
@ -140,13 +140,13 @@ GETCMD_MAP = {
|
||||
FakeMac(),
|
||||
)],
|
||||
),
|
||||
ins._interface_bandwidth_oid + '.1': (None,
|
||||
None,
|
||||
0,
|
||||
[('',
|
||||
Base.network[0][1].bandwidth * 8,
|
||||
)],
|
||||
),
|
||||
ins._interface_speed_oid + '.1': (None,
|
||||
None,
|
||||
0,
|
||||
[('',
|
||||
Base.network[0][0].speed * 8,
|
||||
)],
|
||||
),
|
||||
ins._interface_received_oid + '.1': (None,
|
||||
None,
|
||||
0,
|
||||
|
@ -32,9 +32,9 @@ class FakeInspector(inspector_base.Inspector):
|
||||
MEMORY = inspector_base.MemoryStats(total=1000, used=90)
|
||||
NET = (inspector_base.Interface(name='test.teest',
|
||||
mac='001122334455',
|
||||
ip='10.0.0.2'),
|
||||
inspector_base.InterfaceStats(bandwidth=1000,
|
||||
rx_bytes=90,
|
||||
ip='10.0.0.2',
|
||||
speed=1000),
|
||||
inspector_base.InterfaceStats(rx_bytes=90,
|
||||
tx_bytes=80,
|
||||
error=1))
|
||||
|
||||
|
@ -21,22 +21,20 @@ from ceilometer.tests.hardware.pollsters import base
|
||||
|
||||
|
||||
class TestNetPollsters(base.TestPollsterBase):
|
||||
def test_bandwidth(self):
|
||||
self._check_get_samples(net.BandwidthBytesPollster,
|
||||
'hardware.network.bandwidth.bytes',
|
||||
1000, sample.TYPE_GAUGE)
|
||||
|
||||
def test_incoming(self):
|
||||
self._check_get_samples(net.IncomingBytesPollster,
|
||||
'hardware.network.incoming.bytes',
|
||||
90, sample.TYPE_CUMULATIVE)
|
||||
90, sample.TYPE_CUMULATIVE,
|
||||
expected_unit='B')
|
||||
|
||||
def test_outgoing(self):
|
||||
self._check_get_samples(net.OutgoingBytesPollster,
|
||||
'hardware.network.outgoing.bytes',
|
||||
80, sample.TYPE_CUMULATIVE)
|
||||
80, sample.TYPE_CUMULATIVE,
|
||||
expected_unit='B')
|
||||
|
||||
def test_error(self):
|
||||
self._check_get_samples(net.OutgoingErrorsPollster,
|
||||
'hardware.network.outgoing.errors',
|
||||
1, sample.TYPE_CUMULATIVE)
|
||||
1, sample.TYPE_CUMULATIVE,
|
||||
expected_unit='packet')
|
||||
|
@ -129,7 +129,6 @@ ceilometer.poll.central =
|
||||
hardware.cpu.load.15min = ceilometer.hardware.pollsters.cpu:CPULoad15MinPollster
|
||||
hardware.disk.size.total = ceilometer.hardware.pollsters.disk:DiskTotalPollster
|
||||
hardware.disk.size.used = ceilometer.hardware.pollsters.disk:DiskUsedPollster
|
||||
hardware.network.bandwidth.bytes = ceilometer.hardware.pollsters.net:BandwidthBytesPollster
|
||||
hardware.network.incoming.bytes = ceilometer.hardware.pollsters.net:IncomingBytesPollster
|
||||
hardware.network.outgoing.bytes = ceilometer.hardware.pollsters.net:OutgoingBytesPollster
|
||||
hardware.network.outgoing.errors = ceilometer.hardware.pollsters.net:OutgoingErrorsPollster
|
||||
|
Loading…
Reference in New Issue
Block a user