Add missing labels

This commit is contained in:
Calle Pettersson
2018-04-16 21:00:29 +02:00
parent a0ec1e2da6
commit 5a538d7682

View File

@@ -110,19 +110,19 @@ func NewHyperVCollector() (Collector, error) {
PhysicalPagesAllocated: prometheus.NewDesc( PhysicalPagesAllocated: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "physical_pages_allocated"), prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "physical_pages_allocated"),
"The number of physical pages allocated", "The number of physical pages allocated",
nil, []string{"interface"},
nil, nil,
), ),
PreferredNUMANodeIndex: prometheus.NewDesc( PreferredNUMANodeIndex: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "preferred_numa_node_index"), prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "preferred_numa_node_index"),
"The preferred NUMA node index associated with this partition", "The preferred NUMA node index associated with this partition",
nil, []string{"interface"},
nil, nil,
), ),
RemotePhysicalPages: prometheus.NewDesc( RemotePhysicalPages: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "remote_physical_pages"), prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "remote_physical_pages"),
"The number of physical pages not allocated from the preferred NUMA node", "The number of physical pages not allocated from the preferred NUMA node",
nil, []string{"interface"},
nil, nil,
), ),
@@ -301,127 +301,127 @@ func NewHyperVCollector() (Collector, error) {
BroadcastPacketsReceived: prometheus.NewDesc( BroadcastPacketsReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "broadcast_packets_received_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "broadcast_packets_received_total"),
"This represents the total number of broadcast packets received per second by the virtual switch", "This represents the total number of broadcast packets received per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
BroadcastPacketsSent: prometheus.NewDesc( BroadcastPacketsSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "broadcast_packets_sent_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "broadcast_packets_sent_total"),
"This represents the total number of broadcast packets sent per second by the virtual switch", "This represents the total number of broadcast packets sent per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
Bytes: prometheus.NewDesc( Bytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_total"),
"This represents the total number of bytes per second traversing the virtual switch", "This represents the total number of bytes per second traversing the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
BytesReceived: prometheus.NewDesc( BytesReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_received_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_received_total"),
"This represents the total number of bytes received per second by the virtual switch", "This represents the total number of bytes received per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
BytesSent: prometheus.NewDesc( BytesSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_sent_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_sent_total"),
"This represents the total number of bytes sent per second by the virtual switch", "This represents the total number of bytes sent per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
DirectedPacketsReceived: prometheus.NewDesc( DirectedPacketsReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "directed_packets_received_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "directed_packets_received_total"),
"This represents the total number of directed packets received per second by the virtual switch", "This represents the total number of directed packets received per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
DirectedPacketsSent: prometheus.NewDesc( DirectedPacketsSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "directed_packets_send_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "directed_packets_send_total"),
"This represents the total number of directed packets sent per second by the virtual switch", "This represents the total number of directed packets sent per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
DroppedPacketsIncoming: prometheus.NewDesc( DroppedPacketsIncoming: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "dropped_packets_incoming_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "dropped_packets_incoming_total"),
"This represents the total number of packet dropped per second by the virtual switch in the incoming direction", "This represents the total number of packet dropped per second by the virtual switch in the incoming direction",
nil, []string{"vswitch"},
nil, nil,
), ),
DroppedPacketsOutgoing: prometheus.NewDesc( DroppedPacketsOutgoing: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "dropped_packets_outcoming_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "dropped_packets_outcoming_total"),
"This represents the total number of packet dropped per second by the virtual switch in the outgoing direction", "This represents the total number of packet dropped per second by the virtual switch in the outgoing direction",
nil, []string{"vswitch"},
nil, nil,
), ),
ExtensionsDroppedPacketsIncoming: prometheus.NewDesc( ExtensionsDroppedPacketsIncoming: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_incoming_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_incoming_total"),
"This represents the total number of packet dropped per second by the virtual switch extensions in the incoming direction", "This represents the total number of packet dropped per second by the virtual switch extensions in the incoming direction",
nil, []string{"vswitch"},
nil, nil,
), ),
ExtensionsDroppedPacketsOutgoing: prometheus.NewDesc( ExtensionsDroppedPacketsOutgoing: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_outcoming_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_outcoming_total"),
"This represents the total number of packet dropped per second by the virtual switch extensions in the outgoing direction", "This represents the total number of packet dropped per second by the virtual switch extensions in the outgoing direction",
nil, []string{"vswitch"},
nil, nil,
), ),
LearnedMacAddresses: prometheus.NewDesc( LearnedMacAddresses: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "learned_mac_addresses_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "learned_mac_addresses_total"),
"This counter represents the total number of learned MAC addresses of the virtual switch", "This counter represents the total number of learned MAC addresses of the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
MulticastPacketsReceived: prometheus.NewDesc( MulticastPacketsReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "multicast_packets_received_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "multicast_packets_received_total"),
"This represents the total number of multicast packets received per second by the virtual switch", "This represents the total number of multicast packets received per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
MulticastPacketsSent: prometheus.NewDesc( MulticastPacketsSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "multicast_packets_sent_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "multicast_packets_sent_total"),
"This represents the total number of multicast packets sent per second by the virtual switch", "This represents the total number of multicast packets sent per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
NumberofSendChannelMoves: prometheus.NewDesc( NumberofSendChannelMoves: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "number_of_send_channel_moves_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "number_of_send_channel_moves_total"),
"This represents the total number of send channel moves per second on this virtual switch", "This represents the total number of send channel moves per second on this virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
NumberofVMQMoves: prometheus.NewDesc( NumberofVMQMoves: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "number_of_vmq_moves_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "number_of_vmq_moves_total"),
"This represents the total number of VMQ moves per second on this virtual switch", "This represents the total number of VMQ moves per second on this virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
PacketsFlooded: prometheus.NewDesc( PacketsFlooded: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_flooded_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_flooded_total"),
"This counter represents the total number of packets flooded by the virtual switch", "This counter represents the total number of packets flooded by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
Packets: prometheus.NewDesc( Packets: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_total"),
"This represents the total number of packets per second traversing the virtual switch", "This represents the total number of packets per second traversing the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
PacketsReceived: prometheus.NewDesc( PacketsReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_received_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_received_total"),
"This represents the total number of packets received per second by the virtual switch", "This represents the total number of packets received per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
PacketsSent: prometheus.NewDesc( PacketsSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_sent_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_sent_total"),
"This represents the total number of packets send per second by the virtual switch", "This represents the total number of packets send per second by the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
PurgedMacAddresses: prometheus.NewDesc( PurgedMacAddresses: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "purged_mac_addresses_total"), prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "purged_mac_addresses_total"),
"This counter represents the total number of purged MAC addresses of the virtual switch", "This counter represents the total number of purged MAC addresses of the virtual switch",
nil, []string{"vswitch"},
nil, nil,
), ),
@@ -559,18 +559,21 @@ func (c *HyperVCollector) collectVmVid(ch chan<- prometheus.Metric) (*prometheus
c.PhysicalPagesAllocated, c.PhysicalPagesAllocated,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(page.PhysicalPagesAllocated), float64(page.PhysicalPagesAllocated),
page.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PreferredNUMANodeIndex, c.PreferredNUMANodeIndex,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(page.PreferredNUMANodeIndex), float64(page.PreferredNUMANodeIndex),
page.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RemotePhysicalPages, c.RemotePhysicalPages,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(page.RemotePhysicalPages), float64(page.RemotePhysicalPages),
page.Name,
) )
} }
@@ -869,88 +872,104 @@ func (c *HyperVCollector) collectVmSwitch(ch chan<- prometheus.Metric) (*prometh
c.BroadcastPacketsReceived, c.BroadcastPacketsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BroadcastPacketsReceivedPersec), float64(obj.BroadcastPacketsReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BroadcastPacketsSent, c.BroadcastPacketsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BroadcastPacketsSentPersec), float64(obj.BroadcastPacketsSentPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Bytes, c.Bytes,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BytesPersec), float64(obj.BytesPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesReceived, c.BytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BytesReceivedPersec), float64(obj.BytesReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesSent, c.BytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BytesSentPersec), float64(obj.BytesSentPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DirectedPacketsReceived, c.DirectedPacketsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.DirectedPacketsReceivedPersec), float64(obj.DirectedPacketsReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DirectedPacketsSent, c.DirectedPacketsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.DirectedPacketsSentPersec), float64(obj.DirectedPacketsSentPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DroppedPacketsIncoming, c.DroppedPacketsIncoming,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.DroppedPacketsIncomingPersec), float64(obj.DroppedPacketsIncomingPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DroppedPacketsOutgoing, c.DroppedPacketsOutgoing,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.DroppedPacketsOutgoingPersec), float64(obj.DroppedPacketsOutgoingPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ExtensionsDroppedPacketsIncoming, c.ExtensionsDroppedPacketsIncoming,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.ExtensionsDroppedPacketsIncomingPersec), float64(obj.ExtensionsDroppedPacketsIncomingPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ExtensionsDroppedPacketsOutgoing, c.ExtensionsDroppedPacketsOutgoing,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.ExtensionsDroppedPacketsOutgoingPersec), float64(obj.ExtensionsDroppedPacketsOutgoingPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LearnedMacAddresses, c.LearnedMacAddresses,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.LearnedMacAddresses), float64(obj.LearnedMacAddresses),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MulticastPacketsReceived, c.MulticastPacketsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.MulticastPacketsReceivedPersec), float64(obj.MulticastPacketsReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MulticastPacketsSent, c.MulticastPacketsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.MulticastPacketsSentPersec), float64(obj.MulticastPacketsSentPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofSendChannelMoves, c.NumberofSendChannelMoves,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.NumberofSendChannelMovesPersec), float64(obj.NumberofSendChannelMovesPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofVMQMoves, c.NumberofVMQMoves,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.NumberofVMQMovesPersec), float64(obj.NumberofVMQMovesPersec),
obj.Name,
) )
// ... // ...
@@ -958,23 +977,27 @@ func (c *HyperVCollector) collectVmSwitch(ch chan<- prometheus.Metric) (*prometh
c.PacketsFlooded, c.PacketsFlooded,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.PacketsFlooded), float64(obj.PacketsFlooded),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Packets, c.Packets,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.PacketsPersec), float64(obj.PacketsPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceived, c.PacketsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.PacketsReceivedPersec), float64(obj.PacketsReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PurgedMacAddresses, c.PurgedMacAddresses,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.PurgedMacAddresses), float64(obj.PurgedMacAddresses),
obj.Name,
) )
} }
@@ -1007,36 +1030,42 @@ func (c *HyperVCollector) collectVmEthernet(ch chan<- prometheus.Metric) (*prome
c.AdapterBytesDropped, c.AdapterBytesDropped,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(obj.BytesDropped), float64(obj.BytesDropped),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AdapterBytesReceived, c.AdapterBytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BytesReceivedPersec), float64(obj.BytesReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AdapterBytesSent, c.AdapterBytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.BytesSentPersec), float64(obj.BytesSentPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AdapterFramesReceived, c.AdapterFramesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.FramesReceivedPersec), float64(obj.FramesReceivedPersec),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AdapterFramesDropped, c.AdapterFramesDropped,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.FramesDropped), float64(obj.FramesDropped),
obj.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AdapterFramesSent, c.AdapterFramesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(obj.FramesSentPersec), float64(obj.FramesSentPersec),
obj.Name,
) )
} }