mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-06 18:46:36 +00:00
process: Use registry collector for V1 data (#1814)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dfsr
|
||||
|
||||
const (
|
||||
// Connection Perflib: "DFS Replication Service Connections".
|
||||
bytesReceivedTotal = "Total Bytes Received"
|
||||
|
||||
// Folder Perflib: "DFS Replicated Folder".
|
||||
bandwidthSavingsUsingDFSReplicationTotal = "Bandwidth Savings Using DFS Replication"
|
||||
compressedSizeOfFilesReceivedTotal = "Compressed Size of Files Received"
|
||||
conflictBytesCleanedUpTotal = "Conflict Bytes Cleaned Up"
|
||||
conflictBytesGeneratedTotal = "Conflict Bytes Generated"
|
||||
conflictFilesCleanedUpTotal = "Conflict Files Cleaned Up"
|
||||
conflictFilesGeneratedTotal = "Conflict Files Generated"
|
||||
conflictFolderCleanupsCompletedTotal = "Conflict folder Cleanups Completed"
|
||||
conflictSpaceInUse = "Conflict Space In Use"
|
||||
deletedSpaceInUse = "Deleted Space In Use"
|
||||
deletedBytesCleanedUpTotal = "Deleted Bytes Cleaned Up"
|
||||
deletedBytesGeneratedTotal = "Deleted Bytes Generated"
|
||||
deletedFilesCleanedUpTotal = "Deleted Files Cleaned Up"
|
||||
deletedFilesGeneratedTotal = "Deleted Files Generated"
|
||||
fileInstallsRetriedTotal = "File Installs Retried"
|
||||
fileInstallsSucceededTotal = "File Installs Succeeded"
|
||||
filesReceivedTotal = "Total Files Received"
|
||||
rdcBytesReceivedTotal = "RDC Bytes Received"
|
||||
rdcCompressedSizeOfFilesReceivedTotal = "RDC Compressed Size of Files Received"
|
||||
rdcNumberOfFilesReceivedTotal = "RDC Number of Files Received"
|
||||
rdcSizeOfFilesReceivedTotal = "RDC Size of Files Received"
|
||||
sizeOfFilesReceivedTotal = "Size of Files Received"
|
||||
stagingSpaceInUse = "Staging Space In Use"
|
||||
stagingBytesCleanedUpTotal = "Staging Bytes Cleaned Up"
|
||||
stagingBytesGeneratedTotal = "Staging Bytes Generated"
|
||||
stagingFilesCleanedUpTotal = "Staging Files Cleaned Up"
|
||||
stagingFilesGeneratedTotal = "Staging Files Generated"
|
||||
updatesDroppedTotal = "Updates Dropped"
|
||||
|
||||
// Volume Perflib: "DFS Replication Service Volumes".
|
||||
databaseCommitsTotal = "Database Commits"
|
||||
databaseLookupsTotal = "Database Lookups"
|
||||
usnJournalRecordsReadTotal = "USN Journal Records Read"
|
||||
usnJournalRecordsAcceptedTotal = "USN Journal Records Accepted"
|
||||
usnJournalUnreadPercentage = "USN Journal Unread Percentage"
|
||||
)
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/pdh"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@@ -44,9 +44,12 @@ var ConfigDefaults = Config{
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollectorConnection *perfdata.Collector
|
||||
perfDataCollectorFolder *perfdata.Collector
|
||||
perfDataCollectorVolume *perfdata.Collector
|
||||
perfDataCollectorConnection *pdh.Collector
|
||||
perfDataCollectorFolder *pdh.Collector
|
||||
perfDataCollectorVolume *pdh.Collector
|
||||
perfDataObjectConnection []perfDataCounterValuesConnection
|
||||
perfDataObjectFolder []perfDataCounterValuesFolder
|
||||
perfDataObjectVolume []perfDataCounterValuesVolume
|
||||
|
||||
// connection source
|
||||
connectionBandwidthSavingsUsingDFSReplicationTotal *prometheus.Desc
|
||||
@@ -160,69 +163,26 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "connection") {
|
||||
c.perfDataCollectorConnection, err = perfdata.NewCollector("DFS Replication Connections", perfdata.InstancesAll, []string{
|
||||
bandwidthSavingsUsingDFSReplicationTotal,
|
||||
bytesReceivedTotal,
|
||||
compressedSizeOfFilesReceivedTotal,
|
||||
filesReceivedTotal,
|
||||
rdcBytesReceivedTotal,
|
||||
rdcCompressedSizeOfFilesReceivedTotal,
|
||||
rdcNumberOfFilesReceivedTotal,
|
||||
rdcSizeOfFilesReceivedTotal,
|
||||
sizeOfFilesReceivedTotal,
|
||||
})
|
||||
c.perfDataCollectorConnection, err = pdh.NewCollector[perfDataCounterValuesConnection]("DFS Replication Connections", pdh.InstancesAll)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DFS Replication Connections collector: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "folder") {
|
||||
c.perfDataCollectorFolder, err = perfdata.NewCollector("DFS Replicated Folders", perfdata.InstancesAll, []string{
|
||||
bandwidthSavingsUsingDFSReplicationTotal,
|
||||
compressedSizeOfFilesReceivedTotal,
|
||||
conflictBytesCleanedUpTotal,
|
||||
conflictBytesGeneratedTotal,
|
||||
conflictFilesCleanedUpTotal,
|
||||
conflictFilesGeneratedTotal,
|
||||
conflictFolderCleanupsCompletedTotal,
|
||||
conflictSpaceInUse,
|
||||
deletedSpaceInUse,
|
||||
deletedBytesCleanedUpTotal,
|
||||
deletedBytesGeneratedTotal,
|
||||
deletedFilesCleanedUpTotal,
|
||||
deletedFilesGeneratedTotal,
|
||||
fileInstallsRetriedTotal,
|
||||
fileInstallsSucceededTotal,
|
||||
filesReceivedTotal,
|
||||
rdcBytesReceivedTotal,
|
||||
rdcCompressedSizeOfFilesReceivedTotal,
|
||||
rdcNumberOfFilesReceivedTotal,
|
||||
rdcSizeOfFilesReceivedTotal,
|
||||
sizeOfFilesReceivedTotal,
|
||||
stagingSpaceInUse,
|
||||
stagingBytesCleanedUpTotal,
|
||||
stagingBytesGeneratedTotal,
|
||||
stagingFilesCleanedUpTotal,
|
||||
stagingFilesGeneratedTotal,
|
||||
updatesDroppedTotal,
|
||||
})
|
||||
c.perfDataCollectorFolder, err = pdh.NewCollector[perfDataCounterValuesFolder]("DFS Replicated Folders", pdh.InstancesAll)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DFS Replicated Folders collector: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "volume") {
|
||||
c.perfDataCollectorVolume, err = perfdata.NewCollector("DFS Replication Service Volumes", perfdata.InstancesAll, []string{
|
||||
databaseCommitsTotal,
|
||||
databaseLookupsTotal,
|
||||
usnJournalRecordsReadTotal,
|
||||
usnJournalRecordsAcceptedTotal,
|
||||
usnJournalUnreadPercentage,
|
||||
})
|
||||
c.perfDataCollectorVolume, err = pdh.NewCollector[perfDataCounterValuesVolume]("DFS Replication Service Volumes", pdh.InstancesAll)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DFS Replication Service Volumes collector: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// connection
|
||||
c.connectionBandwidthSavingsUsingDFSReplicationTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "connection_bandwidth_savings_using_dfs_replication_bytes_total"),
|
||||
@@ -537,76 +497,74 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
}
|
||||
|
||||
func (c *Collector) collectPDHConnection(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorConnection.Collect()
|
||||
err := c.perfDataCollectorConnection.Collect(&c.perfDataObjectConnection)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DFS Replication Connections metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect DFS Replication Connections metrics: %w", types.ErrNoData)
|
||||
}
|
||||
for _, connection := range c.perfDataObjectConnection {
|
||||
name := connection.Name
|
||||
|
||||
for name, connection := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionBandwidthSavingsUsingDFSReplicationTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[bandwidthSavingsUsingDFSReplicationTotal].FirstValue,
|
||||
connection.BandwidthSavingsUsingDFSReplicationTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionBytesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[bytesReceivedTotal].FirstValue,
|
||||
connection.BytesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[compressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
connection.CompressedSizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[filesReceivedTotal].FirstValue,
|
||||
connection.FilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCBytesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[rdcBytesReceivedTotal].FirstValue,
|
||||
connection.RdcBytesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[rdcCompressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
connection.RdcCompressedSizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[rdcSizeOfFilesReceivedTotal].FirstValue,
|
||||
connection.RdcSizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCNumberOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[rdcNumberOfFilesReceivedTotal].FirstValue,
|
||||
connection.RdcNumberOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection[sizeOfFilesReceivedTotal].FirstValue,
|
||||
connection.SizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
}
|
||||
@@ -615,202 +573,200 @@ func (c *Collector) collectPDHConnection(ch chan<- prometheus.Metric) error {
|
||||
}
|
||||
|
||||
func (c *Collector) collectPDHFolder(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorFolder.Collect()
|
||||
err := c.perfDataCollectorFolder.Collect(&c.perfDataObjectFolder)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DFS Replicated Folders metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect DFS Replicated Folders metrics: %w", types.ErrNoData)
|
||||
}
|
||||
for _, folder := range c.perfDataObjectFolder {
|
||||
name := folder.Name
|
||||
|
||||
for name, folder := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderBandwidthSavingsUsingDFSReplicationTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[bandwidthSavingsUsingDFSReplicationTotal].FirstValue,
|
||||
folder.BandwidthSavingsUsingDFSReplicationTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[compressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
folder.CompressedSizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictBytesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[conflictBytesCleanedUpTotal].FirstValue,
|
||||
folder.ConflictBytesCleanedUpTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictBytesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[conflictBytesGeneratedTotal].FirstValue,
|
||||
folder.ConflictBytesGeneratedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictFilesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[conflictFilesCleanedUpTotal].FirstValue,
|
||||
folder.ConflictFilesCleanedUpTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictFilesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[conflictFilesGeneratedTotal].FirstValue,
|
||||
folder.ConflictFilesGeneratedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictFolderCleanupsCompletedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[conflictFolderCleanupsCompletedTotal].FirstValue,
|
||||
folder.ConflictFolderCleanupsCompletedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictSpaceInUse,
|
||||
prometheus.GaugeValue,
|
||||
folder[conflictSpaceInUse].FirstValue,
|
||||
folder.ConflictSpaceInUse,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedSpaceInUse,
|
||||
prometheus.GaugeValue,
|
||||
folder[deletedSpaceInUse].FirstValue,
|
||||
folder.DeletedSpaceInUse,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedBytesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[deletedBytesCleanedUpTotal].FirstValue,
|
||||
folder.DeletedBytesCleanedUpTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedBytesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[deletedBytesGeneratedTotal].FirstValue,
|
||||
folder.DeletedBytesGeneratedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedFilesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[deletedFilesCleanedUpTotal].FirstValue,
|
||||
folder.DeletedFilesCleanedUpTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedFilesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[deletedFilesGeneratedTotal].FirstValue,
|
||||
folder.DeletedFilesGeneratedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderFileInstallsRetriedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[fileInstallsRetriedTotal].FirstValue,
|
||||
folder.FileInstallsRetriedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderFileInstallsSucceededTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[fileInstallsSucceededTotal].FirstValue,
|
||||
folder.FileInstallsSucceededTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[filesReceivedTotal].FirstValue,
|
||||
folder.FilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCBytesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[rdcBytesReceivedTotal].FirstValue,
|
||||
folder.RdcBytesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[rdcCompressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
folder.RdcCompressedSizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCNumberOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[rdcNumberOfFilesReceivedTotal].FirstValue,
|
||||
folder.RdcNumberOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[rdcSizeOfFilesReceivedTotal].FirstValue,
|
||||
folder.RdcSizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[sizeOfFilesReceivedTotal].FirstValue,
|
||||
folder.SizeOfFilesReceivedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingSpaceInUse,
|
||||
prometheus.GaugeValue,
|
||||
folder[stagingSpaceInUse].FirstValue,
|
||||
folder.StagingSpaceInUse,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingBytesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[stagingBytesCleanedUpTotal].FirstValue,
|
||||
folder.StagingBytesCleanedUpTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingBytesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[stagingBytesGeneratedTotal].FirstValue,
|
||||
folder.StagingBytesGeneratedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingFilesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[stagingFilesCleanedUpTotal].FirstValue,
|
||||
folder.StagingFilesCleanedUpTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingFilesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[stagingFilesGeneratedTotal].FirstValue,
|
||||
folder.StagingFilesGeneratedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderUpdatesDroppedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder[updatesDroppedTotal].FirstValue,
|
||||
folder.UpdatesDroppedTotal,
|
||||
name,
|
||||
)
|
||||
}
|
||||
@@ -819,48 +775,45 @@ func (c *Collector) collectPDHFolder(ch chan<- prometheus.Metric) error {
|
||||
}
|
||||
|
||||
func (c *Collector) collectPDHVolume(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorVolume.Collect()
|
||||
err := c.perfDataCollectorVolume.Collect(&c.perfDataObjectVolume)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DFS Replication Volumes metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect DFS Replication Volumes metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, volume := range perfData {
|
||||
for _, volume := range c.perfDataObjectVolume {
|
||||
name := volume.Name
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeDatabaseLookupsTotal,
|
||||
prometheus.CounterValue,
|
||||
volume[databaseLookupsTotal].FirstValue,
|
||||
volume.DatabaseLookupsTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeDatabaseCommitsTotal,
|
||||
prometheus.CounterValue,
|
||||
volume[databaseCommitsTotal].FirstValue,
|
||||
volume.DatabaseCommitsTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeUSNJournalRecordsAcceptedTotal,
|
||||
prometheus.CounterValue,
|
||||
volume[usnJournalRecordsAcceptedTotal].FirstValue,
|
||||
volume.UsnJournalRecordsAcceptedTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeUSNJournalRecordsReadTotal,
|
||||
prometheus.CounterValue,
|
||||
volume[usnJournalRecordsReadTotal].FirstValue,
|
||||
volume.UsnJournalRecordsReadTotal,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeUSNJournalUnreadPercentage,
|
||||
prometheus.GaugeValue,
|
||||
volume[usnJournalUnreadPercentage].FirstValue,
|
||||
volume.UsnJournalUnreadPercentage,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
75
internal/collector/dfsr/types.go
Normal file
75
internal/collector/dfsr/types.go
Normal file
@@ -0,0 +1,75 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dfsr
|
||||
|
||||
// Connection Perflib: "DFS Replication Service Connections".
|
||||
type perfDataCounterValuesConnection struct {
|
||||
Name string
|
||||
|
||||
BandwidthSavingsUsingDFSReplicationTotal float64 `perfdata:"Bandwidth Savings Using DFS Replication"`
|
||||
BytesReceivedTotal float64 `perfdata:"Total Bytes Received"`
|
||||
CompressedSizeOfFilesReceivedTotal float64 `perfdata:"Compressed Size of Files Received"`
|
||||
FilesReceivedTotal float64 `perfdata:"Total Files Received"`
|
||||
RdcBytesReceivedTotal float64 `perfdata:"RDC Bytes Received"`
|
||||
RdcCompressedSizeOfFilesReceivedTotal float64 `perfdata:"RDC Compressed Size of Files Received"`
|
||||
RdcNumberOfFilesReceivedTotal float64 `perfdata:"RDC Number of Files Received"`
|
||||
RdcSizeOfFilesReceivedTotal float64 `perfdata:"RDC Size of Files Received"`
|
||||
SizeOfFilesReceivedTotal float64 `perfdata:"Size of Files Received"`
|
||||
}
|
||||
|
||||
// Folder Perflib: "DFS Replicated Folder".
|
||||
type perfDataCounterValuesFolder struct {
|
||||
Name string
|
||||
|
||||
BandwidthSavingsUsingDFSReplicationTotal float64 `perfdata:"Bandwidth Savings Using DFS Replication"`
|
||||
CompressedSizeOfFilesReceivedTotal float64 `perfdata:"Compressed Size of Files Received"`
|
||||
ConflictBytesCleanedUpTotal float64 `perfdata:"Conflict Bytes Cleaned Up"`
|
||||
ConflictBytesGeneratedTotal float64 `perfdata:"Conflict Bytes Generated"`
|
||||
ConflictFilesCleanedUpTotal float64 `perfdata:"Conflict Files Cleaned Up"`
|
||||
ConflictFilesGeneratedTotal float64 `perfdata:"Conflict Files Generated"`
|
||||
ConflictFolderCleanupsCompletedTotal float64 `perfdata:"Conflict folder Cleanups Completed"`
|
||||
ConflictSpaceInUse float64 `perfdata:"Conflict Space In Use"`
|
||||
DeletedSpaceInUse float64 `perfdata:"Deleted Space In Use"`
|
||||
DeletedBytesCleanedUpTotal float64 `perfdata:"Deleted Bytes Cleaned Up"`
|
||||
DeletedBytesGeneratedTotal float64 `perfdata:"Deleted Bytes Generated"`
|
||||
DeletedFilesCleanedUpTotal float64 `perfdata:"Deleted Files Cleaned Up"`
|
||||
DeletedFilesGeneratedTotal float64 `perfdata:"Deleted Files Generated"`
|
||||
FileInstallsRetriedTotal float64 `perfdata:"File Installs Retried"`
|
||||
FileInstallsSucceededTotal float64 `perfdata:"File Installs Succeeded"`
|
||||
FilesReceivedTotal float64 `perfdata:"Total Files Received"`
|
||||
RdcBytesReceivedTotal float64 `perfdata:"RDC Bytes Received"`
|
||||
RdcCompressedSizeOfFilesReceivedTotal float64 `perfdata:"RDC Compressed Size of Files Received"`
|
||||
RdcNumberOfFilesReceivedTotal float64 `perfdata:"RDC Number of Files Received"`
|
||||
RdcSizeOfFilesReceivedTotal float64 `perfdata:"RDC Size of Files Received"`
|
||||
SizeOfFilesReceivedTotal float64 `perfdata:"Size of Files Received"`
|
||||
StagingSpaceInUse float64 `perfdata:"Staging Space In Use"`
|
||||
StagingBytesCleanedUpTotal float64 `perfdata:"Staging Bytes Cleaned Up"`
|
||||
StagingBytesGeneratedTotal float64 `perfdata:"Staging Bytes Generated"`
|
||||
StagingFilesCleanedUpTotal float64 `perfdata:"Staging Files Cleaned Up"`
|
||||
StagingFilesGeneratedTotal float64 `perfdata:"Staging Files Generated"`
|
||||
UpdatesDroppedTotal float64 `perfdata:"Updates Dropped"`
|
||||
}
|
||||
|
||||
// Volume Perflib: "DFS Replication Service Volumes".
|
||||
type perfDataCounterValuesVolume struct {
|
||||
Name string
|
||||
|
||||
DatabaseCommitsTotal float64 `perfdata:"Database Commits"`
|
||||
DatabaseLookupsTotal float64 `perfdata:"Database Lookups"`
|
||||
UsnJournalRecordsReadTotal float64 `perfdata:"USN Journal Records Read"`
|
||||
UsnJournalRecordsAcceptedTotal float64 `perfdata:"USN Journal Records Accepted"`
|
||||
UsnJournalUnreadPercentage float64 `perfdata:"USN Journal Unread Percentage"`
|
||||
}
|
||||
Reference in New Issue
Block a user