Merge pull request #885 from sstorie/mscluster
Add support for MSCluster collectors
This commit is contained in:
commit
93dcdf95f7
|
@ -27,6 +27,11 @@ Name | Description | Enabled by default
|
|||
[logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | ✓
|
||||
[logon](docs/collector.logon.md) | User logon sessions |
|
||||
[memory](docs/collector.memory.md) | Memory usage metrics |
|
||||
[mscluster_cluster](docs/collector.mscluster_cluster.md) | MSCluster cluster metrics |
|
||||
[mscluster_network](docs/collector.mscluster_network.md) | MSCluster network metrics |
|
||||
[mscluster_node](docs/collector.mscluster_node.md) | MSCluster Node metrics |
|
||||
[mscluster_resource](docs/collector.mscluster_resource.md) | MSCluster Resource metrics |
|
||||
[mscluster_resourcegroup](docs/collector.mscluster_resourcegroup.md) | MSCluster ResourceGroup metrics |
|
||||
[msmq](docs/collector.msmq.md) | MSMQ queues |
|
||||
[mssql](docs/collector.mssql.md) | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics |
|
||||
[netframework_clrexceptions](docs/collector.netframework_clrexceptions.md) | .NET Framework CLR Exceptions |
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,117 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCollector("mscluster_network", newMSCluster_NetworkCollector)
|
||||
}
|
||||
|
||||
// A MSCluster_NetworkCollector is a Prometheus collector for WMI MSCluster_Network metrics
|
||||
type MSCluster_NetworkCollector struct {
|
||||
Characteristics *prometheus.Desc
|
||||
Flags *prometheus.Desc
|
||||
Metric *prometheus.Desc
|
||||
Role *prometheus.Desc
|
||||
State *prometheus.Desc
|
||||
}
|
||||
|
||||
func newMSCluster_NetworkCollector() (Collector, error) {
|
||||
const subsystem = "mscluster_network"
|
||||
return &MSCluster_NetworkCollector{
|
||||
Characteristics: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
|
||||
"Provides the characteristics of the network.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Flags: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "flags"),
|
||||
"Provides access to the flags set for the node. ",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Metric: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Role: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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 ",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
State: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "state"),
|
||||
"Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// MSCluster_Network docs:
|
||||
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-network
|
||||
//
|
||||
type MSCluster_Network struct {
|
||||
Name string
|
||||
|
||||
Characteristics uint
|
||||
Flags uint
|
||||
Metric uint
|
||||
Role uint
|
||||
State uint
|
||||
}
|
||||
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *MSCluster_NetworkCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
var dst []MSCluster_Network
|
||||
q := queryAll(&dst)
|
||||
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, v := range dst {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Characteristics,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Characteristics),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Flags,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Flags),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Metric,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Metric),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Role,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Role),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.State,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.State),
|
||||
v.Name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,253 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCollector("mscluster_node", newMSCluster_NodeCollector)
|
||||
}
|
||||
|
||||
// A MSCluster_NodeCollector is a Prometheus collector for WMI MSCluster_Node metrics
|
||||
type MSCluster_NodeCollector struct {
|
||||
BuildNumber *prometheus.Desc
|
||||
Characteristics *prometheus.Desc
|
||||
DetectedCloudPlatform *prometheus.Desc
|
||||
DynamicWeight *prometheus.Desc
|
||||
Flags *prometheus.Desc
|
||||
MajorVersion *prometheus.Desc
|
||||
MinorVersion *prometheus.Desc
|
||||
NeedsPreventQuorum *prometheus.Desc
|
||||
NodeDrainStatus *prometheus.Desc
|
||||
NodeHighestVersion *prometheus.Desc
|
||||
NodeLowestVersion *prometheus.Desc
|
||||
NodeWeight *prometheus.Desc
|
||||
State *prometheus.Desc
|
||||
StatusInformation *prometheus.Desc
|
||||
}
|
||||
|
||||
func newMSCluster_NodeCollector() (Collector, error) {
|
||||
const subsystem = "mscluster_node"
|
||||
return &MSCluster_NodeCollector{
|
||||
BuildNumber: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "build_number"),
|
||||
"Provides access to the node's BuildNumber property.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Characteristics: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
|
||||
"Provides access to the characteristics set for the node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
DetectedCloudPlatform: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "detected_cloud_platform"),
|
||||
"(DetectedCloudPlatform)",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
DynamicWeight: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "dynamic_weight"),
|
||||
"The dynamic vote weight of the node adjusted by dynamic quorum feature.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Flags: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "flags"),
|
||||
"Provides access to the flags set for the node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
MajorVersion: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "major_version"),
|
||||
"Provides access to the node's MajorVersion property, which specifies the major portion of the Windows version installed.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
MinorVersion: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "minor_version"),
|
||||
"Provides access to the node's MinorVersion property, which specifies the minor portion of the Windows version installed.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
NeedsPreventQuorum: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "needs_prevent_quorum"),
|
||||
"Whether the cluster service on that node should be started with prevent quorum flag.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
NodeDrainStatus: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "node_drain_status"),
|
||||
"The current node drain status of a node. 0: Not Initiated; 1: In Progress; 2: Completed; 3: Failed",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
NodeHighestVersion: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
NodeLowestVersion: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
NodeWeight: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "node_weight"),
|
||||
"The vote weight of the node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
State: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "state"),
|
||||
"Returns the current state of a node. -1: Unknown; 0: Up; 1: Down; 2: Paused; 3: Joining",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
StatusInformation: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "status_information"),
|
||||
"The isolation or quarantine status of the node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// MSCluster_Node docs:
|
||||
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-node
|
||||
//
|
||||
type MSCluster_Node struct {
|
||||
Name string
|
||||
|
||||
BuildNumber uint
|
||||
Characteristics uint
|
||||
DetectedCloudPlatform uint
|
||||
DynamicWeight uint
|
||||
Flags uint
|
||||
MajorVersion uint
|
||||
MinorVersion uint
|
||||
NeedsPreventQuorum uint
|
||||
NodeDrainStatus uint
|
||||
NodeHighestVersion uint
|
||||
NodeLowestVersion uint
|
||||
NodeWeight uint
|
||||
State uint
|
||||
StatusInformation uint
|
||||
}
|
||||
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *MSCluster_NodeCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
var dst []MSCluster_Node
|
||||
q := queryAll(&dst)
|
||||
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, v := range dst {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.BuildNumber,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.BuildNumber),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Characteristics,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Characteristics),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.DetectedCloudPlatform,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.DetectedCloudPlatform),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.DynamicWeight,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.DynamicWeight),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Flags,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Flags),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.MajorVersion,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.MajorVersion),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.MinorVersion,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.MinorVersion),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.NeedsPreventQuorum,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.NeedsPreventQuorum),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.NodeDrainStatus,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.NodeDrainStatus),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.NodeHighestVersion,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.NodeHighestVersion),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.NodeLowestVersion,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.NodeLowestVersion),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.NodeWeight,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.NodeWeight),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.State,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.State),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.StatusInformation,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.StatusInformation),
|
||||
v.Name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,285 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCollector("mscluster_resource", newMSCluster_ResourceCollector)
|
||||
}
|
||||
|
||||
// A MSCluster_ResourceCollector is a Prometheus collector for WMI MSCluster_Resource metrics
|
||||
type MSCluster_ResourceCollector struct {
|
||||
Characteristics *prometheus.Desc
|
||||
DeadlockTimeout *prometheus.Desc
|
||||
EmbeddedFailureAction *prometheus.Desc
|
||||
Flags *prometheus.Desc
|
||||
IsAlivePollInterval *prometheus.Desc
|
||||
LooksAlivePollInterval *prometheus.Desc
|
||||
MonitorProcessId *prometheus.Desc
|
||||
PendingTimeout *prometheus.Desc
|
||||
ResourceClass *prometheus.Desc
|
||||
RestartAction *prometheus.Desc
|
||||
RestartDelay *prometheus.Desc
|
||||
RestartPeriod *prometheus.Desc
|
||||
RestartThreshold *prometheus.Desc
|
||||
RetryPeriodOnFailure *prometheus.Desc
|
||||
State *prometheus.Desc
|
||||
Subclass *prometheus.Desc
|
||||
}
|
||||
|
||||
func newMSCluster_ResourceCollector() (Collector, error) {
|
||||
const subsystem = "mscluster_resource"
|
||||
return &MSCluster_ResourceCollector{
|
||||
Characteristics: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
|
||||
"Provides the characteristics of the object.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
DeadlockTimeout: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "deadlock_timeout"),
|
||||
"Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
EmbeddedFailureAction: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "embedded_failure_action"),
|
||||
"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"},
|
||||
nil,
|
||||
),
|
||||
Flags: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "flags"),
|
||||
"Provides access to the flags set for the object.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
IsAlivePollInterval: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
LooksAlivePollInterval: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
MonitorProcessId: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "monitor_process_id"),
|
||||
"Provides the process ID of the resource host service that is currently hosting the resource.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
PendingTimeout: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
ResourceClass: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "resource_class"),
|
||||
"Gets or sets the resource class of a resource. 0: Unknown; 1: Storage; 2: Network; 32768: Unknown ",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
RestartAction: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
RestartDelay: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "restart_delay"),
|
||||
"Indicates the time delay before a failed resource is restarted.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
RestartPeriod: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
RestartThreshold: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
RetryPeriodOnFailure: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
State: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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 ",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
Subclass: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "subclass"),
|
||||
"Provides the list of references to nodes that can be the owner of this resource.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// MSCluster_Resource docs:
|
||||
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-resource
|
||||
//
|
||||
type MSCluster_Resource struct {
|
||||
Name string
|
||||
Type string
|
||||
OwnerGroup string
|
||||
|
||||
Characteristics uint
|
||||
DeadlockTimeout uint
|
||||
EmbeddedFailureAction uint
|
||||
Flags uint
|
||||
IsAlivePollInterval uint
|
||||
LooksAlivePollInterval uint
|
||||
MonitorProcessId uint
|
||||
PendingTimeout uint
|
||||
ResourceClass uint
|
||||
RestartAction uint
|
||||
RestartDelay uint
|
||||
RestartPeriod uint
|
||||
RestartThreshold uint
|
||||
RetryPeriodOnFailure uint
|
||||
State uint
|
||||
Subclass uint
|
||||
}
|
||||
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *MSCluster_ResourceCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
var dst []MSCluster_Resource
|
||||
q := queryAll(&dst)
|
||||
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, v := range dst {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Characteristics,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Characteristics),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.DeadlockTimeout,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.DeadlockTimeout),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.EmbeddedFailureAction,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.EmbeddedFailureAction),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Flags,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Flags),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.IsAlivePollInterval,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.IsAlivePollInterval),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.LooksAlivePollInterval,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.LooksAlivePollInterval),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.MonitorProcessId,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.MonitorProcessId),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.PendingTimeout,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.PendingTimeout),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ResourceClass,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.ResourceClass),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.RestartAction,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.RestartAction),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.RestartDelay,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.RestartDelay),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.RestartPeriod,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.RestartPeriod),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.RestartThreshold,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.RestartThreshold),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.RetryPeriodOnFailure,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.RetryPeriodOnFailure),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.State,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.State),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Subclass,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Subclass),
|
||||
v.Type, v.OwnerGroup, v.Name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCollector("mscluster_resourcegroup", newMSCluster_ResourceGroupCollector)
|
||||
}
|
||||
|
||||
// A MSCluster_ResourceGroupCollector is a Prometheus collector for WMI MSCluster_ResourceGroup metrics
|
||||
type MSCluster_ResourceGroupCollector struct {
|
||||
AutoFailbackType *prometheus.Desc
|
||||
Characteristics *prometheus.Desc
|
||||
ColdStartSetting *prometheus.Desc
|
||||
DefaultOwner *prometheus.Desc
|
||||
FailbackWindowEnd *prometheus.Desc
|
||||
FailbackWindowStart *prometheus.Desc
|
||||
FailoverPeriod *prometheus.Desc
|
||||
FailoverThreshold *prometheus.Desc
|
||||
FaultDomain *prometheus.Desc
|
||||
Flags *prometheus.Desc
|
||||
GroupType *prometheus.Desc
|
||||
PlacementOptions *prometheus.Desc
|
||||
Priority *prometheus.Desc
|
||||
ResiliencyPeriod *prometheus.Desc
|
||||
State *prometheus.Desc
|
||||
UpdateDomain *prometheus.Desc
|
||||
}
|
||||
|
||||
func newMSCluster_ResourceGroupCollector() (Collector, error) {
|
||||
const subsystem = "mscluster_resourcegroup"
|
||||
return &MSCluster_ResourceGroupCollector{
|
||||
AutoFailbackType: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "auto_failback_type"),
|
||||
"Provides access to the group's AutoFailbackType property.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Characteristics: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
|
||||
"Provides the characteristics of the group.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
ColdStartSetting: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "cold_start_setting"),
|
||||
"Indicates whether a group can start after a cluster cold start.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
DefaultOwner: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "default_owner"),
|
||||
"Number of the last node the resource group was activated on or explicitly moved to.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
FailbackWindowEnd: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
FailbackWindowStart: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
FailoverPeriod: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "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.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
FailoverThreshold: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "failover_threshold"),
|
||||
"The FailoverThreshold property specifies the maximum number of failover attempts.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Flags: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "flags"),
|
||||
"Provides access to the flags set for the group. ",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
GroupType: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "group_type"),
|
||||
"The Type of the resource group.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
Priority: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "priority"),
|
||||
"Priority value of the resource group",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
ResiliencyPeriod: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "resiliency_period"),
|
||||
"The resiliency period for this group, in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
State: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "state"),
|
||||
"The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// MSCluster_ResourceGroup docs:
|
||||
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-resourcegroup
|
||||
//
|
||||
type MSCluster_ResourceGroup struct {
|
||||
Name string
|
||||
|
||||
AutoFailbackType uint
|
||||
Characteristics uint
|
||||
ColdStartSetting uint
|
||||
DefaultOwner uint
|
||||
FailbackWindowEnd int
|
||||
FailbackWindowStart int
|
||||
FailoverPeriod uint
|
||||
FailoverThreshold uint
|
||||
Flags uint
|
||||
GroupType uint
|
||||
Priority uint
|
||||
ResiliencyPeriod uint
|
||||
State uint
|
||||
UpdateDomain uint
|
||||
}
|
||||
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *MSCluster_ResourceGroupCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
var dst []MSCluster_ResourceGroup
|
||||
q := queryAll(&dst)
|
||||
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, v := range dst {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.AutoFailbackType,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.AutoFailbackType),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Characteristics,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Characteristics),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ColdStartSetting,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.ColdStartSetting),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.DefaultOwner,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.DefaultOwner),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.FailbackWindowEnd,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.FailbackWindowEnd),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.FailbackWindowStart,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.FailbackWindowStart),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.FailoverPeriod,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.FailoverPeriod),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.FailoverThreshold,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.FailoverThreshold),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Flags,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Flags),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.GroupType,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.GroupType),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.Priority,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.Priority),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ResiliencyPeriod,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.ResiliencyPeriod),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.State,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.State),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.UpdateDomain,
|
||||
prometheus.GaugeValue,
|
||||
float64(v.UpdateDomain),
|
||||
v.Name,
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
# mscluster_cluster collector
|
||||
|
||||
The MSCluster_Cluster class is a dynamic WMI class that represents a cluster.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `mscluster_cluster`
|
||||
Classes | `MSCluster_Cluster`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`AddEvictDelay` | Provides access to the cluster's AddEvictDelay property, which is the number a seconds that a new node is delayed after an eviction of another node. | gauge | `name`
|
||||
`AdminAccessPoint` | The type of the cluster administrative access point. | gauge | `name`
|
||||
`AutoAssignNodeSite` | Determines whether or not the cluster will attempt to automatically assign nodes to sites based on networks and Active Directory Site information. | gauge | `name`
|
||||
`AutoBalancerLevel` | Determines the level of aggressiveness of AutoBalancer. | gauge | `name`
|
||||
`AutoBalancerMode` | Determines whether or not the auto balancer is enabled. | gauge | `name`
|
||||
`BackupInProgress` | Indicates whether a backup is in progress. | gauge | `name`
|
||||
`BlockCacheSize` | CSV BlockCache Size in MB. | gauge | `name`
|
||||
`ClusSvcHangTimeout` | Controls how long the cluster network driver waits between Failover Cluster Service heartbeats before it determines that the Failover Cluster Service has stopped responding. | gauge | `name`
|
||||
`ClusSvcRegroupOpeningTimeout` | Controls how long a node will wait on other nodes in the opening stage before deciding that they failed. | gauge | `name`
|
||||
`ClusSvcRegroupPruningTimeout` | Controls how long the membership leader will wait to reach full connectivity between cluster nodes. | gauge | `name`
|
||||
`ClusSvcRegroupStageTimeout` | Controls how long a node will wait on other nodes in a membership stage before deciding that they failed. | gauge | `name`
|
||||
`ClusSvcRegroupTickInMilliseconds` | Controls how frequently the membership algorithm is sending periodic membership messages. | gauge | `name`
|
||||
`ClusterEnforcedAntiAffinity` | Enables or disables hard enforcement of group anti-affinity classes. | gauge | `name`
|
||||
`ClusterFunctionalLevel` | The functional level the cluster is currently running in. | gauge | `name`
|
||||
`ClusterGroupWaitDelay` | Maximum time in seconds that a group waits for its preferred node to come online during cluster startup before coming online on a different node. | gauge | `name`
|
||||
`ClusterLogLevel` | Controls the level of cluster logging. | gauge | `name`
|
||||
`ClusterLogSize` | Controls the maximum size of the cluster log files on each of the nodes. | gauge | `name`
|
||||
`ClusterUpgradeVersion` | Specifies the upgrade version the cluster is currently running in. | gauge | `name`
|
||||
`CrossSiteDelay` | Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats across sites. | gauge | `name`
|
||||
`CrossSiteThreshold` | Controls how many Cluster Service heartbeats can be missed across sites before it determines that Cluster Service has stopped responding. | gauge | `name`
|
||||
`CrossSubnetDelay` | Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats across subnets. | gauge | `name`
|
||||
`CrossSubnetThreshold` | Controls how many Cluster Service heartbeats can be missed across subnets before it determines that Cluster Service has stopped responding. | gauge | `name`
|
||||
`CsvBalancer` | Whether automatic balancing for CSV is enabled. | gauge | `name`
|
||||
`DatabaseReadWriteMode` | Sets the database read and write mode. | gauge | `name`
|
||||
`DefaultNetworkRole` | Provides access to the cluster's DefaultNetworkRole property. | gauge | `name`
|
||||
`DetectedCloudPlatform` | | gauge | `name`
|
||||
`DetectManagedEvents` | | gauge | `name`
|
||||
`DetectManagedEventsThreshold` | | gauge | `name`
|
||||
`DisableGroupPreferredOwnerRandomization` | | gauge | `name`
|
||||
`DrainOnShutdown` | Whether to drain the node when cluster service is being stopped. | gauge | `name`
|
||||
`DynamicQuorumEnabled` | Allows cluster service to adjust node weights as needed to increase availability. | gauge | `name`
|
||||
`EnableSharedVolumes` | Enables or disables cluster shared volumes on this cluster. | gauge | `name`
|
||||
`FixQuorum` | Provides access to the cluster's FixQuorum property, which specifies if the cluster is in a fix quorum state. | gauge | `name`
|
||||
`GracePeriodEnabled` | Whether the node grace period feature of this cluster is enabled. | gauge | `name`
|
||||
`GracePeriodTimeout` | The grace period timeout in milliseconds. | gauge | `name`
|
||||
`GroupDependencyTimeout` | The timeout after which a group will be brought online despite unsatisfied dependencies | gauge | `name`
|
||||
`HangRecoveryAction` | Controls the action to take if the user-mode processes have stopped responding. | gauge | `name`
|
||||
`IgnorePersistentStateOnStartup` | Provides access to the cluster's IgnorePersistentStateOnStartup property, which specifies whether the cluster will bring online groups that were online when the cluster was shut down. | gauge | `name`
|
||||
`LogResourceControls` | Controls the logging of resource controls. | gauge | `name`
|
||||
`LowerQuorumPriorityNodeId` | Specifies the Node ID that has a lower priority when voting for quorum is performed. If the quorum vote is split 50/50%, the specified node's vote would be ignored to break the tie. If this is not set then the cluster will pick a node at random to break the tie. | gauge | `name`
|
||||
`MaxNumberOfNodes` | Indicates the maximum number of nodes that may participate in the Cluster. | gauge | `name`
|
||||
`MessageBufferLength` | The maximum unacknowledged message count for GEM. | gauge | `name`
|
||||
`MinimumNeverPreemptPriority` | Groups with this priority or higher cannot be preempted. | gauge | `name`
|
||||
`MinimumPreemptorPriority` | Minimum priority a cluster group must have to be able to preempt another group. | gauge | `name`
|
||||
`NetftIPSecEnabled` | Whether IPSec is enabled for cluster internal traffic. | gauge | `name`
|
||||
`PlacementOptions` | Various option flags to modify default placement behavior. | gauge | `name`
|
||||
`PlumbAllCrossSubnetRoutes` | Plumbs all possible cross subnet routes to all nodes. | gauge | `name`
|
||||
`PreventQuorum` | Whether the cluster will ignore group persistent state on startup. | gauge | `name`
|
||||
`QuarantineDuration` | The quarantine period timeout in milliseconds. | gauge | `name`
|
||||
`QuarantineThreshold` | Number of node failures before it will be quarantined. | gauge | `name`
|
||||
`QuorumArbitrationTimeMax` | Controls the maximum time necessary to decide the Quorum owner node. | gauge | `name`
|
||||
`QuorumArbitrationTimeMin` | Controls the minimum time necessary to decide the Quorum owner node. | gauge | `name`
|
||||
`QuorumLogFileSize` | This property is obsolete. | gauge | `name`
|
||||
`QuorumTypeValue` | Get the current quorum type value. -1: Unknown; 1: Node; 2: FileShareWitness; 3: Storage; 4: None | gauge | `name`
|
||||
`RequestReplyTimeout` | Controls the request reply time-out period. | gauge | `name`
|
||||
`ResiliencyDefaultPeriod` | The default resiliency period, in seconds, for the cluster. | gauge | `name`
|
||||
`ResiliencyLevel` | The resiliency level for the cluster. | gauge | `name`
|
||||
`ResourceDllDeadlockPeriod` | This property is obsolete. | gauge | `name`
|
||||
`RootMemoryReserved` | Controls the amount of memory reserved for the parent partition on all cluster nodes. | gauge | `name`
|
||||
`RouteHistoryLength` | The history length for routes to help finding network issues. | gauge | `name`
|
||||
`S2DBusTypes` | Bus types for storage spaces direct. | gauge | `name`
|
||||
`S2DCacheDesiredState` | Desired state of the storage spaces direct cache. | gauge | `name`
|
||||
`S2DCacheFlashReservePercent` | Percentage of allocated flash space to utilize when caching. | gauge | `name`
|
||||
`S2DCachePageSizeKBytes` | Page size in KB used by S2D cache. | gauge | `name`
|
||||
`S2DEnabled` | Whether direct attached storage (DAS) is enabled. | gauge | `name`
|
||||
`S2DIOLatencyThreshold` | The I/O latency threshold for storage spaces direct. | gauge | `name`
|
||||
`S2DOptimizations` | Optimization flags for storage spaces direct. | gauge | `name`
|
||||
`SameSubnetDelay` | Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats on the same subnet. | gauge | `name`
|
||||
`SameSubnetThreshold` | Controls how many Cluster Service heartbeats can be missed on the same subnet before it determines that Cluster Service has stopped responding. | gauge | `name`
|
||||
`SecurityLevel` | Controls the level of security that should apply to intracluster messages. 0: Clear Text; 1: Sign; 2: Encrypt | gauge | `name`
|
||||
`SecurityLevelForStorage` | | gauge | `name`
|
||||
`SharedVolumeVssWriterOperationTimeout` | CSV VSS Writer operation timeout in seconds. | gauge | `name`
|
||||
`ShutdownTimeoutInMinutes` | The maximum time in minutes allowed for cluster resources to come offline during cluster service shutdown. | gauge | `name`
|
||||
`UseClientAccessNetworksForSharedVolumes` | Whether the use of client access networks for cluster shared volumes feature of this cluster is enabled. 0: Disabled; 1: Enabled; 2: Auto | gauge | `name`
|
||||
`WitnessDatabaseWriteTimeout` | Controls the maximum time in seconds that a cluster database write to a witness can take before the write is abandoned. | gauge | `name`
|
||||
`WitnessDynamicWeight` | The weight of the configured witness. | gauge | `name`
|
||||
`WitnessRestartInterval` | Controls the witness restart interval. | gauge | `name`
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
## Useful queries
|
||||
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
|
@ -0,0 +1,32 @@
|
|||
# mscluster_network collector
|
||||
|
||||
The MSCluster_Network class is a dynamic WMI class that represents cluster networks.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `mscluster_network`
|
||||
Classes | `MSCluster_Network`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`Characteristics` | Provides the characteristics of the network. The cluster defines characteristics only for resources. For a description of these characteristics, see [CLUSCTL_RESOURCE_GET_CHARACTERISTICS](https://msdn.microsoft.com/library/aa367466). | gauge | `name`
|
||||
`Flags` | Provides access to the flags set for the network. The cluster defines flags only for resources. For a description of these flags, see [CLUSCTL_RESOURCE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-flags). | gauge | `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. | gauge | `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 | gauge | `name`
|
||||
`State` | Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up | gauge | `name`
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
## Useful queries
|
||||
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
|
@ -0,0 +1,41 @@
|
|||
# mscluster_node collector
|
||||
|
||||
The MSCluster_Node class is a dynamic WMI class that represents a cluster node.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `mscluster_node`
|
||||
Classes | `MSCluster_Node`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`BuildNumber` | Provides access to the node's BuildNumber property. | gauge | `name`
|
||||
`Characteristics` | Provides access to the characteristics set for the node. For a list of possible characteristics, see [CLUSCTL_NODE_GET_CHARACTERISTICS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-node-get-characteristics). | gauge | `name`
|
||||
`DetectedCloudPlatform` | The dynamic vote weight of the node adjusted by dynamic quorum feature. | gauge | `name`
|
||||
`DynamicWeight` | The dynamic vote weight of the node adjusted by dynamic quorum feature. | gauge | `name`
|
||||
`Flags` | Provides access to the flags set for the node. For a list of possible characteristics, see [CLUSCTL_NODE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-node-get-flags). | gauge | `name`
|
||||
`MajorVersion` | Provides access to the node's MajorVersion property, which specifies the major portion of the Windows version installed. | gauge | `name`
|
||||
`MinorVersion` | Provides access to the node's MinorVersion property, which specifies the minor portion of the Windows version installed. | gauge | `name`
|
||||
`NeedsPreventQuorum` | Whether the cluster service on that node should be started with prevent quorum flag. | gauge | `name`
|
||||
`NodeDrainStatus` | The current node drain status of a node. 0: Not Initiated; 1: In Progress; 2: Completed; 3: Failed | gauge | `name`
|
||||
`NodeHighestVersion` | 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. | gauge | `name`
|
||||
`NodeLowestVersion` | 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. | gauge | `name`
|
||||
`NodeWeight` | The vote weight of the node. | gauge | `name`
|
||||
`State` | Returns the current state of a node. -1: Unknown; 0: Up; 1: Down; 2: Paused; 3: Joining | gauge | `name`
|
||||
`StatusInformation` | The isolation or quarantine status of the node. | gauge | `name`
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
## Useful queries
|
||||
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
|
@ -0,0 +1,43 @@
|
|||
# mscluster_resource collector
|
||||
|
||||
The MSCluster_resource class is a dynamic WMI class that represents a cluster resource.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `mscluster_resource`
|
||||
Classes | `MSCluster_Resource`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`Characteristics` | Provides the characteristics of the object. The cluster defines characteristics only for resources. For a description of these characteristics, see [CLUSCTL_RESOURCE_GET_CHARACTERISTICS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-characteristics). | gauge | `type`, `owner_group`, `name`
|
||||
`DeadlockTimeout` | Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource. | gauge | `type`, `owner_group`, `name`
|
||||
`EmbeddedFailureAction` | The time, in milliseconds, that a resource should remain in a failed state before the Cluster service attempts to restart it. | gauge | `type`, `owner_group`, `name`
|
||||
`Flags` | Provides access to the flags set for the object. The cluster defines flags only for resources. For a description of these flags, see [CLUSCTL_RESOURCE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-flags). | gauge | `type`, `owner_group`, `name`
|
||||
`IsAlivePollInterval` | 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. | gauge | `type`, `owner_group`, `name`
|
||||
`LooksAlivePollInterval` | 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. | gauge | `type`, `owner_group`, `name`
|
||||
`MonitorProcessId` | Provides the process ID of the resource host service that is currently hosting the resource. | gauge | `type`, `owner_group`, `name`
|
||||
`PendingTimeout` | 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. | gauge | `type`, `owner_group`, `name`
|
||||
`ResourceClass` | Gets or sets the resource class of a resource. 0: Unknown; 1: Storage; 2: Network; 32768: Unknown | gauge | `type`, `owner_group`, `name`
|
||||
`RestartAction` | Provides access to the resource's RestartAction property, which is the action to be taken by the Cluster Service if the resource fails. | gauge | `type`, `owner_group`, `name`
|
||||
`RestartDelay` | Indicates the time delay before a failed resource is restarted. | gauge | `type`, `owner_group`, `name`
|
||||
`RestartPeriod` | 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. | gauge | `type`, `owner_group`, `name`
|
||||
`RestartThreshold` | 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. | gauge | `type`, `owner_group`, `name`
|
||||
`RetryPeriodOnFailure` | 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. | gauge | `type`, `owner_group`, `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 | gauge | `type`, `owner_group`, `name`
|
||||
`Subclass` | Provides the list of references to nodes that can be the owner of this resource. | gauge | `type`, `owner_group`, `name`
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
## Useful queries
|
||||
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
|
@ -0,0 +1,41 @@
|
|||
# mscluster_resourcegroup collector
|
||||
|
||||
The MSCluster_ResourceGroup class is a dynamic WMI class that represents a cluster group.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `mscluster_resourcegroup`
|
||||
Classes | `MSCluster_ResourceGroup`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`AutoFailbackType` | Provides access to the group's AutoFailbackType property. | gauge | `name`
|
||||
`Characteristics` | Provides the characteristics of the group. The cluster defines characteristics only for resources. For a description of these characteristics, see [CLUSCTL_RESOURCE_GET_CHARACTERISTICS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-characteristics). | gauge | `name`
|
||||
`ColdStartSetting` | Indicates whether a group can start after a cluster cold start. | gauge | `name`
|
||||
`DefaultOwner` | Number of the last node the resource group was activated on or explicitly moved to. | gauge | `name`
|
||||
`FailbackWindowEnd` | The FailbackWindowEnd property provides the latest time that the group can be moved back to the node identified as its preferred node. | gauge | `name`
|
||||
`FailbackWindowStart` | 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. | gauge | `name`
|
||||
`FailoverPeriod` | The FailoverPeriod property specifies a number of hours during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur. | gauge | `name`
|
||||
`FailoverThreshold` | The FailoverThreshold property specifies the maximum number of failover attempts. | gauge | `name`
|
||||
`Flags` | Provides access to the flags set for the group. The cluster defines flags only for resources. For a description of these flags, see [CLUSCTL_RESOURCE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-flags). | gauge | `name`
|
||||
`GroupType` | The Type of the resource group. | gauge | `name`
|
||||
`Priority` | Priority value of the resource group | gauge | `name`
|
||||
`ResiliencyPeriod` | The resiliency period for this group, in seconds. | gauge | `name`
|
||||
`State` | The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending | gauge | `name`
|
||||
`UpdateDomain` | | gauge | `name`
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
## Useful queries
|
||||
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
|
@ -2,19 +2,21 @@ Param(
|
|||
[Parameter(Mandatory=$true)]
|
||||
$Class,
|
||||
[Parameter(Mandatory=$false)]
|
||||
$Namespace = "root/cimv2",
|
||||
[Parameter(Mandatory=$false)]
|
||||
$CollectorName = ($Class -replace 'Win32_PerfRawData_Perf',''),
|
||||
[Parameter(Mandatory=$false)]
|
||||
$ComputerName = "localhost",
|
||||
[Parameter(Mandatory=$false)]
|
||||
$Credential
|
||||
[CimSession] $Session
|
||||
)
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if($Credential -ne $null) {
|
||||
$wmiObject = Get-CimInstance -ComputerName $ComputerName -Credential $Credential -Class $Class
|
||||
if($null -ne $Session) {
|
||||
$wmiObject = Get-CimInstance -CimSession $Session -Namespace $Namespace -Class $Class
|
||||
}
|
||||
else {
|
||||
$wmiObject = Get-CimInstance -ComputerName $ComputerName -Class $Class
|
||||
$wmiObject = Get-CimInstance -ComputerName $ComputerName -Namespace $Namespace -Class $Class
|
||||
}
|
||||
|
||||
$members = $wmiObject `
|
||||
|
@ -22,6 +24,7 @@ $members = $wmiObject `
|
|||
| Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `
|
||||
| Select-Object Name, @{Name="Type";Expression={$_.Definition.Split(" ")[0]}}
|
||||
$input = @{
|
||||
"Namespace"=$Namespace;
|
||||
"Class"=$Class;
|
||||
"CollectorName"=$CollectorName;
|
||||
"Members"=$members
|
||||
|
|
Loading…
Reference in New Issue