*: Collector API cleanup 2 (#1552)

This commit is contained in:
Jan-Otto Kröpke
2024-08-05 23:40:32 +02:00
committed by GitHub
parent 3c360c05f3
commit 0ada09ee3c
19 changed files with 2153 additions and 2156 deletions

View File

@@ -21,8 +21,8 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
PhysicalMemoryBytes *prometheus.Desc physicalMemoryBytes *prometheus.Desc
LogicalProcessors *prometheus.Desc logicalProcessors *prometheus.Desc
hostname *prometheus.Desc hostname *prometheus.Desc
} }
@@ -54,13 +54,13 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.LogicalProcessors = prometheus.NewDesc( c.logicalProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logical_processors"), prometheus.BuildFQName(types.Namespace, Name, "logical_processors"),
"ComputerSystem.NumberOfLogicalProcessors", "ComputerSystem.NumberOfLogicalProcessors",
nil, nil,
nil, nil,
) )
c.PhysicalMemoryBytes = prometheus.NewDesc( c.physicalMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_memory_bytes"), prometheus.BuildFQName(types.Namespace, Name, "physical_memory_bytes"),
"ComputerSystem.TotalPhysicalMemory", "ComputerSystem.TotalPhysicalMemory",
nil, nil,
@@ -100,13 +100,13 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogicalProcessors, c.logicalProcessors,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(systemInfo.NumberOfProcessors), float64(systemInfo.NumberOfProcessors),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PhysicalMemoryBytes, c.physicalMemoryBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(mem.TotalPhys), float64(mem.TotalPhys),
) )

View File

@@ -20,31 +20,31 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
PacketsReceivedTotal *prometheus.Desc acksTotal *prometheus.Desc
DuplicatesDroppedTotal *prometheus.Desc activeQueueLength *prometheus.Desc
PacketsExpiredTotal *prometheus.Desc conflictCheckQueueLength *prometheus.Desc
ActiveQueueLength *prometheus.Desc declinesTotal *prometheus.Desc
ConflictCheckQueueLength *prometheus.Desc deniedDueToMatch *prometheus.Desc
DiscoversTotal *prometheus.Desc deniedDueToNonMatch *prometheus.Desc
OffersTotal *prometheus.Desc discoversTotal *prometheus.Desc
RequestsTotal *prometheus.Desc duplicatesDroppedTotal *prometheus.Desc
InformsTotal *prometheus.Desc failoverBndackReceivedTotal *prometheus.Desc
AcksTotal *prometheus.Desc failoverBndackSentTotal *prometheus.Desc
NacksTotal *prometheus.Desc failoverBndupdDropped *prometheus.Desc
DeclinesTotal *prometheus.Desc failoverBndupdPendingOutboundQueue *prometheus.Desc
ReleasesTotal *prometheus.Desc failoverBndupdReceivedTotal *prometheus.Desc
OfferQueueLength *prometheus.Desc failoverBndupdSentTotal *prometheus.Desc
DeniedDueToMatch *prometheus.Desc failoverTransitionsCommunicationInterruptedState *prometheus.Desc
DeniedDueToNonMatch *prometheus.Desc failoverTransitionsPartnerDownState *prometheus.Desc
FailoverBndupdSentTotal *prometheus.Desc failoverTransitionsRecoverState *prometheus.Desc
FailoverBndupdReceivedTotal *prometheus.Desc informsTotal *prometheus.Desc
FailoverBndackSentTotal *prometheus.Desc nACKsTotal *prometheus.Desc
FailoverBndackReceivedTotal *prometheus.Desc offerQueueLength *prometheus.Desc
FailoverBndupdPendingOutboundQueue *prometheus.Desc offersTotal *prometheus.Desc
FailoverTransitionsCommunicationinterruptedState *prometheus.Desc packetsExpiredTotal *prometheus.Desc
FailoverTransitionsPartnerdownState *prometheus.Desc packetsReceivedTotal *prometheus.Desc
FailoverTransitionsRecoverState *prometheus.Desc releasesTotal *prometheus.Desc
FailoverBndupdDropped *prometheus.Desc requestsTotal *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -75,151 +75,151 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.PacketsReceivedTotal = prometheus.NewDesc( c.packetsReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
"Total number of packets received by the DHCP server (PacketsReceivedTotal)", "Total number of packets received by the DHCP server (PacketsReceivedTotal)",
nil, nil,
nil, nil,
) )
c.DuplicatesDroppedTotal = prometheus.NewDesc( c.duplicatesDroppedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "duplicates_dropped_total"), prometheus.BuildFQName(types.Namespace, Name, "duplicates_dropped_total"),
"Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)", "Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)",
nil, nil,
nil, nil,
) )
c.PacketsExpiredTotal = prometheus.NewDesc( c.packetsExpiredTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_expired_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_expired_total"),
"Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)", "Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)",
nil, nil,
nil, nil,
) )
c.ActiveQueueLength = prometheus.NewDesc( c.activeQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "active_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "active_queue_length"),
"Number of packets in the processing queue of the DHCP server (ActiveQueueLength)", "Number of packets in the processing queue of the DHCP server (ActiveQueueLength)",
nil, nil,
nil, nil,
) )
c.ConflictCheckQueueLength = prometheus.NewDesc( c.conflictCheckQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "conflict_check_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "conflict_check_queue_length"),
"Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)", "Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)",
nil, nil,
nil, nil,
) )
c.DiscoversTotal = prometheus.NewDesc( c.discoversTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "discovers_total"), prometheus.BuildFQName(types.Namespace, Name, "discovers_total"),
"Total DHCP Discovers received by the DHCP server (DiscoversTotal)", "Total DHCP Discovers received by the DHCP server (DiscoversTotal)",
nil, nil,
nil, nil,
) )
c.OffersTotal = prometheus.NewDesc( c.offersTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "offers_total"), prometheus.BuildFQName(types.Namespace, Name, "offers_total"),
"Total DHCP Offers sent by the DHCP server (OffersTotal)", "Total DHCP Offers sent by the DHCP server (OffersTotal)",
nil, nil,
nil, nil,
) )
c.RequestsTotal = prometheus.NewDesc( c.requestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_total"), prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
"Total DHCP Requests received by the DHCP server (RequestsTotal)", "Total DHCP Requests received by the DHCP server (RequestsTotal)",
nil, nil,
nil, nil,
) )
c.InformsTotal = prometheus.NewDesc( c.informsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "informs_total"), prometheus.BuildFQName(types.Namespace, Name, "informs_total"),
"Total DHCP Informs received by the DHCP server (InformsTotal)", "Total DHCP Informs received by the DHCP server (InformsTotal)",
nil, nil,
nil, nil,
) )
c.AcksTotal = prometheus.NewDesc( c.acksTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "acks_total"), prometheus.BuildFQName(types.Namespace, Name, "acks_total"),
"Total DHCP Acks sent by the DHCP server (AcksTotal)", "Total DHCP Acks sent by the DHCP server (AcksTotal)",
nil, nil,
nil, nil,
) )
c.NacksTotal = prometheus.NewDesc( c.nACKsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "nacks_total"), prometheus.BuildFQName(types.Namespace, Name, "nacks_total"),
"Total DHCP Nacks sent by the DHCP server (NacksTotal)", "Total DHCP Nacks sent by the DHCP server (NacksTotal)",
nil, nil,
nil, nil,
) )
c.DeclinesTotal = prometheus.NewDesc( c.declinesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "declines_total"), prometheus.BuildFQName(types.Namespace, Name, "declines_total"),
"Total DHCP Declines received by the DHCP server (DeclinesTotal)", "Total DHCP Declines received by the DHCP server (DeclinesTotal)",
nil, nil,
nil, nil,
) )
c.ReleasesTotal = prometheus.NewDesc( c.releasesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "releases_total"), prometheus.BuildFQName(types.Namespace, Name, "releases_total"),
"Total DHCP Releases received by the DHCP server (ReleasesTotal)", "Total DHCP Releases received by the DHCP server (ReleasesTotal)",
nil, nil,
nil, nil,
) )
c.OfferQueueLength = prometheus.NewDesc( c.offerQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "offer_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "offer_queue_length"),
"Number of packets in the offer queue of the DHCP server (OfferQueueLength)", "Number of packets in the offer queue of the DHCP server (OfferQueueLength)",
nil, nil,
nil, nil,
) )
c.DeniedDueToMatch = prometheus.NewDesc( c.deniedDueToMatch = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_match_total"), prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_match_total"),
"Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)", "Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)",
nil, nil,
nil, nil,
) )
c.DeniedDueToNonMatch = prometheus.NewDesc( c.deniedDueToNonMatch = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_nonmatch_total"), prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_nonmatch_total"),
"Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)", "Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)",
nil, nil,
nil, nil,
) )
c.FailoverBndupdSentTotal = prometheus.NewDesc( c.failoverBndupdSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_sent_total"),
"Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)", "Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)",
nil, nil,
nil, nil,
) )
c.FailoverBndupdReceivedTotal = prometheus.NewDesc( c.failoverBndupdReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_received_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_received_total"),
"Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)", "Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)",
nil, nil,
nil, nil,
) )
c.FailoverBndackSentTotal = prometheus.NewDesc( c.failoverBndackSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_sent_total"),
"Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)", "Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)",
nil, nil,
nil, nil,
) )
c.FailoverBndackReceivedTotal = prometheus.NewDesc( c.failoverBndackReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_received_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_received_total"),
"Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)", "Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)",
nil, nil,
nil, nil,
) )
c.FailoverBndupdPendingOutboundQueue = prometheus.NewDesc( c.failoverBndupdPendingOutboundQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"), prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"),
"Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)", "Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)",
nil, nil,
nil, nil,
) )
c.FailoverTransitionsCommunicationinterruptedState = prometheus.NewDesc( c.failoverTransitionsCommunicationInterruptedState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_communicationinterrupted_state_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_communicationinterrupted_state_total"),
"Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)", "Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)",
nil, nil,
nil, nil,
) )
c.FailoverTransitionsPartnerdownState = prometheus.NewDesc( c.failoverTransitionsPartnerDownState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_partnerdown_state_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_partnerdown_state_total"),
"Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)", "Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)",
nil, nil,
nil, nil,
) )
c.FailoverTransitionsRecoverState = prometheus.NewDesc( c.failoverTransitionsRecoverState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_recover_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_recover_total"),
"Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)", "Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)",
nil, nil,
nil, nil,
) )
c.FailoverBndupdDropped = prometheus.NewDesc( c.failoverBndupdDropped = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_dropped_total"), prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_dropped_total"),
"Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)", "Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)",
nil, nil,
@@ -266,151 +266,151 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceivedTotal, c.packetsReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].PacketsReceivedTotal, dhcpPerfs[0].PacketsReceivedTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DuplicatesDroppedTotal, c.duplicatesDroppedTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].DuplicatesDroppedTotal, dhcpPerfs[0].DuplicatesDroppedTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsExpiredTotal, c.packetsExpiredTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].PacketsExpiredTotal, dhcpPerfs[0].PacketsExpiredTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveQueueLength, c.activeQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
dhcpPerfs[0].ActiveQueueLength, dhcpPerfs[0].ActiveQueueLength,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConflictCheckQueueLength, c.conflictCheckQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
dhcpPerfs[0].ConflictCheckQueueLength, dhcpPerfs[0].ConflictCheckQueueLength,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DiscoversTotal, c.discoversTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].DiscoversTotal, dhcpPerfs[0].DiscoversTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OffersTotal, c.offersTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].OffersTotal, dhcpPerfs[0].OffersTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RequestsTotal, c.requestsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].RequestsTotal, dhcpPerfs[0].RequestsTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.InformsTotal, c.informsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].InformsTotal, dhcpPerfs[0].InformsTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AcksTotal, c.acksTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].AcksTotal, dhcpPerfs[0].AcksTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NacksTotal, c.nACKsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].NacksTotal, dhcpPerfs[0].NacksTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DeclinesTotal, c.declinesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].DeclinesTotal, dhcpPerfs[0].DeclinesTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReleasesTotal, c.releasesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].ReleasesTotal, dhcpPerfs[0].ReleasesTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OfferQueueLength, c.offerQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
dhcpPerfs[0].OfferQueueLength, dhcpPerfs[0].OfferQueueLength,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DeniedDueToMatch, c.deniedDueToMatch,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].DeniedDueToMatch, dhcpPerfs[0].DeniedDueToMatch,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DeniedDueToNonMatch, c.deniedDueToNonMatch,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].DeniedDueToNonMatch, dhcpPerfs[0].DeniedDueToNonMatch,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverBndupdSentTotal, c.failoverBndupdSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverBndupdSentTotal, dhcpPerfs[0].FailoverBndupdSentTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverBndupdReceivedTotal, c.failoverBndupdReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverBndupdReceivedTotal, dhcpPerfs[0].FailoverBndupdReceivedTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverBndackSentTotal, c.failoverBndackSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverBndackSentTotal, dhcpPerfs[0].FailoverBndackSentTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverBndackReceivedTotal, c.failoverBndackReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverBndackReceivedTotal, dhcpPerfs[0].FailoverBndackReceivedTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverBndupdPendingOutboundQueue, c.failoverBndupdPendingOutboundQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
dhcpPerfs[0].FailoverBndupdPendingOutboundQueue, dhcpPerfs[0].FailoverBndupdPendingOutboundQueue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverTransitionsCommunicationinterruptedState, c.failoverTransitionsCommunicationInterruptedState,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverTransitionsCommunicationinterruptedState, dhcpPerfs[0].FailoverTransitionsCommunicationinterruptedState,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverTransitionsPartnerdownState, c.failoverTransitionsPartnerDownState,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverTransitionsPartnerdownState, dhcpPerfs[0].FailoverTransitionsPartnerdownState,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverTransitionsRecoverState, c.failoverTransitionsRecoverState,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverTransitionsRecoverState, dhcpPerfs[0].FailoverTransitionsRecoverState,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverBndupdDropped, c.failoverBndupdDropped,
prometheus.CounterValue, prometheus.CounterValue,
dhcpPerfs[0].FailoverBndupdDropped, dhcpPerfs[0].FailoverBndupdDropped,
) )

View File

@@ -27,11 +27,11 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
DiskInfo *prometheus.Desc availability *prometheus.Desc
Status *prometheus.Desc diskInfo *prometheus.Desc
Size *prometheus.Desc partitions *prometheus.Desc
Partitions *prometheus.Desc size *prometheus.Desc
Availability *prometheus.Desc status *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -62,7 +62,7 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.DiskInfo = prometheus.NewDesc( c.diskInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"), prometheus.BuildFQName(types.Namespace, Name, "info"),
"General drive information", "General drive information",
[]string{ []string{
@@ -73,25 +73,25 @@ func (c *Collector) Build() error {
}, },
nil, nil,
) )
c.Status = prometheus.NewDesc( c.status = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "status"), prometheus.BuildFQName(types.Namespace, Name, "status"),
"Status of the drive", "Status of the drive",
[]string{"name", "status"}, []string{"name", "status"},
nil, nil,
) )
c.Size = prometheus.NewDesc( c.size = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "size"), prometheus.BuildFQName(types.Namespace, Name, "size"),
"Size of the disk drive. It is calculated by multiplying the total number of cylinders, tracks in each cylinder, sectors in each track, and bytes in each sector.", "Size of the disk drive. It is calculated by multiplying the total number of cylinders, tracks in each cylinder, sectors in each track, and bytes in each sector.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Partitions = prometheus.NewDesc( c.partitions = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "partitions"), prometheus.BuildFQName(types.Namespace, Name, "partitions"),
"Number of partitions", "Number of partitions",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Availability = prometheus.NewDesc( c.availability = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "availability"), prometheus.BuildFQName(types.Namespace, Name, "availability"),
"Availability Status", "Availability Status",
[]string{"name", "availability"}, []string{"name", "availability"},
@@ -101,7 +101,7 @@ func (c *Collector) Build() error {
return nil return nil
} }
type Win32_DiskDrive struct { type win32_DiskDrive struct {
DeviceID string DeviceID string
Model string Model string
Size uint64 Size uint64
@@ -163,7 +163,7 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
} }
func (c *Collector) collect(ch chan<- prometheus.Metric) error { func (c *Collector) collect(ch chan<- prometheus.Metric) error {
var dst []Win32_DiskDrive var dst []win32_DiskDrive
if err := wmi.Query(win32DiskQuery, &dst); err != nil { if err := wmi.Query(win32DiskQuery, &dst); err != nil {
return err return err
@@ -174,7 +174,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
for _, disk := range dst { for _, disk := range dst {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DiskInfo, c.diskInfo,
prometheus.GaugeValue, prometheus.GaugeValue,
1.0, 1.0,
strings.Trim(disk.DeviceID, "\\.\\"), strings.Trim(disk.DeviceID, "\\.\\"),
@@ -190,7 +190,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Status, c.status,
prometheus.GaugeValue, prometheus.GaugeValue,
isCurrentState, isCurrentState,
strings.Trim(disk.Name, "\\.\\"), strings.Trim(disk.Name, "\\.\\"),
@@ -199,14 +199,14 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Size, c.size,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(disk.Size), float64(disk.Size),
strings.Trim(disk.Name, "\\.\\"), strings.Trim(disk.Name, "\\.\\"),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Partitions, c.partitions,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(disk.Partitions), float64(disk.Partitions),
strings.Trim(disk.Name, "\\.\\"), strings.Trim(disk.Name, "\\.\\"),
@@ -218,7 +218,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
isCurrentState = 1.0 isCurrentState = 1.0
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Availability, c.availability,
prometheus.GaugeValue, prometheus.GaugeValue,
isCurrentState, isCurrentState,
strings.Trim(disk.Name, "\\.\\"), strings.Trim(disk.Name, "\\.\\"),

View File

@@ -23,28 +23,28 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
ZoneTransferRequestsReceived *prometheus.Desc dynamicUpdatesFailures *prometheus.Desc
ZoneTransferRequestsSent *prometheus.Desc dynamicUpdatesQueued *prometheus.Desc
ZoneTransferResponsesReceived *prometheus.Desc dynamicUpdatesReceived *prometheus.Desc
ZoneTransferSuccessReceived *prometheus.Desc memoryUsedBytes *prometheus.Desc
ZoneTransferSuccessSent *prometheus.Desc notifyReceived *prometheus.Desc
ZoneTransferFailures *prometheus.Desc notifySent *prometheus.Desc
MemoryUsedBytes *prometheus.Desc queries *prometheus.Desc
DynamicUpdatesQueued *prometheus.Desc recursiveQueries *prometheus.Desc
DynamicUpdatesReceived *prometheus.Desc recursiveQueryFailures *prometheus.Desc
DynamicUpdatesFailures *prometheus.Desc recursiveQuerySendTimeouts *prometheus.Desc
NotifyReceived *prometheus.Desc responses *prometheus.Desc
NotifySent *prometheus.Desc secureUpdateFailures *prometheus.Desc
SecureUpdateFailures *prometheus.Desc secureUpdateReceived *prometheus.Desc
SecureUpdateReceived *prometheus.Desc unmatchedResponsesReceived *prometheus.Desc
Queries *prometheus.Desc winsQueries *prometheus.Desc
Responses *prometheus.Desc winsResponses *prometheus.Desc
RecursiveQueries *prometheus.Desc zoneTransferFailures *prometheus.Desc
RecursiveQueryFailures *prometheus.Desc zoneTransferRequestsReceived *prometheus.Desc
RecursiveQuerySendTimeouts *prometheus.Desc zoneTransferRequestsSent *prometheus.Desc
WinsQueries *prometheus.Desc zoneTransferResponsesReceived *prometheus.Desc
WinsResponses *prometheus.Desc zoneTransferSuccessReceived *prometheus.Desc
UnmatchedResponsesReceived *prometheus.Desc zoneTransferSuccessSent *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -75,133 +75,133 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.ZoneTransferRequestsReceived = prometheus.NewDesc( c.zoneTransferRequestsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"),
"Number of zone transfer requests (AXFR/IXFR) received by the master DNS server", "Number of zone transfer requests (AXFR/IXFR) received by the master DNS server",
[]string{"qtype"}, []string{"qtype"},
nil, nil,
) )
c.ZoneTransferRequestsSent = prometheus.NewDesc( c.zoneTransferRequestsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_sent_total"),
"Number of zone transfer requests (AXFR/IXFR) sent by the secondary DNS server", "Number of zone transfer requests (AXFR/IXFR) sent by the secondary DNS server",
[]string{"qtype"}, []string{"qtype"},
nil, nil,
) )
c.ZoneTransferResponsesReceived = prometheus.NewDesc( c.zoneTransferResponsesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_response_received_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_response_received_total"),
"Number of zone transfer responses (AXFR/IXFR) received by the secondary DNS server", "Number of zone transfer responses (AXFR/IXFR) received by the secondary DNS server",
[]string{"qtype"}, []string{"qtype"},
nil, nil,
) )
c.ZoneTransferSuccessReceived = prometheus.NewDesc( c.zoneTransferSuccessReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_success_received_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_success_received_total"),
"Number of successful zone transfers (AXFR/IXFR) received by the secondary DNS server", "Number of successful zone transfers (AXFR/IXFR) received by the secondary DNS server",
[]string{"qtype", "protocol"}, []string{"qtype", "protocol"},
nil, nil,
) )
c.ZoneTransferSuccessSent = prometheus.NewDesc( c.zoneTransferSuccessSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_success_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_success_sent_total"),
"Number of successful zone transfers (AXFR/IXFR) of the master DNS server", "Number of successful zone transfers (AXFR/IXFR) of the master DNS server",
[]string{"qtype"}, []string{"qtype"},
nil, nil,
) )
c.ZoneTransferFailures = prometheus.NewDesc( c.zoneTransferFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_failures_total"),
"Number of failed zone transfers of the master DNS server", "Number of failed zone transfers of the master DNS server",
nil, nil,
nil, nil,
) )
c.MemoryUsedBytes = prometheus.NewDesc( c.memoryUsedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_used_bytes"), prometheus.BuildFQName(types.Namespace, Name, "memory_used_bytes"),
"Current memory used by DNS server", "Current memory used by DNS server",
[]string{"area"}, []string{"area"},
nil, nil,
) )
c.DynamicUpdatesQueued = prometheus.NewDesc( c.dynamicUpdatesQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_queued"), prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_queued"),
"Number of dynamic updates queued by the DNS server", "Number of dynamic updates queued by the DNS server",
nil, nil,
nil, nil,
) )
c.DynamicUpdatesReceived = prometheus.NewDesc( c.dynamicUpdatesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_received_total"), prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_received_total"),
"Number of secure update requests received by the DNS server", "Number of secure update requests received by the DNS server",
[]string{"operation"}, []string{"operation"},
nil, nil,
) )
c.DynamicUpdatesFailures = prometheus.NewDesc( c.dynamicUpdatesFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_failures_total"),
"Number of dynamic updates which timed out or were rejected by the DNS server", "Number of dynamic updates which timed out or were rejected by the DNS server",
[]string{"reason"}, []string{"reason"},
nil, nil,
) )
c.NotifyReceived = prometheus.NewDesc( c.notifyReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "notify_received_total"), prometheus.BuildFQName(types.Namespace, Name, "notify_received_total"),
"Number of notifies received by the secondary DNS server", "Number of notifies received by the secondary DNS server",
nil, nil,
nil, nil,
) )
c.NotifySent = prometheus.NewDesc( c.notifySent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "notify_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "notify_sent_total"),
"Number of notifies sent by the master DNS server", "Number of notifies sent by the master DNS server",
nil, nil,
nil, nil,
) )
c.SecureUpdateFailures = prometheus.NewDesc( c.secureUpdateFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "secure_update_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "secure_update_failures_total"),
"Number of secure updates that failed on the DNS server", "Number of secure updates that failed on the DNS server",
nil, nil,
nil, nil,
) )
c.SecureUpdateReceived = prometheus.NewDesc( c.secureUpdateReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "secure_update_received_total"), prometheus.BuildFQName(types.Namespace, Name, "secure_update_received_total"),
"Number of secure update requests received by the DNS server", "Number of secure update requests received by the DNS server",
nil, nil,
nil, nil,
) )
c.Queries = prometheus.NewDesc( c.queries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "queries_total"), prometheus.BuildFQName(types.Namespace, Name, "queries_total"),
"Number of queries received by DNS server", "Number of queries received by DNS server",
[]string{"protocol"}, []string{"protocol"},
nil, nil,
) )
c.Responses = prometheus.NewDesc( c.responses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "responses_total"), prometheus.BuildFQName(types.Namespace, Name, "responses_total"),
"Number of responses sent by DNS server", "Number of responses sent by DNS server",
[]string{"protocol"}, []string{"protocol"},
nil, nil,
) )
c.RecursiveQueries = prometheus.NewDesc( c.recursiveQueries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recursive_queries_total"), prometheus.BuildFQName(types.Namespace, Name, "recursive_queries_total"),
"Number of recursive queries received by DNS server", "Number of recursive queries received by DNS server",
nil, nil,
nil, nil,
) )
c.RecursiveQueryFailures = prometheus.NewDesc( c.recursiveQueryFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recursive_query_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "recursive_query_failures_total"),
"Number of recursive query failures", "Number of recursive query failures",
nil, nil,
nil, nil,
) )
c.RecursiveQuerySendTimeouts = prometheus.NewDesc( c.recursiveQuerySendTimeouts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recursive_query_send_timeouts_total"), prometheus.BuildFQName(types.Namespace, Name, "recursive_query_send_timeouts_total"),
"Number of recursive query sending timeouts", "Number of recursive query sending timeouts",
nil, nil,
nil, nil,
) )
c.WinsQueries = prometheus.NewDesc( c.winsQueries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wins_queries_total"), prometheus.BuildFQName(types.Namespace, Name, "wins_queries_total"),
"Number of WINS lookup requests received by the server", "Number of WINS lookup requests received by the server",
[]string{"direction"}, []string{"direction"},
nil, nil,
) )
c.WinsResponses = prometheus.NewDesc( c.winsResponses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wins_responses_total"), prometheus.BuildFQName(types.Namespace, Name, "wins_responses_total"),
"Number of WINS lookup responses sent by the server", "Number of WINS lookup responses sent by the server",
[]string{"direction"}, []string{"direction"},
nil, nil,
) )
c.UnmatchedResponsesReceived = prometheus.NewDesc( c.unmatchedResponsesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "unmatched_responses_total"), prometheus.BuildFQName(types.Namespace, Name, "unmatched_responses_total"),
"Number of response packets received by the DNS server that do not match any outstanding remote query", "Number of response packets received by the DNS server that do not match any outstanding remote query",
nil, nil,
@@ -277,66 +277,66 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferRequestsReceived, c.zoneTransferRequestsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AXFRRequestReceived), float64(dst[0].AXFRRequestReceived),
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferRequestsReceived, c.zoneTransferRequestsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].IXFRRequestReceived), float64(dst[0].IXFRRequestReceived),
"incremental", "incremental",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferRequestsSent, c.zoneTransferRequestsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AXFRRequestSent), float64(dst[0].AXFRRequestSent),
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferRequestsSent, c.zoneTransferRequestsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].IXFRRequestSent), float64(dst[0].IXFRRequestSent),
"incremental", "incremental",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferRequestsSent, c.zoneTransferRequestsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].ZoneTransferSOARequestSent), float64(dst[0].ZoneTransferSOARequestSent),
"soa", "soa",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferResponsesReceived, c.zoneTransferResponsesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AXFRResponseReceived), float64(dst[0].AXFRResponseReceived),
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferResponsesReceived, c.zoneTransferResponsesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].IXFRResponseReceived), float64(dst[0].IXFRResponseReceived),
"incremental", "incremental",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferSuccessReceived, c.zoneTransferSuccessReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AXFRSuccessReceived), float64(dst[0].AXFRSuccessReceived),
"full", "full",
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferSuccessReceived, c.zoneTransferSuccessReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].IXFRTCPSuccessReceived), float64(dst[0].IXFRTCPSuccessReceived),
"incremental", "incremental",
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferSuccessReceived, c.zoneTransferSuccessReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].IXFRTCPSuccessReceived), float64(dst[0].IXFRTCPSuccessReceived),
"incremental", "incremental",
@@ -344,183 +344,183 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferSuccessSent, c.zoneTransferSuccessSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AXFRSuccessSent), float64(dst[0].AXFRSuccessSent),
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferSuccessSent, c.zoneTransferSuccessSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].IXFRSuccessSent), float64(dst[0].IXFRSuccessSent),
"incremental", "incremental",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ZoneTransferFailures, c.zoneTransferFailures,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].ZoneTransferFailure), float64(dst[0].ZoneTransferFailure),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].CachingMemory), float64(dst[0].CachingMemory),
"caching", "caching",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].DatabaseNodeMemory), float64(dst[0].DatabaseNodeMemory),
"database_node", "database_node",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].NbstatMemory), float64(dst[0].NbstatMemory),
"nbstat", "nbstat",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].RecordFlowMemory), float64(dst[0].RecordFlowMemory),
"record_flow", "record_flow",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].TCPMessageMemory), float64(dst[0].TCPMessageMemory),
"tcp_message", "tcp_message",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].UDPMessageMemory), float64(dst[0].UDPMessageMemory),
"udp_message", "udp_message",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DynamicUpdatesReceived, c.dynamicUpdatesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].DynamicUpdateNoOperation), float64(dst[0].DynamicUpdateNoOperation),
"noop", "noop",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DynamicUpdatesReceived, c.dynamicUpdatesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].DynamicUpdateWrittentoDatabase), float64(dst[0].DynamicUpdateWrittentoDatabase),
"written", "written",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DynamicUpdatesQueued, c.dynamicUpdatesQueued,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].DynamicUpdateQueued), float64(dst[0].DynamicUpdateQueued),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DynamicUpdatesFailures, c.dynamicUpdatesFailures,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].DynamicUpdateRejected), float64(dst[0].DynamicUpdateRejected),
"rejected", "rejected",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DynamicUpdatesFailures, c.dynamicUpdatesFailures,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].DynamicUpdateTimeOuts), float64(dst[0].DynamicUpdateTimeOuts),
"timeout", "timeout",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NotifyReceived, c.notifyReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].NotifyReceived), float64(dst[0].NotifyReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NotifySent, c.notifySent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].NotifySent), float64(dst[0].NotifySent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RecursiveQueries, c.recursiveQueries,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].RecursiveQueries), float64(dst[0].RecursiveQueries),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RecursiveQueryFailures, c.recursiveQueryFailures,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].RecursiveQueryFailure), float64(dst[0].RecursiveQueryFailure),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RecursiveQuerySendTimeouts, c.recursiveQuerySendTimeouts,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].RecursiveSendTimeOuts), float64(dst[0].RecursiveSendTimeOuts),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Queries, c.queries,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].TCPQueryReceived), float64(dst[0].TCPQueryReceived),
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Queries, c.queries,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].UDPQueryReceived), float64(dst[0].UDPQueryReceived),
"udp", "udp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Responses, c.responses,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].TCPResponseSent), float64(dst[0].TCPResponseSent),
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Responses, c.responses,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].UDPResponseSent), float64(dst[0].UDPResponseSent),
"udp", "udp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.UnmatchedResponsesReceived, c.unmatchedResponsesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].UnmatchedResponsesReceived), float64(dst[0].UnmatchedResponsesReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WinsQueries, c.winsQueries,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].WINSLookupReceived), float64(dst[0].WINSLookupReceived),
"forward", "forward",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WinsQueries, c.winsQueries,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].WINSReverseLookupReceived), float64(dst[0].WINSReverseLookupReceived),
"reverse", "reverse",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WinsResponses, c.winsResponses,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].WINSResponseSent), float64(dst[0].WINSResponseSent),
"forward", "forward",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WinsResponses, c.winsResponses,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].WINSReverseResponseSent), float64(dst[0].WINSReverseResponseSent),
"reverse", "reverse",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SecureUpdateFailures, c.secureUpdateFailures,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].SecureUpdateFailure), float64(dst[0].SecureUpdateFailure),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SecureUpdateReceived, c.secureUpdateReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].SecureUpdateReceived), float64(dst[0].SecureUpdateReceived),
) )

View File

@@ -33,44 +33,44 @@ type Collector struct {
exchangeListAllCollectors *bool exchangeListAllCollectors *bool
exchangeCollectorsEnabled *string exchangeCollectorsEnabled *string
LDAPReadTime *prometheus.Desc activeMailboxDeliveryQueueLength *prometheus.Desc
LDAPSearchTime *prometheus.Desc activeSyncRequestsPerSec *prometheus.Desc
LDAPWriteTime *prometheus.Desc activeTasks *prometheus.Desc
LDAPTimeoutErrorsPerSec *prometheus.Desc activeUserCount *prometheus.Desc
LongRunningLDAPOperationsPerMin *prometheus.Desc activeUserCountMapiHttpEmsMDB *prometheus.Desc
ExternalActiveRemoteDeliveryQueueLength *prometheus.Desc autoDiscoverRequestsPerSec *prometheus.Desc
InternalActiveRemoteDeliveryQueueLength *prometheus.Desc availabilityRequestsSec *prometheus.Desc
ActiveMailboxDeliveryQueueLength *prometheus.Desc averageAuthenticationLatency *prometheus.Desc
RetryMailboxDeliveryQueueLength *prometheus.Desc averageCASProcessingLatency *prometheus.Desc
UnreachableQueueLength *prometheus.Desc completedTasks *prometheus.Desc
ExternalLargestDeliveryQueueLength *prometheus.Desc connectionCount *prometheus.Desc
InternalLargestDeliveryQueueLength *prometheus.Desc currentUniqueUsers *prometheus.Desc
PoisonQueueLength *prometheus.Desc externalActiveRemoteDeliveryQueueLength *prometheus.Desc
MailboxServerLocatorAverageLatency *prometheus.Desc externalLargestDeliveryQueueLength *prometheus.Desc
AverageAuthenticationLatency *prometheus.Desc internalActiveRemoteDeliveryQueueLength *prometheus.Desc
AverageCASProcessingLatency *prometheus.Desc internalLargestDeliveryQueueLength *prometheus.Desc
MailboxServerProxyFailureRate *prometheus.Desc isActive *prometheus.Desc
OutstandingProxyRequests *prometheus.Desc ldapReadTime *prometheus.Desc
ProxyRequestsPerSec *prometheus.Desc ldapSearchTime *prometheus.Desc
ActiveSyncRequestsPerSec *prometheus.Desc ldapTimeoutErrorsPerSec *prometheus.Desc
PingCommandsPending *prometheus.Desc ldapWriteTime *prometheus.Desc
SyncCommandsPerSec *prometheus.Desc longRunningLDAPOperationsPerMin *prometheus.Desc
AvailabilityRequestsSec *prometheus.Desc mailboxServerLocatorAverageLatency *prometheus.Desc
CurrentUniqueUsers *prometheus.Desc mailboxServerProxyFailureRate *prometheus.Desc
OWARequestsPerSec *prometheus.Desc outstandingProxyRequests *prometheus.Desc
AutodiscoverRequestsPerSec *prometheus.Desc owaRequestsPerSec *prometheus.Desc
ActiveTasks *prometheus.Desc pingCommandsPending *prometheus.Desc
CompletedTasks *prometheus.Desc poisonQueueLength *prometheus.Desc
QueuedTasks *prometheus.Desc proxyRequestsPerSec *prometheus.Desc
YieldedTasks *prometheus.Desc queuedTasks *prometheus.Desc
IsActive *prometheus.Desc retryMailboxDeliveryQueueLength *prometheus.Desc
RPCAveragedLatency *prometheus.Desc rpcAveragedLatency *prometheus.Desc
RPCRequests *prometheus.Desc rpcOperationsPerSec *prometheus.Desc
ActiveUserCount *prometheus.Desc rpcRequests *prometheus.Desc
ConnectionCount *prometheus.Desc syncCommandsPerSec *prometheus.Desc
RPCOperationsPerSec *prometheus.Desc unreachableQueueLength *prometheus.Desc
UserCount *prometheus.Desc userCount *prometheus.Desc
ActiveUserCountMapiHttpEmsmdb *prometheus.Desc yieldedTasks *prometheus.Desc
enabledCollectors []string enabledCollectors []string
} }
@@ -156,44 +156,44 @@ func (c *Collector) Build() error {
) )
} }
c.RPCAveragedLatency = desc("rpc_avg_latency_sec", "The latency (sec) averaged for the past 1024 packets") c.rpcAveragedLatency = desc("rpc_avg_latency_sec", "The latency (sec) averaged for the past 1024 packets")
c.RPCRequests = desc("rpc_requests", "Number of client requests currently being processed by the RPC Client Access service") c.rpcRequests = desc("rpc_requests", "Number of client requests currently being processed by the RPC Client Access service")
c.ActiveUserCount = desc("rpc_active_user_count", "Number of unique users that have shown some kind of activity in the last 2 minutes") c.activeUserCount = desc("rpc_active_user_count", "Number of unique users that have shown some kind of activity in the last 2 minutes")
c.ConnectionCount = desc("rpc_connection_count", "Total number of client connections maintained") c.connectionCount = desc("rpc_connection_count", "Total number of client connections maintained")
c.RPCOperationsPerSec = desc("rpc_operations_total", "The rate at which RPC operations occur") c.rpcOperationsPerSec = desc("rpc_operations_total", "The rate at which RPC operations occur")
c.UserCount = desc("rpc_user_count", "Number of users") c.userCount = desc("rpc_user_count", "Number of users")
c.LDAPReadTime = desc("ldap_read_time_sec", "Time (sec) to send an LDAP read request and receive a response", "name") c.ldapReadTime = desc("ldap_read_time_sec", "Time (sec) to send an LDAP read request and receive a response", "name")
c.LDAPSearchTime = desc("ldap_search_time_sec", "Time (sec) to send an LDAP search request and receive a response", "name") c.ldapSearchTime = desc("ldap_search_time_sec", "Time (sec) to send an LDAP search request and receive a response", "name")
c.LDAPWriteTime = desc("ldap_write_time_sec", "Time (sec) to send an LDAP Add/Modify/Delete request and receive a response", "name") c.ldapWriteTime = desc("ldap_write_time_sec", "Time (sec) to send an LDAP Add/Modify/Delete request and receive a response", "name")
c.LDAPTimeoutErrorsPerSec = desc("ldap_timeout_errors_total", "Total number of LDAP timeout errors", "name") c.ldapTimeoutErrorsPerSec = desc("ldap_timeout_errors_total", "Total number of LDAP timeout errors", "name")
c.LongRunningLDAPOperationsPerMin = desc("ldap_long_running_ops_per_sec", "Long Running LDAP operations per second", "name") c.longRunningLDAPOperationsPerMin = desc("ldap_long_running_ops_per_sec", "Long Running LDAP operations per second", "name")
c.ExternalActiveRemoteDeliveryQueueLength = desc("transport_queues_external_active_remote_delivery", "External Active Remote Delivery Queue length", "name") c.externalActiveRemoteDeliveryQueueLength = desc("transport_queues_external_active_remote_delivery", "External Active Remote Delivery Queue length", "name")
c.InternalActiveRemoteDeliveryQueueLength = desc("transport_queues_internal_active_remote_delivery", "Internal Active Remote Delivery Queue length", "name") c.internalActiveRemoteDeliveryQueueLength = desc("transport_queues_internal_active_remote_delivery", "Internal Active Remote Delivery Queue length", "name")
c.ActiveMailboxDeliveryQueueLength = desc("transport_queues_active_mailbox_delivery", "Active Mailbox Delivery Queue length", "name") c.activeMailboxDeliveryQueueLength = desc("transport_queues_active_mailbox_delivery", "Active Mailbox Delivery Queue length", "name")
c.RetryMailboxDeliveryQueueLength = desc("transport_queues_retry_mailbox_delivery", "Retry Mailbox Delivery Queue length", "name") c.retryMailboxDeliveryQueueLength = desc("transport_queues_retry_mailbox_delivery", "Retry Mailbox Delivery Queue length", "name")
c.UnreachableQueueLength = desc("transport_queues_unreachable", "Unreachable Queue length", "name") c.unreachableQueueLength = desc("transport_queues_unreachable", "Unreachable Queue length", "name")
c.ExternalLargestDeliveryQueueLength = desc("transport_queues_external_largest_delivery", "External Largest Delivery Queue length", "name") c.externalLargestDeliveryQueueLength = desc("transport_queues_external_largest_delivery", "External Largest Delivery Queue length", "name")
c.InternalLargestDeliveryQueueLength = desc("transport_queues_internal_largest_delivery", "Internal Largest Delivery Queue length", "name") c.internalLargestDeliveryQueueLength = desc("transport_queues_internal_largest_delivery", "Internal Largest Delivery Queue length", "name")
c.PoisonQueueLength = desc("transport_queues_poison", "Poison Queue length", "name") c.poisonQueueLength = desc("transport_queues_poison", "Poison Queue length", "name")
c.MailboxServerLocatorAverageLatency = desc("http_proxy_mailbox_server_locator_avg_latency_sec", "Average latency (sec) of MailboxServerLocator web service calls", "name") c.mailboxServerLocatorAverageLatency = desc("http_proxy_mailbox_server_locator_avg_latency_sec", "Average latency (sec) of MailboxServerLocator web service calls", "name")
c.AverageAuthenticationLatency = desc("http_proxy_avg_auth_latency", "Average time spent authenticating CAS requests over the last 200 samples", "name") c.averageAuthenticationLatency = desc("http_proxy_avg_auth_latency", "Average time spent authenticating CAS requests over the last 200 samples", "name")
c.OutstandingProxyRequests = desc("http_proxy_outstanding_proxy_requests", "Number of concurrent outstanding proxy requests", "name") c.outstandingProxyRequests = desc("http_proxy_outstanding_proxy_requests", "Number of concurrent outstanding proxy requests", "name")
c.ProxyRequestsPerSec = desc("http_proxy_requests_total", "Number of proxy requests processed each second", "name") c.proxyRequestsPerSec = desc("http_proxy_requests_total", "Number of proxy requests processed each second", "name")
c.AvailabilityRequestsSec = desc("avail_service_requests_per_sec", "Number of requests serviced per second") c.availabilityRequestsSec = desc("avail_service_requests_per_sec", "Number of requests serviced per second")
c.CurrentUniqueUsers = desc("owa_current_unique_users", "Number of unique users currently logged on to Outlook Web App") c.currentUniqueUsers = desc("owa_current_unique_users", "Number of unique users currently logged on to Outlook Web App")
c.OWARequestsPerSec = desc("owa_requests_total", "Number of requests handled by Outlook Web App per second") c.owaRequestsPerSec = desc("owa_requests_total", "Number of requests handled by Outlook Web App per second")
c.AutodiscoverRequestsPerSec = desc("autodiscover_requests_total", "Number of autodiscover service requests processed each second") c.autoDiscoverRequestsPerSec = desc("autodiscover_requests_total", "Number of autodiscover service requests processed each second")
c.ActiveTasks = desc("workload_active_tasks", "Number of active tasks currently running in the background for workload management", "name") c.activeTasks = desc("workload_active_tasks", "Number of active tasks currently running in the background for workload management", "name")
c.CompletedTasks = desc("workload_completed_tasks", "Number of workload management tasks that have been completed", "name") c.completedTasks = desc("workload_completed_tasks", "Number of workload management tasks that have been completed", "name")
c.QueuedTasks = desc("workload_queued_tasks", "Number of workload management tasks that are currently queued up waiting to be processed", "name") c.queuedTasks = desc("workload_queued_tasks", "Number of workload management tasks that are currently queued up waiting to be processed", "name")
c.YieldedTasks = desc("workload_yielded_tasks", "The total number of tasks that have been yielded by a workload", "name") c.yieldedTasks = desc("workload_yielded_tasks", "The total number of tasks that have been yielded by a workload", "name")
c.IsActive = desc("workload_is_active", "Active indicates whether the workload is in an active (1) or paused (0) state", "name") c.isActive = desc("workload_is_active", "Active indicates whether the workload is in an active (1) or paused (0) state", "name")
c.ActiveSyncRequestsPerSec = desc("activesync_requests_total", "Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load") c.activeSyncRequestsPerSec = desc("activesync_requests_total", "Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load")
c.AverageCASProcessingLatency = desc("http_proxy_avg_cas_proccessing_latency_sec", "Average latency (sec) of CAS processing time over the last 200 reqs", "name") c.averageCASProcessingLatency = desc("http_proxy_avg_cas_proccessing_latency_sec", "Average latency (sec) of CAS processing time over the last 200 reqs", "name")
c.MailboxServerProxyFailureRate = desc("http_proxy_mailbox_proxy_failure_rate", "% of failures between this CAS and MBX servers over the last 200 samples", "name") c.mailboxServerProxyFailureRate = desc("http_proxy_mailbox_proxy_failure_rate", "% of failures between this CAS and MBX servers over the last 200 samples", "name")
c.PingCommandsPending = desc("activesync_ping_cmds_pending", "Number of ping commands currently pending in the queue") c.pingCommandsPending = desc("activesync_ping_cmds_pending", "Number of ping commands currently pending in the queue")
c.SyncCommandsPerSec = desc("activesync_sync_cmds_total", "Number of sync commands processed per second. Clients use this command to synchronize items within a folder") c.syncCommandsPerSec = desc("activesync_sync_cmds_total", "Number of sync commands processed per second. Clients use this command to synchronize items within a folder")
c.ActiveUserCountMapiHttpEmsmdb = desc("mapihttp_emsmdb_active_user_count", "Number of unique outlook users that have shown some kind of activity in the last 2 minutes") c.activeUserCountMapiHttpEmsMDB = desc("mapihttp_emsmdb_active_user_count", "Number of unique outlook users that have shown some kind of activity in the last 2 minutes")
c.enabledCollectors = make([]string, 0, len(exchangeAllCollectorNames)) c.enabledCollectors = make([]string, 0, len(exchangeAllCollectorNames))
@@ -291,31 +291,31 @@ func (c *Collector) collectADAccessProcesses(ctx *types.ScrapeContext, ch chan<-
labelName = fmt.Sprintf("%s_%d", labelName, labelUseCount[labelName]) labelName = fmt.Sprintf("%s_%d", labelName, labelUseCount[labelName])
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LDAPReadTime, c.ldapReadTime,
prometheus.CounterValue, prometheus.CounterValue,
c.msToSec(proc.LDAPReadTime), c.msToSec(proc.LDAPReadTime),
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LDAPSearchTime, c.ldapSearchTime,
prometheus.CounterValue, prometheus.CounterValue,
c.msToSec(proc.LDAPSearchTime), c.msToSec(proc.LDAPSearchTime),
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LDAPWriteTime, c.ldapWriteTime,
prometheus.CounterValue, prometheus.CounterValue,
c.msToSec(proc.LDAPWriteTime), c.msToSec(proc.LDAPWriteTime),
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LDAPTimeoutErrorsPerSec, c.ldapTimeoutErrorsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
proc.LDAPTimeoutErrorsPerSec, proc.LDAPTimeoutErrorsPerSec,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LongRunningLDAPOperationsPerMin, c.longRunningLDAPOperationsPerMin,
prometheus.CounterValue, prometheus.CounterValue,
proc.LongRunningLDAPOperationsPerMin*60, proc.LongRunningLDAPOperationsPerMin*60,
labelName, labelName,
@@ -337,7 +337,7 @@ func (c *Collector) collectAvailabilityService(ctx *types.ScrapeContext, ch chan
for _, availservice := range data { for _, availservice := range data {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AvailabilityRequestsSec, c.availabilityRequestsSec,
prometheus.CounterValue, prometheus.CounterValue,
availservice.RequestsSec, availservice.RequestsSec,
) )
@@ -366,37 +366,37 @@ func (c *Collector) collectHTTPProxy(ctx *types.ScrapeContext, ch chan<- prometh
for _, instance := range data { for _, instance := range data {
labelName := c.toLabelName(instance.Name) labelName := c.toLabelName(instance.Name)
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MailboxServerLocatorAverageLatency, c.mailboxServerLocatorAverageLatency,
prometheus.GaugeValue, prometheus.GaugeValue,
c.msToSec(instance.MailboxServerLocatorAverageLatency), c.msToSec(instance.MailboxServerLocatorAverageLatency),
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AverageAuthenticationLatency, c.averageAuthenticationLatency,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.AverageAuthenticationLatency, instance.AverageAuthenticationLatency,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AverageCASProcessingLatency, c.averageCASProcessingLatency,
prometheus.GaugeValue, prometheus.GaugeValue,
c.msToSec(instance.AverageCASProcessingLatency), c.msToSec(instance.AverageCASProcessingLatency),
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MailboxServerProxyFailureRate, c.mailboxServerProxyFailureRate,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.MailboxServerProxyFailureRate, instance.MailboxServerProxyFailureRate,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OutstandingProxyRequests, c.outstandingProxyRequests,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.OutstandingProxyRequests, instance.OutstandingProxyRequests,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ProxyRequestsPerSec, c.proxyRequestsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
instance.ProxyRequestsPerSec, instance.ProxyRequestsPerSec,
labelName, labelName,
@@ -419,12 +419,12 @@ func (c *Collector) collectOWA(ctx *types.ScrapeContext, ch chan<- prometheus.Me
for _, owa := range data { for _, owa := range data {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentUniqueUsers, c.currentUniqueUsers,
prometheus.GaugeValue, prometheus.GaugeValue,
owa.CurrentUniqueUsers, owa.CurrentUniqueUsers,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OWARequestsPerSec, c.owaRequestsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
owa.RequestsPerSec, owa.RequestsPerSec,
) )
@@ -447,17 +447,17 @@ func (c *Collector) collectActiveSync(ctx *types.ScrapeContext, ch chan<- promet
for _, instance := range data { for _, instance := range data {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveSyncRequestsPerSec, c.activeSyncRequestsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
instance.RequestsPerSec, instance.RequestsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PingCommandsPending, c.pingCommandsPending,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.PingCommandsPending, instance.PingCommandsPending,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SyncCommandsPerSec, c.syncCommandsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
instance.SyncCommandsPerSec, instance.SyncCommandsPerSec,
) )
@@ -483,32 +483,32 @@ func (c *Collector) collectRPC(ctx *types.ScrapeContext, ch chan<- prometheus.Me
for _, rpc := range data { for _, rpc := range data {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RPCAveragedLatency, c.rpcAveragedLatency,
prometheus.GaugeValue, prometheus.GaugeValue,
c.msToSec(rpc.RPCAveragedLatency), c.msToSec(rpc.RPCAveragedLatency),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RPCRequests, c.rpcRequests,
prometheus.GaugeValue, prometheus.GaugeValue,
rpc.RPCRequests, rpc.RPCRequests,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveUserCount, c.activeUserCount,
prometheus.GaugeValue, prometheus.GaugeValue,
rpc.ActiveUserCount, rpc.ActiveUserCount,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionCount, c.connectionCount,
prometheus.GaugeValue, prometheus.GaugeValue,
rpc.ConnectionCount, rpc.ConnectionCount,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RPCOperationsPerSec, c.rpcOperationsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
rpc.RPCOperationsPerSec, rpc.RPCOperationsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.UserCount, c.userCount,
prometheus.GaugeValue, prometheus.GaugeValue,
rpc.UserCount, rpc.UserCount,
) )
@@ -543,49 +543,49 @@ func (c *Collector) collectTransportQueues(ctx *types.ScrapeContext, ch chan<- p
continue continue
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ExternalActiveRemoteDeliveryQueueLength, c.externalActiveRemoteDeliveryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.ExternalActiveRemoteDeliveryQueueLength, queue.ExternalActiveRemoteDeliveryQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.InternalActiveRemoteDeliveryQueueLength, c.internalActiveRemoteDeliveryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.InternalActiveRemoteDeliveryQueueLength, queue.InternalActiveRemoteDeliveryQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveMailboxDeliveryQueueLength, c.activeMailboxDeliveryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.ActiveMailboxDeliveryQueueLength, queue.ActiveMailboxDeliveryQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RetryMailboxDeliveryQueueLength, c.retryMailboxDeliveryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.RetryMailboxDeliveryQueueLength, queue.RetryMailboxDeliveryQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.UnreachableQueueLength, c.unreachableQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.UnreachableQueueLength, queue.UnreachableQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ExternalLargestDeliveryQueueLength, c.externalLargestDeliveryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.ExternalLargestDeliveryQueueLength, queue.ExternalLargestDeliveryQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.InternalLargestDeliveryQueueLength, c.internalLargestDeliveryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.InternalLargestDeliveryQueueLength, queue.InternalLargestDeliveryQueueLength,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoisonQueueLength, c.poisonQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
queue.PoisonQueueLength, queue.PoisonQueueLength,
labelName, labelName,
@@ -617,31 +617,31 @@ func (c *Collector) collectWorkloadManagementWorkloads(ctx *types.ScrapeContext,
continue continue
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveTasks, c.activeTasks,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.ActiveTasks, instance.ActiveTasks,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CompletedTasks, c.completedTasks,
prometheus.CounterValue, prometheus.CounterValue,
instance.CompletedTasks, instance.CompletedTasks,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.QueuedTasks, c.queuedTasks,
prometheus.CounterValue, prometheus.CounterValue,
instance.QueuedTasks, instance.QueuedTasks,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.YieldedTasks, c.yieldedTasks,
prometheus.CounterValue, prometheus.CounterValue,
instance.YieldedTasks, instance.YieldedTasks,
labelName, labelName,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IsActive, c.isActive,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.IsActive, instance.IsActive,
labelName, labelName,
@@ -663,7 +663,7 @@ func (c *Collector) collectAutoDiscover(ctx *types.ScrapeContext, ch chan<- prom
} }
for _, autodisc := range data { for _, autodisc := range data {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AutodiscoverRequestsPerSec, c.autoDiscoverRequestsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
autodisc.RequestsPerSec, autodisc.RequestsPerSec,
) )
@@ -684,7 +684,7 @@ func (c *Collector) collectMapiHttpEmsmdb(ctx *types.ScrapeContext, ch chan<- pr
for _, mapihttp := range data { for _, mapihttp := range data {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveUserCountMapiHttpEmsmdb, c.activeUserCountMapiHttpEmsMDB,
prometheus.GaugeValue, prometheus.GaugeValue,
mapihttp.ActiveUserCount, mapihttp.ActiveUserCount,
) )

View File

@@ -21,17 +21,16 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
QuotasCount *prometheus.Desc quotasCount *prometheus.Desc
Path *prometheus.Desc peakUsage *prometheus.Desc
PeakUsage *prometheus.Desc size *prometheus.Desc
Size *prometheus.Desc usage *prometheus.Desc
Usage *prometheus.Desc
Description *prometheus.Desc description *prometheus.Desc
Disabled *prometheus.Desc disabled *prometheus.Desc
MatchesTemplate *prometheus.Desc matchesTemplate *prometheus.Desc
SoftLimit *prometheus.Desc softLimit *prometheus.Desc
Template *prometheus.Desc template *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -62,55 +61,55 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.QuotasCount = prometheus.NewDesc( c.quotasCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "count"), prometheus.BuildFQName(types.Namespace, Name, "count"),
"Number of Quotas", "Number of Quotas",
nil, nil,
nil, nil,
) )
c.PeakUsage = prometheus.NewDesc( c.peakUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "peak_usage_bytes"), prometheus.BuildFQName(types.Namespace, Name, "peak_usage_bytes"),
"The highest amount of disk space usage charged to this quota. (PeakUsage)", "The highest amount of disk space usage charged to this quota. (PeakUsage)",
[]string{"path", "template"}, []string{"path", "template"},
nil, nil,
) )
c.Size = prometheus.NewDesc( c.size = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "size_bytes"), prometheus.BuildFQName(types.Namespace, Name, "size_bytes"),
"The size of the quota. (Size)", "The size of the quota. (Size)",
[]string{"path", "template"}, []string{"path", "template"},
nil, nil,
) )
c.Usage = prometheus.NewDesc( c.usage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "usage_bytes"), prometheus.BuildFQName(types.Namespace, Name, "usage_bytes"),
"The current amount of disk space usage charged to this quota. (Usage)", "The current amount of disk space usage charged to this quota. (Usage)",
[]string{"path", "template"}, []string{"path", "template"},
nil, nil,
) )
c.Description = prometheus.NewDesc( c.description = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "description"), prometheus.BuildFQName(types.Namespace, Name, "description"),
"Description of the quota (Description)", "Description of the quota (Description)",
[]string{"path", "template", "description"}, []string{"path", "template", "description"},
nil, nil,
) )
c.Disabled = prometheus.NewDesc( c.disabled = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "disabled"), prometheus.BuildFQName(types.Namespace, Name, "disabled"),
"If 1, the quota is disabled. The default value is 0. (Disabled)", "If 1, the quota is disabled. The default value is 0. (Disabled)",
[]string{"path", "template"}, []string{"path", "template"},
nil, nil,
) )
c.SoftLimit = prometheus.NewDesc( c.softLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "softlimit"), prometheus.BuildFQName(types.Namespace, Name, "softlimit"),
"If 1, the quota is a soft limit. If 0, the quota is a hard limit. The default value is 0. Optional (SoftLimit)", "If 1, the quota is a soft limit. If 0, the quota is a hard limit. The default value is 0. Optional (SoftLimit)",
[]string{"path", "template"}, []string{"path", "template"},
nil, nil,
) )
c.Template = prometheus.NewDesc( c.template = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "template"), prometheus.BuildFQName(types.Namespace, Name, "template"),
"Quota template name. (Template)", "Quota template name. (Template)",
[]string{"path", "template"}, []string{"path", "template"},
nil, nil,
) )
c.MatchesTemplate = prometheus.NewDesc( c.matchesTemplate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "matchestemplate"), prometheus.BuildFQName(types.Namespace, Name, "matchestemplate"),
"If 1, the property values of this quota match those values of the template from which it was derived. (MatchesTemplate)", "If 1, the property values of this quota match those values of the template from which it was derived. (MatchesTemplate)",
[]string{"path", "template"}, []string{"path", "template"},
@@ -163,48 +162,48 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
Description := quota.Description Description := quota.Description
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PeakUsage, c.peakUsage,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(quota.PeakUsage), float64(quota.PeakUsage),
path, path,
template, template,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Size, c.size,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(quota.Size), float64(quota.Size),
path, path,
template, template,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Usage, c.usage,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(quota.Usage), float64(quota.Usage),
path, path,
template, template,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Description, c.description,
prometheus.GaugeValue, prometheus.GaugeValue,
1.0, 1.0,
path, template, Description, path, template, Description,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Disabled, c.disabled,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.BoolToFloat(quota.Disabled), utils.BoolToFloat(quota.Disabled),
path, path,
template, template,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MatchesTemplate, c.matchesTemplate,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.BoolToFloat(quota.MatchesTemplate), utils.BoolToFloat(quota.MatchesTemplate),
path, path,
template, template,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SoftLimit, c.softLimit,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.BoolToFloat(quota.SoftLimit), utils.BoolToFloat(quota.SoftLimit),
path, path,
@@ -213,7 +212,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.QuotasCount, c.quotasCount,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(count), float64(count),
) )

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,7 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
LicenseStatus *prometheus.Desc licenseStatus *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -60,7 +60,7 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.LicenseStatus = prometheus.NewDesc( c.licenseStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "status"), prometheus.BuildFQName(types.Namespace, Name, "status"),
"Status of windows license", "Status of windows license",
[]string{"state"}, []string{"state"},
@@ -92,7 +92,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
val = 1.0 val = 1.0
} }
ch <- prometheus.MustNewConstMetric(c.LicenseStatus, prometheus.GaugeValue, val, v) ch <- prometheus.MustNewConstMetric(c.licenseStatus, prometheus.GaugeValue, val, v)
} }
return nil return nil

View File

@@ -35,30 +35,29 @@ var ConfigDefaults = Config{
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
volumeInclude *string volumeInclude *string
volumeExclude *string volumeExclude *string
Information *prometheus.Desc
ReadOnly *prometheus.Desc
RequestsQueued *prometheus.Desc
AvgReadQueue *prometheus.Desc
AvgWriteQueue *prometheus.Desc
ReadBytesTotal *prometheus.Desc
ReadsTotal *prometheus.Desc
WriteBytesTotal *prometheus.Desc
WritesTotal *prometheus.Desc
ReadTime *prometheus.Desc
WriteTime *prometheus.Desc
TotalSpace *prometheus.Desc
FreeSpace *prometheus.Desc
IdleTime *prometheus.Desc
SplitIOs *prometheus.Desc
ReadLatency *prometheus.Desc
WriteLatency *prometheus.Desc
ReadWriteLatency *prometheus.Desc
volumeIncludePattern *regexp.Regexp volumeIncludePattern *regexp.Regexp
volumeExcludePattern *regexp.Regexp volumeExcludePattern *regexp.Regexp
avgReadQueue *prometheus.Desc
avgWriteQueue *prometheus.Desc
freeSpace *prometheus.Desc
idleTime *prometheus.Desc
information *prometheus.Desc
readBytesTotal *prometheus.Desc
readLatency *prometheus.Desc
readOnly *prometheus.Desc
readsTotal *prometheus.Desc
readTime *prometheus.Desc
readWriteLatency *prometheus.Desc
requestsQueued *prometheus.Desc
splitIOs *prometheus.Desc
totalSpace *prometheus.Desc
writeBytesTotal *prometheus.Desc
writeLatency *prometheus.Desc
writesTotal *prometheus.Desc
writeTime *prometheus.Desc
} }
type volumeInfo struct { type volumeInfo struct {
@@ -115,124 +114,124 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.Information = prometheus.NewDesc( c.information = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"), prometheus.BuildFQName(types.Namespace, Name, "info"),
"A metric with a constant '1' value labeled with logical disk information", "A metric with a constant '1' value labeled with logical disk information",
[]string{"disk", "type", "volume", "volume_name", "filesystem", "serial_number"}, []string{"disk", "type", "volume", "volume_name", "filesystem", "serial_number"},
nil, nil,
) )
c.ReadOnly = prometheus.NewDesc( c.readOnly = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "readonly"), prometheus.BuildFQName(types.Namespace, Name, "readonly"),
"Whether the logical disk is read-only", "Whether the logical disk is read-only",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.RequestsQueued = prometheus.NewDesc( c.requestsQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_queued"), prometheus.BuildFQName(types.Namespace, Name, "requests_queued"),
"The number of requests queued to the disk (LogicalDisk.CurrentDiskQueueLength)", "The number of requests queued to the disk (LogicalDisk.CurrentDiskQueueLength)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.AvgReadQueue = prometheus.NewDesc( c.avgReadQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "avg_read_requests_queued"), prometheus.BuildFQName(types.Namespace, Name, "avg_read_requests_queued"),
"Average number of read requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskReadQueueLength)", "Average number of read requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskReadQueueLength)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.AvgWriteQueue = prometheus.NewDesc( c.avgWriteQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "avg_write_requests_queued"), prometheus.BuildFQName(types.Namespace, Name, "avg_write_requests_queued"),
"Average number of write requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskWriteQueueLength)", "Average number of write requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskWriteQueueLength)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.ReadBytesTotal = prometheus.NewDesc( c.readBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "read_bytes_total"),
"The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)", "The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.ReadsTotal = prometheus.NewDesc( c.readsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "reads_total"), prometheus.BuildFQName(types.Namespace, Name, "reads_total"),
"The number of read operations on the disk (LogicalDisk.DiskReadsPerSec)", "The number of read operations on the disk (LogicalDisk.DiskReadsPerSec)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.WriteBytesTotal = prometheus.NewDesc( c.writeBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "write_bytes_total"),
"The number of bytes transferred to the disk during write operations (LogicalDisk.DiskWriteBytesPerSec)", "The number of bytes transferred to the disk during write operations (LogicalDisk.DiskWriteBytesPerSec)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.WritesTotal = prometheus.NewDesc( c.writesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "writes_total"), prometheus.BuildFQName(types.Namespace, Name, "writes_total"),
"The number of write operations on the disk (LogicalDisk.DiskWritesPerSec)", "The number of write operations on the disk (LogicalDisk.DiskWritesPerSec)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.ReadTime = prometheus.NewDesc( c.readTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "read_seconds_total"),
"Seconds that the disk was busy servicing read requests (LogicalDisk.PercentDiskReadTime)", "Seconds that the disk was busy servicing read requests (LogicalDisk.PercentDiskReadTime)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.WriteTime = prometheus.NewDesc( c.writeTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "write_seconds_total"),
"Seconds that the disk was busy servicing write requests (LogicalDisk.PercentDiskWriteTime)", "Seconds that the disk was busy servicing write requests (LogicalDisk.PercentDiskWriteTime)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.FreeSpace = prometheus.NewDesc( c.freeSpace = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "free_bytes"), prometheus.BuildFQName(types.Namespace, Name, "free_bytes"),
"Free space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace)", "Free space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.TotalSpace = prometheus.NewDesc( c.totalSpace = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "size_bytes"), prometheus.BuildFQName(types.Namespace, Name, "size_bytes"),
"Total space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace_Base)", "Total space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace_Base)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.IdleTime = prometheus.NewDesc( c.idleTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "idle_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "idle_seconds_total"),
"Seconds that the disk was idle (LogicalDisk.PercentIdleTime)", "Seconds that the disk was idle (LogicalDisk.PercentIdleTime)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.SplitIOs = prometheus.NewDesc( c.splitIOs = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "split_ios_total"), prometheus.BuildFQName(types.Namespace, Name, "split_ios_total"),
"The number of I/Os to the disk were split into multiple I/Os (LogicalDisk.SplitIOPerSec)", "The number of I/Os to the disk were split into multiple I/Os (LogicalDisk.SplitIOPerSec)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.ReadLatency = prometheus.NewDesc( c.readLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"),
"Shows the average time, in seconds, of a read operation from the disk (LogicalDisk.AvgDiskSecPerRead)", "Shows the average time, in seconds, of a read operation from the disk (LogicalDisk.AvgDiskSecPerRead)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.WriteLatency = prometheus.NewDesc( c.writeLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"),
"Shows the average time, in seconds, of a write operation to the disk (LogicalDisk.AvgDiskSecPerWrite)", "Shows the average time, in seconds, of a write operation to the disk (LogicalDisk.AvgDiskSecPerWrite)",
[]string{"volume"}, []string{"volume"},
nil, nil,
) )
c.ReadWriteLatency = prometheus.NewDesc( c.readWriteLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"),
"Shows the time, in seconds, of the average disk transfer (LogicalDisk.AvgDiskSecPerTransfer)", "Shows the time, in seconds, of the average disk transfer (LogicalDisk.AvgDiskSecPerTransfer)",
[]string{"volume"}, []string{"volume"},
@@ -316,7 +315,7 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Information, c.information,
prometheus.GaugeValue, prometheus.GaugeValue,
1, 1,
diskID, diskID,
@@ -328,112 +327,112 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RequestsQueued, c.requestsQueued,
prometheus.GaugeValue, prometheus.GaugeValue,
volume.CurrentDiskQueueLength, volume.CurrentDiskQueueLength,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AvgReadQueue, c.avgReadQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
volume.AvgDiskReadQueueLength*perflib.TicksToSecondScaleFactor, volume.AvgDiskReadQueueLength*perflib.TicksToSecondScaleFactor,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AvgWriteQueue, c.avgWriteQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
volume.AvgDiskWriteQueueLength*perflib.TicksToSecondScaleFactor, volume.AvgDiskWriteQueueLength*perflib.TicksToSecondScaleFactor,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadBytesTotal, c.readBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
volume.DiskReadBytesPerSec, volume.DiskReadBytesPerSec,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadsTotal, c.readsTotal,
prometheus.CounterValue, prometheus.CounterValue,
volume.DiskReadsPerSec, volume.DiskReadsPerSec,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteBytesTotal, c.writeBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
volume.DiskWriteBytesPerSec, volume.DiskWriteBytesPerSec,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WritesTotal, c.writesTotal,
prometheus.CounterValue, prometheus.CounterValue,
volume.DiskWritesPerSec, volume.DiskWritesPerSec,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadTime, c.readTime,
prometheus.CounterValue, prometheus.CounterValue,
volume.PercentDiskReadTime, volume.PercentDiskReadTime,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteTime, c.writeTime,
prometheus.CounterValue, prometheus.CounterValue,
volume.PercentDiskWriteTime, volume.PercentDiskWriteTime,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FreeSpace, c.freeSpace,
prometheus.GaugeValue, prometheus.GaugeValue,
volume.PercentFreeSpace_Base*1024*1024, volume.PercentFreeSpace_Base*1024*1024,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalSpace, c.totalSpace,
prometheus.GaugeValue, prometheus.GaugeValue,
volume.PercentFreeSpace*1024*1024, volume.PercentFreeSpace*1024*1024,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IdleTime, c.idleTime,
prometheus.CounterValue, prometheus.CounterValue,
volume.PercentIdleTime, volume.PercentIdleTime,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SplitIOs, c.splitIOs,
prometheus.CounterValue, prometheus.CounterValue,
volume.SplitIOPerSec, volume.SplitIOPerSec,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadLatency, c.readLatency,
prometheus.CounterValue, prometheus.CounterValue,
volume.AvgDiskSecPerRead*perflib.TicksToSecondScaleFactor, volume.AvgDiskSecPerRead*perflib.TicksToSecondScaleFactor,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteLatency, c.writeLatency,
prometheus.CounterValue, prometheus.CounterValue,
volume.AvgDiskSecPerWrite*perflib.TicksToSecondScaleFactor, volume.AvgDiskSecPerWrite*perflib.TicksToSecondScaleFactor,
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadWriteLatency, c.readWriteLatency,
prometheus.CounterValue, prometheus.CounterValue,
volume.AvgDiskSecPerTransfer*perflib.TicksToSecondScaleFactor, volume.AvgDiskSecPerTransfer*perflib.TicksToSecondScaleFactor,
volume.Name, volume.Name,

View File

@@ -23,7 +23,7 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
LogonType *prometheus.Desc logonType *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -54,7 +54,7 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.LogonType = prometheus.NewDesc( c.logonType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logon_type"), prometheus.BuildFQName(types.Namespace, Name, "logon_type"),
"Number of active logon sessions (LogonSession.LogonType)", "Number of active logon sessions (LogonSession.LogonType)",
[]string{"status"}, []string{"status"},
@@ -136,91 +136,91 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(system), float64(system),
"system", "system",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(interactive), float64(interactive),
"interactive", "interactive",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(network), float64(network),
"network", "network",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(batch), float64(batch),
"batch", "batch",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(service), float64(service),
"service", "service",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(proxy), float64(proxy),
"proxy", "proxy",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(unlock), float64(unlock),
"unlock", "unlock",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(networkcleartext), float64(networkcleartext),
"network_clear_text", "network_clear_text",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(newcredentials), float64(newcredentials),
"new_credentials", "new_credentials",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(remoteinteractive), float64(remoteinteractive),
"remote_interactive", "remote_interactive",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(cachedinteractive), float64(cachedinteractive),
"cached_interactive", "cached_interactive",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(remoteinteractive), float64(remoteinteractive),
"cached_remote_interactive", "cached_remote_interactive",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LogonType, c.logonType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(cachedunlock), float64(cachedunlock),
"cached_unlock", "cached_unlock",

View File

@@ -24,38 +24,38 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
AvailableBytes *prometheus.Desc availableBytes *prometheus.Desc
CacheBytes *prometheus.Desc cacheBytes *prometheus.Desc
CacheBytesPeak *prometheus.Desc cacheBytesPeak *prometheus.Desc
CacheFaultsTotal *prometheus.Desc cacheFaultsTotal *prometheus.Desc
CommitLimit *prometheus.Desc commitLimit *prometheus.Desc
CommittedBytes *prometheus.Desc committedBytes *prometheus.Desc
DemandZeroFaultsTotal *prometheus.Desc demandZeroFaultsTotal *prometheus.Desc
FreeAndZeroPageListBytes *prometheus.Desc freeAndZeroPageListBytes *prometheus.Desc
FreeSystemPageTableEntries *prometheus.Desc freeSystemPageTableEntries *prometheus.Desc
ModifiedPageListBytes *prometheus.Desc modifiedPageListBytes *prometheus.Desc
PageFaultsTotal *prometheus.Desc pageFaultsTotal *prometheus.Desc
SwapPageReadsTotal *prometheus.Desc swapPageReadsTotal *prometheus.Desc
SwapPagesReadTotal *prometheus.Desc swapPagesReadTotal *prometheus.Desc
SwapPagesWrittenTotal *prometheus.Desc swapPagesWrittenTotal *prometheus.Desc
SwapPageOperationsTotal *prometheus.Desc swapPageOperationsTotal *prometheus.Desc
SwapPageWritesTotal *prometheus.Desc swapPageWritesTotal *prometheus.Desc
PoolNonpagedAllocsTotal *prometheus.Desc poolNonPagedAllocationsTotal *prometheus.Desc
PoolNonpagedBytes *prometheus.Desc poolNonPagedBytes *prometheus.Desc
PoolPagedAllocsTotal *prometheus.Desc poolPagedAllocationsTotal *prometheus.Desc
PoolPagedBytes *prometheus.Desc poolPagedBytes *prometheus.Desc
PoolPagedResidentBytes *prometheus.Desc poolPagedResidentBytes *prometheus.Desc
StandbyCacheCoreBytes *prometheus.Desc standbyCacheCoreBytes *prometheus.Desc
StandbyCacheNormalPriorityBytes *prometheus.Desc standbyCacheNormalPriorityBytes *prometheus.Desc
StandbyCacheReserveBytes *prometheus.Desc standbyCacheReserveBytes *prometheus.Desc
SystemCacheResidentBytes *prometheus.Desc systemCacheResidentBytes *prometheus.Desc
SystemCodeResidentBytes *prometheus.Desc systemCodeResidentBytes *prometheus.Desc
SystemCodeTotalBytes *prometheus.Desc systemCodeTotalBytes *prometheus.Desc
SystemDriverResidentBytes *prometheus.Desc systemDriverResidentBytes *prometheus.Desc
SystemDriverTotalBytes *prometheus.Desc systemDriverTotalBytes *prometheus.Desc
TransitionFaultsTotal *prometheus.Desc transitionFaultsTotal *prometheus.Desc
TransitionPagesRepurposedTotal *prometheus.Desc transitionPagesRepurposedTotal *prometheus.Desc
WriteCopiesTotal *prometheus.Desc writeCopiesTotal *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -86,205 +86,205 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.AvailableBytes = prometheus.NewDesc( c.availableBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "available_bytes"), prometheus.BuildFQName(types.Namespace, Name, "available_bytes"),
"The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to"+ "The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to"+
" the standby (cached), free and zero page lists (AvailableBytes)", " the standby (cached), free and zero page lists (AvailableBytes)",
nil, nil,
nil, nil,
) )
c.CacheBytes = prometheus.NewDesc( c.cacheBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cache_bytes"), prometheus.BuildFQName(types.Namespace, Name, "cache_bytes"),
"(CacheBytes)", "(CacheBytes)",
nil, nil,
nil, nil,
) )
c.CacheBytesPeak = prometheus.NewDesc( c.cacheBytesPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cache_bytes_peak"), prometheus.BuildFQName(types.Namespace, Name, "cache_bytes_peak"),
"(CacheBytesPeak)", "(CacheBytesPeak)",
nil, nil,
nil, nil,
) )
c.CacheFaultsTotal = prometheus.NewDesc( c.cacheFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cache_faults_total"), prometheus.BuildFQName(types.Namespace, Name, "cache_faults_total"),
"Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) "+ "Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) "+
"or from disk (hard fault) (Cache Faults/sec)", "or from disk (hard fault) (Cache Faults/sec)",
nil, nil,
nil, nil,
) )
c.CommitLimit = prometheus.NewDesc( c.commitLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "commit_limit"), prometheus.BuildFQName(types.Namespace, Name, "commit_limit"),
"(CommitLimit)", "(CommitLimit)",
nil, nil,
nil, nil,
) )
c.CommittedBytes = prometheus.NewDesc( c.committedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "committed_bytes"), prometheus.BuildFQName(types.Namespace, Name, "committed_bytes"),
"(CommittedBytes)", "(CommittedBytes)",
nil, nil,
nil, nil,
) )
c.DemandZeroFaultsTotal = prometheus.NewDesc( c.demandZeroFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "demand_zero_faults_total"), prometheus.BuildFQName(types.Namespace, Name, "demand_zero_faults_total"),
"The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security"+ "The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security"+
" feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space (Demand Zero Faults/sec)", " feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space (Demand Zero Faults/sec)",
nil, nil,
nil, nil,
) )
c.FreeAndZeroPageListBytes = prometheus.NewDesc( c.freeAndZeroPageListBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "free_and_zero_page_list_bytes"), prometheus.BuildFQName(types.Namespace, Name, "free_and_zero_page_list_bytes"),
"The amount of physical memory, in bytes, that is assigned to the free and zero page lists. This memory does not contain cached data. It is immediately"+ "The amount of physical memory, in bytes, that is assigned to the free and zero page lists. This memory does not contain cached data. It is immediately"+
" available for allocation to a process or for system use (FreeAndZeroPageListBytes)", " available for allocation to a process or for system use (FreeAndZeroPageListBytes)",
nil, nil,
nil, nil,
) )
c.FreeSystemPageTableEntries = prometheus.NewDesc( c.freeSystemPageTableEntries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "free_system_page_table_entries"), prometheus.BuildFQName(types.Namespace, Name, "free_system_page_table_entries"),
"(FreeSystemPageTableEntries)", "(FreeSystemPageTableEntries)",
nil, nil,
nil, nil,
) )
c.ModifiedPageListBytes = prometheus.NewDesc( c.modifiedPageListBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "modified_page_list_bytes"), prometheus.BuildFQName(types.Namespace, Name, "modified_page_list_bytes"),
"The amount of physical memory, in bytes, that is assigned to the modified page list. This memory contains cached data and code that is not actively in "+ "The amount of physical memory, in bytes, that is assigned to the modified page list. This memory contains cached data and code that is not actively in "+
"use by processes, the system and the system cache (ModifiedPageListBytes)", "use by processes, the system and the system cache (ModifiedPageListBytes)",
nil, nil,
nil, nil,
) )
c.PageFaultsTotal = prometheus.NewDesc( c.pageFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_faults_total"), prometheus.BuildFQName(types.Namespace, Name, "page_faults_total"),
"Overall rate at which faulted pages are handled by the processor (Page Faults/sec)", "Overall rate at which faulted pages are handled by the processor (Page Faults/sec)",
nil, nil,
nil, nil,
) )
c.SwapPageReadsTotal = prometheus.NewDesc( c.swapPageReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_page_reads_total"), prometheus.BuildFQName(types.Namespace, Name, "swap_page_reads_total"),
"Number of disk page reads (a single read operation reading several pages is still only counted once) (PageReadsPersec)", "Number of disk page reads (a single read operation reading several pages is still only counted once) (PageReadsPersec)",
nil, nil,
nil, nil,
) )
c.SwapPagesReadTotal = prometheus.NewDesc( c.swapPagesReadTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_pages_read_total"), prometheus.BuildFQName(types.Namespace, Name, "swap_pages_read_total"),
"Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) (PagesInputPersec)", "Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) (PagesInputPersec)",
nil, nil,
nil, nil,
) )
c.SwapPagesWrittenTotal = prometheus.NewDesc( c.swapPagesWrittenTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_pages_written_total"), prometheus.BuildFQName(types.Namespace, Name, "swap_pages_written_total"),
"Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) (PagesOutputPersec)", "Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) (PagesOutputPersec)",
nil, nil,
nil, nil,
) )
c.SwapPageOperationsTotal = prometheus.NewDesc( c.swapPageOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_page_operations_total"), prometheus.BuildFQName(types.Namespace, Name, "swap_page_operations_total"),
"Total number of swap page read and writes (PagesPersec)", "Total number of swap page read and writes (PagesPersec)",
nil, nil,
nil, nil,
) )
c.SwapPageWritesTotal = prometheus.NewDesc( c.swapPageWritesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_page_writes_total"), prometheus.BuildFQName(types.Namespace, Name, "swap_page_writes_total"),
"Number of disk page writes (a single write operation writing several pages is still only counted once) (PageWritesPersec)", "Number of disk page writes (a single write operation writing several pages is still only counted once) (PageWritesPersec)",
nil, nil,
nil, nil,
) )
c.PoolNonpagedAllocsTotal = prometheus.NewDesc( c.poolNonPagedAllocationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_nonpaged_allocs_total"), prometheus.BuildFQName(types.Namespace, Name, "pool_nonpaged_allocs_total"),
"The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written"+ "The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written"+
" to disk, and must remain in physical memory as long as they are allocated (PoolNonpagedAllocs)", " to disk, and must remain in physical memory as long as they are allocated (PoolNonpagedAllocs)",
nil, nil,
nil, nil,
) )
c.PoolNonpagedBytes = prometheus.NewDesc( c.poolNonPagedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_nonpaged_bytes"), prometheus.BuildFQName(types.Namespace, Name, "pool_nonpaged_bytes"),
"Number of bytes in the non-paged pool, an area of the system virtual memory that is used for objects that cannot be written to disk, but must "+ "Number of bytes in the non-paged pool, an area of the system virtual memory that is used for objects that cannot be written to disk, but must "+
"remain in physical memory as long as they are allocated (PoolNonpagedBytes)", "remain in physical memory as long as they are allocated (PoolNonpagedBytes)",
nil, nil,
nil, nil,
) )
c.PoolPagedAllocsTotal = prometheus.NewDesc( c.poolPagedAllocationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_allocs_total"), prometheus.BuildFQName(types.Namespace, Name, "pool_paged_allocs_total"),
"Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call (PoolPagedAllocs)", "Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call (PoolPagedAllocs)",
nil, nil,
nil, nil,
) )
c.PoolPagedBytes = prometheus.NewDesc( c.poolPagedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_bytes"), prometheus.BuildFQName(types.Namespace, Name, "pool_paged_bytes"),
"(PoolPagedBytes)", "(PoolPagedBytes)",
nil, nil,
nil, nil,
) )
c.PoolPagedResidentBytes = prometheus.NewDesc( c.poolPagedResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_resident_bytes"), prometheus.BuildFQName(types.Namespace, Name, "pool_paged_resident_bytes"),
"The size, in bytes, of the portion of the paged pool that is currently resident and active in physical memory. The paged pool is an area of the "+ "The size, in bytes, of the portion of the paged pool that is currently resident and active in physical memory. The paged pool is an area of the "+
"system virtual memory that is used for objects that can be written to disk when they are not being used (PoolPagedResidentBytes)", "system virtual memory that is used for objects that can be written to disk when they are not being used (PoolPagedResidentBytes)",
nil, nil,
nil, nil,
) )
c.StandbyCacheCoreBytes = prometheus.NewDesc( c.standbyCacheCoreBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "standby_cache_core_bytes"), prometheus.BuildFQName(types.Namespace, Name, "standby_cache_core_bytes"),
"The amount of physical memory, in bytes, that is assigned to the core standby cache page lists. This memory contains cached data and code that is "+ "The amount of physical memory, in bytes, that is assigned to the core standby cache page lists. This memory contains cached data and code that is "+
"not actively in use by processes, the system and the system cache (StandbyCacheCoreBytes)", "not actively in use by processes, the system and the system cache (StandbyCacheCoreBytes)",
nil, nil,
nil, nil,
) )
c.StandbyCacheNormalPriorityBytes = prometheus.NewDesc( c.standbyCacheNormalPriorityBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "standby_cache_normal_priority_bytes"), prometheus.BuildFQName(types.Namespace, Name, "standby_cache_normal_priority_bytes"),
"The amount of physical memory, in bytes, that is assigned to the normal priority standby cache page lists. This memory contains cached data and "+ "The amount of physical memory, in bytes, that is assigned to the normal priority standby cache page lists. This memory contains cached data and "+
"code that is not actively in use by processes, the system and the system cache (StandbyCacheNormalPriorityBytes)", "code that is not actively in use by processes, the system and the system cache (StandbyCacheNormalPriorityBytes)",
nil, nil,
nil, nil,
) )
c.StandbyCacheReserveBytes = prometheus.NewDesc( c.standbyCacheReserveBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "standby_cache_reserve_bytes"), prometheus.BuildFQName(types.Namespace, Name, "standby_cache_reserve_bytes"),
"The amount of physical memory, in bytes, that is assigned to the reserve standby cache page lists. This memory contains cached data and code "+ "The amount of physical memory, in bytes, that is assigned to the reserve standby cache page lists. This memory contains cached data and code "+
"that is not actively in use by processes, the system and the system cache (StandbyCacheReserveBytes)", "that is not actively in use by processes, the system and the system cache (StandbyCacheReserveBytes)",
nil, nil,
nil, nil,
) )
c.SystemCacheResidentBytes = prometheus.NewDesc( c.systemCacheResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_cache_resident_bytes"), prometheus.BuildFQName(types.Namespace, Name, "system_cache_resident_bytes"),
"The size, in bytes, of the portion of the system file cache which is currently resident and active in physical memory (SystemCacheResidentBytes)", "The size, in bytes, of the portion of the system file cache which is currently resident and active in physical memory (SystemCacheResidentBytes)",
nil, nil,
nil, nil,
) )
c.SystemCodeResidentBytes = prometheus.NewDesc( c.systemCodeResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_code_resident_bytes"), prometheus.BuildFQName(types.Namespace, Name, "system_code_resident_bytes"),
"The size, in bytes, of the pageable operating system code that is currently resident and active in physical memory (SystemCodeResidentBytes)", "The size, in bytes, of the pageable operating system code that is currently resident and active in physical memory (SystemCodeResidentBytes)",
nil, nil,
nil, nil,
) )
c.SystemCodeTotalBytes = prometheus.NewDesc( c.systemCodeTotalBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_code_total_bytes"), prometheus.BuildFQName(types.Namespace, Name, "system_code_total_bytes"),
"The size, in bytes, of the pageable operating system code currently mapped into the system virtual address space (SystemCodeTotalBytes)", "The size, in bytes, of the pageable operating system code currently mapped into the system virtual address space (SystemCodeTotalBytes)",
nil, nil,
nil, nil,
) )
c.SystemDriverResidentBytes = prometheus.NewDesc( c.systemDriverResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_driver_resident_bytes"), prometheus.BuildFQName(types.Namespace, Name, "system_driver_resident_bytes"),
"The size, in bytes, of the pageable physical memory being used by device drivers. It is the working set (physical memory area) of the drivers (SystemDriverResidentBytes)", "The size, in bytes, of the pageable physical memory being used by device drivers. It is the working set (physical memory area) of the drivers (SystemDriverResidentBytes)",
nil, nil,
nil, nil,
) )
c.SystemDriverTotalBytes = prometheus.NewDesc( c.systemDriverTotalBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_driver_total_bytes"), prometheus.BuildFQName(types.Namespace, Name, "system_driver_total_bytes"),
"The size, in bytes, of the pageable virtual memory currently being used by device drivers. Pageable memory can be written to disk when it is not being used (SystemDriverTotalBytes)", "The size, in bytes, of the pageable virtual memory currently being used by device drivers. Pageable memory can be written to disk when it is not being used (SystemDriverTotalBytes)",
nil, nil,
nil, nil,
) )
c.TransitionFaultsTotal = prometheus.NewDesc( c.transitionFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "transition_faults_total"), prometheus.BuildFQName(types.Namespace, Name, "transition_faults_total"),
"Number of faults rate at which page faults are resolved by recovering pages that were being used by another process sharing the page, or were on the "+ "Number of faults rate at which page faults are resolved by recovering pages that were being used by another process sharing the page, or were on the "+
"modified page list or the standby list, or were being written to disk at the time of the page fault (TransitionFaultsPersec)", "modified page list or the standby list, or were being written to disk at the time of the page fault (TransitionFaultsPersec)",
nil, nil,
nil, nil,
) )
c.TransitionPagesRepurposedTotal = prometheus.NewDesc( c.transitionPagesRepurposedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "transition_pages_repurposed_total"), prometheus.BuildFQName(types.Namespace, Name, "transition_pages_repurposed_total"),
"Transition Pages RePurposed is the rate at which the number of transition cache pages were reused for a different purpose (TransitionPagesRePurposedPersec)", "Transition Pages RePurposed is the rate at which the number of transition cache pages were reused for a different purpose (TransitionPagesRePurposedPersec)",
nil, nil,
nil, nil,
) )
c.WriteCopiesTotal = prometheus.NewDesc( c.writeCopiesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_copies_total"), prometheus.BuildFQName(types.Namespace, Name, "write_copies_total"),
"The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory (WriteCopiesPersec)", "The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory (WriteCopiesPersec)",
nil, nil,
@@ -347,193 +347,193 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AvailableBytes, c.availableBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].AvailableBytes, dst[0].AvailableBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CacheBytes, c.cacheBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].CacheBytes, dst[0].CacheBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CacheBytesPeak, c.cacheBytesPeak,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].CacheBytesPeak, dst[0].CacheBytesPeak,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CacheFaultsTotal, c.cacheFaultsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].CacheFaultsPersec, dst[0].CacheFaultsPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CommitLimit, c.commitLimit,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].CommitLimit, dst[0].CommitLimit,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CommittedBytes, c.committedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].CommittedBytes, dst[0].CommittedBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DemandZeroFaultsTotal, c.demandZeroFaultsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].DemandZeroFaultsPersec, dst[0].DemandZeroFaultsPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FreeAndZeroPageListBytes, c.freeAndZeroPageListBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].FreeAndZeroPageListBytes, dst[0].FreeAndZeroPageListBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FreeSystemPageTableEntries, c.freeSystemPageTableEntries,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].FreeSystemPageTableEntries, dst[0].FreeSystemPageTableEntries,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ModifiedPageListBytes, c.modifiedPageListBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].ModifiedPageListBytes, dst[0].ModifiedPageListBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PageFaultsTotal, c.pageFaultsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PageFaultsPersec, dst[0].PageFaultsPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SwapPageReadsTotal, c.swapPageReadsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PageReadsPersec, dst[0].PageReadsPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SwapPagesReadTotal, c.swapPagesReadTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PagesInputPersec, dst[0].PagesInputPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SwapPagesWrittenTotal, c.swapPagesWrittenTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PagesOutputPersec, dst[0].PagesOutputPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SwapPageOperationsTotal, c.swapPageOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PagesPersec, dst[0].PagesPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SwapPageWritesTotal, c.swapPageWritesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PageWritesPersec, dst[0].PageWritesPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolNonpagedAllocsTotal, c.poolNonPagedAllocationsTotal,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].PoolNonpagedAllocs, dst[0].PoolNonpagedAllocs,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolNonpagedBytes, c.poolNonPagedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].PoolNonpagedBytes, dst[0].PoolNonpagedBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolPagedAllocsTotal, c.poolPagedAllocationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PoolPagedAllocs, dst[0].PoolPagedAllocs,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolPagedBytes, c.poolPagedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].PoolPagedBytes, dst[0].PoolPagedBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolPagedResidentBytes, c.poolPagedResidentBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].PoolPagedResidentBytes, dst[0].PoolPagedResidentBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StandbyCacheCoreBytes, c.standbyCacheCoreBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].StandbyCacheCoreBytes, dst[0].StandbyCacheCoreBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StandbyCacheNormalPriorityBytes, c.standbyCacheNormalPriorityBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].StandbyCacheNormalPriorityBytes, dst[0].StandbyCacheNormalPriorityBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StandbyCacheReserveBytes, c.standbyCacheReserveBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].StandbyCacheReserveBytes, dst[0].StandbyCacheReserveBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemCacheResidentBytes, c.systemCacheResidentBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].SystemCacheResidentBytes, dst[0].SystemCacheResidentBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemCodeResidentBytes, c.systemCodeResidentBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].SystemCodeResidentBytes, dst[0].SystemCodeResidentBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemCodeTotalBytes, c.systemCodeTotalBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].SystemCodeTotalBytes, dst[0].SystemCodeTotalBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemDriverResidentBytes, c.systemDriverResidentBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].SystemDriverResidentBytes, dst[0].SystemDriverResidentBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemDriverTotalBytes, c.systemDriverTotalBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].SystemDriverTotalBytes, dst[0].SystemDriverTotalBytes,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TransitionFaultsTotal, c.transitionFaultsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].TransitionFaultsPersec, dst[0].TransitionFaultsPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TransitionPagesRepurposedTotal, c.transitionPagesRepurposedTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].TransitionPagesRePurposedPersec, dst[0].TransitionPagesRePurposedPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteCopiesTotal, c.writeCopiesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].WriteCopiesPersec, dst[0].WriteCopiesPersec,
) )

File diff suppressed because it is too large Load Diff

View File

@@ -18,11 +18,11 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
Characteristics *prometheus.Desc characteristics *prometheus.Desc
Flags *prometheus.Desc flags *prometheus.Desc
Metric *prometheus.Desc metric *prometheus.Desc
Role *prometheus.Desc role *prometheus.Desc
State *prometheus.Desc state *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -53,31 +53,31 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.Characteristics = prometheus.NewDesc( c.characteristics = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "characteristics"), prometheus.BuildFQName(types.Namespace, Name, "characteristics"),
"Provides the characteristics of the network.", "Provides the characteristics of the network.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Flags = prometheus.NewDesc( c.flags = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "flags"), prometheus.BuildFQName(types.Namespace, Name, "flags"),
"Provides access to the flags set for the node. ", "Provides access to the flags set for the node. ",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Metric = prometheus.NewDesc( c.metric = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "metric"), prometheus.BuildFQName(types.Namespace, Name, "metric"),
"The metric of a cluster network (networks with lower values are used first). If this value is set, then the AutoMetric property is set to false.", "The metric of a cluster network (networks with lower values are used first). If this value is set, then the AutoMetric property is set to false.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Role = prometheus.NewDesc( c.role = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "role"), prometheus.BuildFQName(types.Namespace, Name, "role"),
"Provides access to the network's Role property. The Role property describes the role of the network in the cluster. 0: None; 1: Cluster; 2: Client; 3: Both ", "Provides access to the network's Role property. The Role property describes the role of the network in the cluster. 0: None; 1: Cluster; 2: Client; 3: Both ",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.State = prometheus.NewDesc( c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"), prometheus.BuildFQName(types.Namespace, Name, "state"),
"Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up", "Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up",
[]string{"name"}, []string{"name"},
@@ -99,7 +99,7 @@ type MSCluster_Network struct {
} }
// Collect sends the metric values for each metric // Collect sends the metric values for each metric
// to the provided prometheus Metric channel. // to the provided prometheus metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric) error { func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric) error {
var dst []MSCluster_Network var dst []MSCluster_Network
q := wmi.QueryAll(&dst, c.logger) q := wmi.QueryAll(&dst, c.logger)
@@ -109,35 +109,35 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
for _, v := range dst { for _, v := range dst {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Characteristics, c.characteristics,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Characteristics), float64(v.Characteristics),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Flags, c.flags,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Flags), float64(v.Flags),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Metric, c.metric,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Metric), float64(v.Metric),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Role, c.role,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Role), float64(v.Role),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.State, c.state,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.State), float64(v.State),
v.Name, v.Name,

View File

@@ -21,20 +21,20 @@ var NodeName []string
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
BuildNumber *prometheus.Desc buildNumber *prometheus.Desc
Characteristics *prometheus.Desc characteristics *prometheus.Desc
DetectedCloudPlatform *prometheus.Desc detectedCloudPlatform *prometheus.Desc
DynamicWeight *prometheus.Desc dynamicWeight *prometheus.Desc
Flags *prometheus.Desc flags *prometheus.Desc
MajorVersion *prometheus.Desc majorVersion *prometheus.Desc
MinorVersion *prometheus.Desc minorVersion *prometheus.Desc
NeedsPreventQuorum *prometheus.Desc needsPreventQuorum *prometheus.Desc
NodeDrainStatus *prometheus.Desc nodeDrainStatus *prometheus.Desc
NodeHighestVersion *prometheus.Desc nodeHighestVersion *prometheus.Desc
NodeLowestVersion *prometheus.Desc nodeLowestVersion *prometheus.Desc
NodeWeight *prometheus.Desc nodeWeight *prometheus.Desc
State *prometheus.Desc state *prometheus.Desc
StatusInformation *prometheus.Desc statusInformation *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -65,85 +65,85 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.BuildNumber = prometheus.NewDesc( c.buildNumber = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "build_number"), prometheus.BuildFQName(types.Namespace, Name, "build_number"),
"Provides access to the node's BuildNumber property.", "Provides access to the node's BuildNumber property.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Characteristics = prometheus.NewDesc( c.characteristics = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "characteristics"), prometheus.BuildFQName(types.Namespace, Name, "characteristics"),
"Provides access to the characteristics set for the node.", "Provides access to the characteristics set for the node.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.DetectedCloudPlatform = prometheus.NewDesc( c.detectedCloudPlatform = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "detected_cloud_platform"), prometheus.BuildFQName(types.Namespace, Name, "detected_cloud_platform"),
"(DetectedCloudPlatform)", "(DetectedCloudPlatform)",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.DynamicWeight = prometheus.NewDesc( c.dynamicWeight = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_weight"), prometheus.BuildFQName(types.Namespace, Name, "dynamic_weight"),
"The dynamic vote weight of the node adjusted by dynamic quorum feature.", "The dynamic vote weight of the node adjusted by dynamic quorum feature.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Flags = prometheus.NewDesc( c.flags = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "flags"), prometheus.BuildFQName(types.Namespace, Name, "flags"),
"Provides access to the flags set for the node.", "Provides access to the flags set for the node.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.MajorVersion = prometheus.NewDesc( c.majorVersion = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "major_version"), prometheus.BuildFQName(types.Namespace, Name, "major_version"),
"Provides access to the node's MajorVersion property, which specifies the major portion of the Windows version installed.", "Provides access to the node's MajorVersion property, which specifies the major portion of the Windows version installed.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.MinorVersion = prometheus.NewDesc( c.minorVersion = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "minor_version"), prometheus.BuildFQName(types.Namespace, Name, "minor_version"),
"Provides access to the node's MinorVersion property, which specifies the minor portion of the Windows version installed.", "Provides access to the node's MinorVersion property, which specifies the minor portion of the Windows version installed.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.NeedsPreventQuorum = prometheus.NewDesc( c.needsPreventQuorum = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "needs_prevent_quorum"), prometheus.BuildFQName(types.Namespace, Name, "needs_prevent_quorum"),
"Whether the cluster service on that node should be started with prevent quorum flag.", "Whether the cluster service on that node should be started with prevent quorum flag.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.NodeDrainStatus = prometheus.NewDesc( c.nodeDrainStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "node_drain_status"), prometheus.BuildFQName(types.Namespace, Name, "node_drain_status"),
"The current node drain status of a node. 0: Not Initiated; 1: In Progress; 2: Completed; 3: Failed", "The current node drain status of a node. 0: Not Initiated; 1: In Progress; 2: Completed; 3: Failed",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.NodeHighestVersion = prometheus.NewDesc( c.nodeHighestVersion = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "node_highest_version"), prometheus.BuildFQName(types.Namespace, Name, "node_highest_version"),
"Provides access to the node's NodeHighestVersion property, which specifies the highest possible version of the cluster service with which the node can join or communicate.", "Provides access to the node's NodeHighestVersion property, which specifies the highest possible version of the cluster service with which the node can join or communicate.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.NodeLowestVersion = prometheus.NewDesc( c.nodeLowestVersion = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "node_lowest_version"), prometheus.BuildFQName(types.Namespace, Name, "node_lowest_version"),
"Provides access to the node's NodeLowestVersion property, which specifies the lowest possible version of the cluster service with which the node can join or communicate.", "Provides access to the node's NodeLowestVersion property, which specifies the lowest possible version of the cluster service with which the node can join or communicate.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.NodeWeight = prometheus.NewDesc( c.nodeWeight = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "node_weight"), prometheus.BuildFQName(types.Namespace, Name, "node_weight"),
"The vote weight of the node.", "The vote weight of the node.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.State = prometheus.NewDesc( c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"), prometheus.BuildFQName(types.Namespace, Name, "state"),
"Returns the current state of a node. -1: Unknown; 0: Up; 1: Down; 2: Paused; 3: Joining", "Returns the current state of a node. -1: Unknown; 0: Up; 1: Down; 2: Paused; 3: Joining",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.StatusInformation = prometheus.NewDesc( c.statusInformation = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "status_information"), prometheus.BuildFQName(types.Namespace, Name, "status_information"),
"The isolation or quarantine status of the node.", "The isolation or quarantine status of the node.",
[]string{"name"}, []string{"name"},
@@ -186,98 +186,98 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
for _, v := range dst { for _, v := range dst {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BuildNumber, c.buildNumber,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.BuildNumber), float64(v.BuildNumber),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Characteristics, c.characteristics,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Characteristics), float64(v.Characteristics),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DetectedCloudPlatform, c.detectedCloudPlatform,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.DetectedCloudPlatform), float64(v.DetectedCloudPlatform),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DynamicWeight, c.dynamicWeight,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.DynamicWeight), float64(v.DynamicWeight),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Flags, c.flags,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Flags), float64(v.Flags),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MajorVersion, c.majorVersion,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.MajorVersion), float64(v.MajorVersion),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MinorVersion, c.minorVersion,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.MinorVersion), float64(v.MinorVersion),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NeedsPreventQuorum, c.needsPreventQuorum,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.NeedsPreventQuorum), float64(v.NeedsPreventQuorum),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NodeDrainStatus, c.nodeDrainStatus,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.NodeDrainStatus), float64(v.NodeDrainStatus),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NodeHighestVersion, c.nodeHighestVersion,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.NodeHighestVersion), float64(v.NodeHighestVersion),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NodeLowestVersion, c.nodeLowestVersion,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.NodeLowestVersion), float64(v.NodeLowestVersion),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NodeWeight, c.nodeWeight,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.NodeWeight), float64(v.NodeWeight),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.State, c.state,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.State), float64(v.State),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StatusInformation, c.statusInformation,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.StatusInformation), float64(v.StatusInformation),
v.Name, v.Name,

View File

@@ -19,23 +19,23 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
Characteristics *prometheus.Desc characteristics *prometheus.Desc
DeadlockTimeout *prometheus.Desc deadlockTimeout *prometheus.Desc
EmbeddedFailureAction *prometheus.Desc embeddedFailureAction *prometheus.Desc
Flags *prometheus.Desc flags *prometheus.Desc
IsAlivePollInterval *prometheus.Desc isAlivePollInterval *prometheus.Desc
LooksAlivePollInterval *prometheus.Desc looksAlivePollInterval *prometheus.Desc
MonitorProcessId *prometheus.Desc monitorProcessId *prometheus.Desc
OwnerNode *prometheus.Desc ownerNode *prometheus.Desc
PendingTimeout *prometheus.Desc pendingTimeout *prometheus.Desc
ResourceClass *prometheus.Desc resourceClass *prometheus.Desc
RestartAction *prometheus.Desc restartAction *prometheus.Desc
RestartDelay *prometheus.Desc restartDelay *prometheus.Desc
RestartPeriod *prometheus.Desc restartPeriod *prometheus.Desc
RestartThreshold *prometheus.Desc restartThreshold *prometheus.Desc
RetryPeriodOnFailure *prometheus.Desc retryPeriodOnFailure *prometheus.Desc
State *prometheus.Desc state *prometheus.Desc
Subclass *prometheus.Desc subclass *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -66,109 +66,109 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.Characteristics = prometheus.NewDesc( c.characteristics = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "characteristics"), prometheus.BuildFQName(types.Namespace, Name, "characteristics"),
"Provides the characteristics of the object.", "Provides the characteristics of the object.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.DeadlockTimeout = prometheus.NewDesc( c.deadlockTimeout = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "deadlock_timeout"), prometheus.BuildFQName(types.Namespace, Name, "deadlock_timeout"),
"Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource.", "Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.EmbeddedFailureAction = prometheus.NewDesc( c.embeddedFailureAction = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "embedded_failure_action"), prometheus.BuildFQName(types.Namespace, Name, "embedded_failure_action"),
"The time, in milliseconds, that a resource should remain in a failed state before the Cluster service attempts to restart it.", "The time, in milliseconds, that a resource should remain in a failed state before the Cluster service attempts to restart it.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.Flags = prometheus.NewDesc( c.flags = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "flags"), prometheus.BuildFQName(types.Namespace, Name, "flags"),
"Provides access to the flags set for the object.", "Provides access to the flags set for the object.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.IsAlivePollInterval = prometheus.NewDesc( c.isAlivePollInterval = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "is_alive_poll_interval"), prometheus.BuildFQName(types.Namespace, Name, "is_alive_poll_interval"),
"Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it is operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the IsAlivePollInterval property for the resource type associated with the resource.", "Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it is operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the IsAlivePollInterval property for the resource type associated with the resource.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.LooksAlivePollInterval = prometheus.NewDesc( c.looksAlivePollInterval = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "looks_alive_poll_interval"), prometheus.BuildFQName(types.Namespace, Name, "looks_alive_poll_interval"),
"Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it appears operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the LooksAlivePollInterval property for the resource type associated with the resource.", "Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it appears operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the LooksAlivePollInterval property for the resource type associated with the resource.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.MonitorProcessId = prometheus.NewDesc( c.monitorProcessId = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "monitor_process_id"), prometheus.BuildFQName(types.Namespace, Name, "monitor_process_id"),
"Provides the process ID of the resource host service that is currently hosting the resource.", "Provides the process ID of the resource host service that is currently hosting the resource.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.OwnerNode = prometheus.NewDesc( c.ownerNode = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "owner_node"), prometheus.BuildFQName(types.Namespace, Name, "owner_node"),
"The node hosting the resource. 0: Not hosted; 1: Hosted", "The node hosting the resource. 0: Not hosted; 1: Hosted",
[]string{"type", "owner_group", "node_name", "name"}, []string{"type", "owner_group", "node_name", "name"},
nil, nil,
) )
c.OwnerNode = prometheus.NewDesc( c.ownerNode = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "owner_node"), prometheus.BuildFQName(types.Namespace, Name, "owner_node"),
"The node hosting the resource. 0: Not hosted; 1: Hosted", "The node hosting the resource. 0: Not hosted; 1: Hosted",
[]string{"type", "owner_group", "node_name", "name"}, []string{"type", "owner_group", "node_name", "name"},
nil, nil,
) )
c.PendingTimeout = prometheus.NewDesc( c.pendingTimeout = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pending_timeout"), prometheus.BuildFQName(types.Namespace, Name, "pending_timeout"),
"Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of milliseconds specified by the PendingTimeout property, the resource is forcibly terminated.", "Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of milliseconds specified by the PendingTimeout property, the resource is forcibly terminated.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.ResourceClass = prometheus.NewDesc( c.resourceClass = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "resource_class"), prometheus.BuildFQName(types.Namespace, Name, "resource_class"),
"Gets or sets the resource class of a resource. 0: Unknown; 1: Storage; 2: Network; 32768: Unknown ", "Gets or sets the resource class of a resource. 0: Unknown; 1: Storage; 2: Network; 32768: Unknown ",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.RestartAction = prometheus.NewDesc( c.restartAction = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "restart_action"), prometheus.BuildFQName(types.Namespace, Name, "restart_action"),
"Provides access to the resource's RestartAction property, which is the action to be taken by the Cluster Service if the resource fails.", "Provides access to the resource's RestartAction property, which is the action to be taken by the Cluster Service if the resource fails.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.RestartDelay = prometheus.NewDesc( c.restartDelay = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "restart_delay"), prometheus.BuildFQName(types.Namespace, Name, "restart_delay"),
"Indicates the time delay before a failed resource is restarted.", "Indicates the time delay before a failed resource is restarted.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.RestartPeriod = prometheus.NewDesc( c.restartPeriod = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "restart_period"), prometheus.BuildFQName(types.Namespace, Name, "restart_period"),
"Provides access to the resource's RestartPeriod property, which is interval of time, in milliseconds, during which a specified number of restart attempts can be made on a nonresponsive resource.", "Provides access to the resource's RestartPeriod property, which is interval of time, in milliseconds, during which a specified number of restart attempts can be made on a nonresponsive resource.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.RestartThreshold = prometheus.NewDesc( c.restartThreshold = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "restart_threshold"), prometheus.BuildFQName(types.Namespace, Name, "restart_threshold"),
"Provides access to the resource's RestartThreshold property which is the maximum number of restart attempts that can be made on a resource within an interval defined by the RestartPeriod property before the Cluster Service initiates the action specified by the RestartAction property.", "Provides access to the resource's RestartThreshold property which is the maximum number of restart attempts that can be made on a resource within an interval defined by the RestartPeriod property before the Cluster Service initiates the action specified by the RestartAction property.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.RetryPeriodOnFailure = prometheus.NewDesc( c.retryPeriodOnFailure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "retry_period_on_failure"), prometheus.BuildFQName(types.Namespace, Name, "retry_period_on_failure"),
"Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in milliseconds) that a resource should remain in a failed state before the Cluster service attempts to restart it.", "Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in milliseconds) that a resource should remain in a failed state before the Cluster service attempts to restart it.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.State = prometheus.NewDesc( c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"), prometheus.BuildFQName(types.Namespace, Name, "state"),
"The current state of the resource. -1: Unknown; 0: Inherited; 1: Initializing; 2: Online; 3: Offline; 4: Failed; 128: Pending; 129: Online Pending; 130: Offline Pending ", "The current state of the resource. -1: Unknown; 0: Inherited; 1: Initializing; 2: Online; 3: Offline; 4: Failed; 128: Pending; 129: Online Pending; 130: Offline Pending ",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
nil, nil,
) )
c.Subclass = prometheus.NewDesc( c.subclass = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "subclass"), prometheus.BuildFQName(types.Namespace, Name, "subclass"),
"Provides the list of references to nodes that can be the owner of this resource.", "Provides the list of references to nodes that can be the owner of this resource.",
[]string{"type", "owner_group", "name"}, []string{"type", "owner_group", "name"},
@@ -214,49 +214,49 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
for _, v := range dst { for _, v := range dst {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Characteristics, c.characteristics,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Characteristics), float64(v.Characteristics),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DeadlockTimeout, c.deadlockTimeout,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.DeadlockTimeout), float64(v.DeadlockTimeout),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.EmbeddedFailureAction, c.embeddedFailureAction,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.EmbeddedFailureAction), float64(v.EmbeddedFailureAction),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Flags, c.flags,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Flags), float64(v.Flags),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IsAlivePollInterval, c.isAlivePollInterval,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.IsAlivePollInterval), float64(v.IsAlivePollInterval),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LooksAlivePollInterval, c.looksAlivePollInterval,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.LooksAlivePollInterval), float64(v.LooksAlivePollInterval),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MonitorProcessId, c.monitorProcessId,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.MonitorProcessId), float64(v.MonitorProcessId),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
@@ -269,7 +269,7 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
isCurrentState = 1.0 isCurrentState = 1.0
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OwnerNode, c.ownerNode,
prometheus.GaugeValue, prometheus.GaugeValue,
isCurrentState, isCurrentState,
v.Type, v.OwnerGroup, node_name, v.Name, v.Type, v.OwnerGroup, node_name, v.Name,
@@ -278,63 +278,63 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PendingTimeout, c.pendingTimeout,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.PendingTimeout), float64(v.PendingTimeout),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ResourceClass, c.resourceClass,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.ResourceClass), float64(v.ResourceClass),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RestartAction, c.restartAction,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.RestartAction), float64(v.RestartAction),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RestartDelay, c.restartDelay,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.RestartDelay), float64(v.RestartDelay),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RestartPeriod, c.restartPeriod,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.RestartPeriod), float64(v.RestartPeriod),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RestartThreshold, c.restartThreshold,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.RestartThreshold), float64(v.RestartThreshold),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RetryPeriodOnFailure, c.retryPeriodOnFailure,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.RetryPeriodOnFailure), float64(v.RetryPeriodOnFailure),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.State, c.state,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.State), float64(v.State),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Subclass, c.subclass,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Subclass), float64(v.Subclass),
v.Type, v.OwnerGroup, v.Name, v.Type, v.OwnerGroup, v.Name,

View File

@@ -19,22 +19,20 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
AutoFailbackType *prometheus.Desc autoFailbackType *prometheus.Desc
Characteristics *prometheus.Desc characteristics *prometheus.Desc
ColdStartSetting *prometheus.Desc coldStartSetting *prometheus.Desc
DefaultOwner *prometheus.Desc defaultOwner *prometheus.Desc
FailbackWindowEnd *prometheus.Desc failbackWindowEnd *prometheus.Desc
FailbackWindowStart *prometheus.Desc failbackWindowStart *prometheus.Desc
FailoverPeriod *prometheus.Desc failOverPeriod *prometheus.Desc
FailoverThreshold *prometheus.Desc failOverThreshold *prometheus.Desc
FaultDomain *prometheus.Desc flags *prometheus.Desc
Flags *prometheus.Desc groupType *prometheus.Desc
GroupType *prometheus.Desc ownerNode *prometheus.Desc
PlacementOptions *prometheus.Desc priority *prometheus.Desc
OwnerNode *prometheus.Desc resiliencyPeriod *prometheus.Desc
Priority *prometheus.Desc state *prometheus.Desc
ResiliencyPeriod *prometheus.Desc
State *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -65,91 +63,91 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.AutoFailbackType = prometheus.NewDesc( c.autoFailbackType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "auto_failback_type"), prometheus.BuildFQName(types.Namespace, Name, "auto_failback_type"),
"Provides access to the group's AutoFailbackType property.", "Provides access to the group's AutoFailbackType property.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Characteristics = prometheus.NewDesc( c.characteristics = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "characteristics"), prometheus.BuildFQName(types.Namespace, Name, "characteristics"),
"Provides the characteristics of the group.", "Provides the characteristics of the group.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.ColdStartSetting = prometheus.NewDesc( c.coldStartSetting = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cold_start_setting"), prometheus.BuildFQName(types.Namespace, Name, "cold_start_setting"),
"Indicates whether a group can start after a cluster cold start.", "Indicates whether a group can start after a cluster cold start.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.DefaultOwner = prometheus.NewDesc( c.defaultOwner = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "default_owner"), prometheus.BuildFQName(types.Namespace, Name, "default_owner"),
"Number of the last node the resource group was activated on or explicitly moved to.", "Number of the last node the resource group was activated on or explicitly moved to.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.FailbackWindowEnd = prometheus.NewDesc( c.failbackWindowEnd = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failback_window_end"), prometheus.BuildFQName(types.Namespace, Name, "failback_window_end"),
"The FailbackWindowEnd property provides the latest time that the group can be moved back to the node identified as its preferred node.", "The FailbackWindowEnd property provides the latest time that the group can be moved back to the node identified as its preferred node.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.FailbackWindowStart = prometheus.NewDesc( c.failbackWindowStart = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failback_window_start"), prometheus.BuildFQName(types.Namespace, Name, "failback_window_start"),
"The FailbackWindowStart property provides the earliest time (that is, local time as kept by the cluster) that the group can be moved back to the node identified as its preferred node.", "The FailbackWindowStart property provides the earliest time (that is, local time as kept by the cluster) that the group can be moved back to the node identified as its preferred node.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.FailoverPeriod = prometheus.NewDesc( c.failOverPeriod = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_period"), prometheus.BuildFQName(types.Namespace, Name, "failover_period"),
"The FailoverPeriod property specifies a number of hours during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur.", "The FailoverPeriod property specifies a number of hours during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.FailoverThreshold = prometheus.NewDesc( c.failOverThreshold = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_threshold"), prometheus.BuildFQName(types.Namespace, Name, "failover_threshold"),
"The FailoverThreshold property specifies the maximum number of failover attempts.", "The FailoverThreshold property specifies the maximum number of failover attempts.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.Flags = prometheus.NewDesc( c.flags = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "flags"), prometheus.BuildFQName(types.Namespace, Name, "flags"),
"Provides access to the flags set for the group. ", "Provides access to the flags set for the group. ",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.GroupType = prometheus.NewDesc( c.groupType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "group_type"), prometheus.BuildFQName(types.Namespace, Name, "group_type"),
"The Type of the resource group.", "The Type of the resource group.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.OwnerNode = prometheus.NewDesc( c.ownerNode = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "owner_node"), prometheus.BuildFQName(types.Namespace, Name, "owner_node"),
"The node hosting the resource group. 0: Not hosted; 1: Hosted", "The node hosting the resource group. 0: Not hosted; 1: Hosted",
[]string{"node_name", "name"}, []string{"node_name", "name"},
nil, nil,
) )
c.OwnerNode = prometheus.NewDesc( c.ownerNode = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "owner_node"), prometheus.BuildFQName(types.Namespace, Name, "owner_node"),
"The node hosting the resource group. 0: Not hosted; 1: Hosted", "The node hosting the resource group. 0: Not hosted; 1: Hosted",
[]string{"node_name", "name"}, []string{"node_name", "name"},
nil, nil,
) )
c.Priority = prometheus.NewDesc( c.priority = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "priority"), prometheus.BuildFQName(types.Namespace, Name, "priority"),
"Priority value of the resource group", "Priority value of the resource group",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.ResiliencyPeriod = prometheus.NewDesc( c.resiliencyPeriod = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "resiliency_period"), prometheus.BuildFQName(types.Namespace, Name, "resiliency_period"),
"The resiliency period for this group, in seconds.", "The resiliency period for this group, in seconds.",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.State = prometheus.NewDesc( c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"), prometheus.BuildFQName(types.Namespace, Name, "state"),
"The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending", "The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending",
[]string{"name"}, []string{"name"},
@@ -190,70 +188,70 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
for _, v := range dst { for _, v := range dst {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AutoFailbackType, c.autoFailbackType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.AutoFailbackType), float64(v.AutoFailbackType),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Characteristics, c.characteristics,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Characteristics), float64(v.Characteristics),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ColdStartSetting, c.coldStartSetting,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.ColdStartSetting), float64(v.ColdStartSetting),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DefaultOwner, c.defaultOwner,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.DefaultOwner), float64(v.DefaultOwner),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailbackWindowEnd, c.failbackWindowEnd,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.FailbackWindowEnd), float64(v.FailbackWindowEnd),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailbackWindowStart, c.failbackWindowStart,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.FailbackWindowStart), float64(v.FailbackWindowStart),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverPeriod, c.failOverPeriod,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.FailoverPeriod), float64(v.FailoverPeriod),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FailoverThreshold, c.failOverThreshold,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.FailoverThreshold), float64(v.FailoverThreshold),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Flags, c.flags,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Flags), float64(v.Flags),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.GroupType, c.groupType,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.GroupType), float64(v.GroupType),
v.Name, v.Name,
@@ -266,7 +264,7 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
isCurrentState = 1.0 isCurrentState = 1.0
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OwnerNode, c.ownerNode,
prometheus.GaugeValue, prometheus.GaugeValue,
isCurrentState, isCurrentState,
node_name, v.Name, node_name, v.Name,
@@ -275,21 +273,21 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Priority, c.priority,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.Priority), float64(v.Priority),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ResiliencyPeriod, c.resiliencyPeriod,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.ResiliencyPeriod), float64(v.ResiliencyPeriod),
v.Name, v.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.State, c.state,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(v.State), float64(v.State),
v.Name, v.Name,

View File

@@ -30,10 +30,10 @@ type Collector struct {
queryWhereClause *string queryWhereClause *string
BytesinJournalQueue *prometheus.Desc bytesInJournalQueue *prometheus.Desc
BytesinQueue *prometheus.Desc bytesInQueue *prometheus.Desc
MessagesinJournalQueue *prometheus.Desc messagesInJournalQueue *prometheus.Desc
MessagesinQueue *prometheus.Desc messagesInQueue *prometheus.Desc
} }
func New(logger log.Logger, config *Config) *Collector { func New(logger log.Logger, config *Config) *Collector {
@@ -78,25 +78,25 @@ func (c *Collector) Build() error {
_ = level.Warn(c.logger).Log("msg", "No where-clause specified for msmq collector. This will generate a very large number of metrics!") _ = level.Warn(c.logger).Log("msg", "No where-clause specified for msmq collector. This will generate a very large number of metrics!")
} }
c.BytesinJournalQueue = prometheus.NewDesc( c.bytesInJournalQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_in_journal_queue"), prometheus.BuildFQName(types.Namespace, Name, "bytes_in_journal_queue"),
"Size of queue journal in bytes", "Size of queue journal in bytes",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.BytesinQueue = prometheus.NewDesc( c.bytesInQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_in_queue"), prometheus.BuildFQName(types.Namespace, Name, "bytes_in_queue"),
"Size of queue in bytes", "Size of queue in bytes",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.MessagesinJournalQueue = prometheus.NewDesc( c.messagesInJournalQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_in_journal_queue"), prometheus.BuildFQName(types.Namespace, Name, "messages_in_journal_queue"),
"Count messages in queue journal", "Count messages in queue journal",
[]string{"name"}, []string{"name"},
nil, nil,
) )
c.MessagesinQueue = prometheus.NewDesc( c.messagesInQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_in_queue"), prometheus.BuildFQName(types.Namespace, Name, "messages_in_queue"),
"Count messages in queue", "Count messages in queue",
[]string{"name"}, []string{"name"},
@@ -133,28 +133,28 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
for _, msmq := range dst { for _, msmq := range dst {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesinJournalQueue, c.bytesInJournalQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(msmq.BytesinJournalQueue), float64(msmq.BytesinJournalQueue),
strings.ToLower(msmq.Name), strings.ToLower(msmq.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesinQueue, c.bytesInQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(msmq.BytesinQueue), float64(msmq.BytesinQueue),
strings.ToLower(msmq.Name), strings.ToLower(msmq.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesinJournalQueue, c.messagesInJournalQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(msmq.MessagesinJournalQueue), float64(msmq.MessagesinJournalQueue),
strings.ToLower(msmq.Name), strings.ToLower(msmq.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesinQueue, c.messagesInQueue,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(msmq.MessagesinQueue), float64(msmq.MessagesinQueue),
strings.ToLower(msmq.Name), strings.ToLower(msmq.Name),

File diff suppressed because it is too large Load Diff

View File

@@ -35,19 +35,19 @@ type Collector struct {
nicInclude *string nicInclude *string
nicExclude *string nicExclude *string
BytesReceivedTotal *prometheus.Desc bytesReceivedTotal *prometheus.Desc
BytesSentTotal *prometheus.Desc bytesSentTotal *prometheus.Desc
BytesTotal *prometheus.Desc bytesTotal *prometheus.Desc
OutputQueueLength *prometheus.Desc outputQueueLength *prometheus.Desc
PacketsOutboundDiscarded *prometheus.Desc packetsOutboundDiscarded *prometheus.Desc
PacketsOutboundErrors *prometheus.Desc packetsOutboundErrors *prometheus.Desc
PacketsTotal *prometheus.Desc packetsTotal *prometheus.Desc
PacketsReceivedDiscarded *prometheus.Desc packetsReceivedDiscarded *prometheus.Desc
PacketsReceivedErrors *prometheus.Desc packetsReceivedErrors *prometheus.Desc
PacketsReceivedTotal *prometheus.Desc packetsReceivedTotal *prometheus.Desc
PacketsReceivedUnknown *prometheus.Desc packetsReceivedUnknown *prometheus.Desc
PacketsSentTotal *prometheus.Desc packetsSentTotal *prometheus.Desc
CurrentBandwidth *prometheus.Desc currentBandwidth *prometheus.Desc
nicIncludePattern *regexp.Regexp nicIncludePattern *regexp.Regexp
nicExcludePattern *regexp.Regexp nicExcludePattern *regexp.Regexp
@@ -100,79 +100,79 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.BytesReceivedTotal = prometheus.NewDesc( c.bytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"),
"(Network.BytesReceivedPerSec)", "(Network.BytesReceivedPerSec)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.BytesSentTotal = prometheus.NewDesc( c.bytesSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"),
"(Network.BytesSentPerSec)", "(Network.BytesSentPerSec)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.BytesTotal = prometheus.NewDesc( c.bytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_total"),
"(Network.BytesTotalPerSec)", "(Network.BytesTotalPerSec)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.OutputQueueLength = prometheus.NewDesc( c.outputQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "output_queue_length_packets"), prometheus.BuildFQName(types.Namespace, Name, "output_queue_length_packets"),
"(Network.OutputQueueLength)", "(Network.OutputQueueLength)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsOutboundDiscarded = prometheus.NewDesc( c.packetsOutboundDiscarded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_outbound_discarded_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_outbound_discarded_total"),
"(Network.PacketsOutboundDiscarded)", "(Network.PacketsOutboundDiscarded)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsOutboundErrors = prometheus.NewDesc( c.packetsOutboundErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_outbound_errors_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_outbound_errors_total"),
"(Network.PacketsOutboundErrors)", "(Network.PacketsOutboundErrors)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsReceivedDiscarded = prometheus.NewDesc( c.packetsReceivedDiscarded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_discarded_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_received_discarded_total"),
"(Network.PacketsReceivedDiscarded)", "(Network.PacketsReceivedDiscarded)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsReceivedErrors = prometheus.NewDesc( c.packetsReceivedErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_errors_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_received_errors_total"),
"(Network.PacketsReceivedErrors)", "(Network.PacketsReceivedErrors)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsReceivedTotal = prometheus.NewDesc( c.packetsReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
"(Network.PacketsReceivedPerSec)", "(Network.PacketsReceivedPerSec)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsReceivedUnknown = prometheus.NewDesc( c.packetsReceivedUnknown = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_unknown_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_received_unknown_total"),
"(Network.PacketsReceivedUnknown)", "(Network.PacketsReceivedUnknown)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsTotal = prometheus.NewDesc( c.packetsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_total"),
"(Network.PacketsPerSec)", "(Network.PacketsPerSec)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.PacketsSentTotal = prometheus.NewDesc( c.packetsSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_sent_total"),
"(Network.PacketsSentPerSec)", "(Network.PacketsSentPerSec)",
[]string{"nic"}, []string{"nic"},
nil, nil,
) )
c.CurrentBandwidth = prometheus.NewDesc( c.currentBandwidth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_bandwidth_bytes"), prometheus.BuildFQName(types.Namespace, Name, "current_bandwidth_bytes"),
"(Network.CurrentBandwidth)", "(Network.CurrentBandwidth)",
[]string{"nic"}, []string{"nic"},
@@ -248,83 +248,84 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
// Counters // Counters
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesReceivedTotal, c.bytesReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
nic.BytesReceivedPerSec, nic.BytesReceivedPerSec,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesSentTotal, c.bytesSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
nic.BytesSentPerSec, nic.BytesSentPerSec,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesTotal, c.bytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
nic.BytesTotalPerSec, nic.BytesTotalPerSec,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OutputQueueLength, c.outputQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
nic.OutputQueueLength, nic.OutputQueueLength,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsOutboundDiscarded, c.packetsOutboundDiscarded,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsOutboundDiscarded, nic.PacketsOutboundDiscarded,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsOutboundErrors, c.packetsOutboundErrors,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsOutboundErrors, nic.PacketsOutboundErrors,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsTotal, c.packetsTotal,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsPerSec, nic.PacketsPerSec,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceivedDiscarded, c.packetsReceivedDiscarded,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsReceivedDiscarded, nic.PacketsReceivedDiscarded,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceivedErrors, c.packetsReceivedErrors,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsReceivedErrors, nic.PacketsReceivedErrors,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceivedTotal, c.packetsReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsReceivedPerSec, nic.PacketsReceivedPerSec,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceivedUnknown, c.packetsReceivedUnknown,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsReceivedUnknown, nic.PacketsReceivedUnknown,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsSentTotal, c.packetsSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
nic.PacketsSentPerSec, nic.PacketsSentPerSec,
name, name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentBandwidth, c.currentBandwidth,
prometheus.GaugeValue, prometheus.GaugeValue,
nic.CurrentBandwidth/8, nic.CurrentBandwidth/8,
name, name,
) )
} }
return nil return nil
} }