mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-22 04:36:35 +00:00
Merge pull request #1338 from aburtasov/feature/collector/exchange
This commit is contained in:
@@ -74,6 +74,7 @@ type collector struct {
|
|||||||
ConnectionCount *prometheus.Desc
|
ConnectionCount *prometheus.Desc
|
||||||
RPCOperationsPerSec *prometheus.Desc
|
RPCOperationsPerSec *prometheus.Desc
|
||||||
UserCount *prometheus.Desc
|
UserCount *prometheus.Desc
|
||||||
|
ActiveUserCountMapiHttpEmsmdb *prometheus.Desc
|
||||||
|
|
||||||
enabledCollectors []string
|
enabledCollectors []string
|
||||||
}
|
}
|
||||||
@@ -89,6 +90,7 @@ var exchangeAllCollectorNames = []string{
|
|||||||
"Autodiscover",
|
"Autodiscover",
|
||||||
"WorkloadManagement",
|
"WorkloadManagement",
|
||||||
"RpcClientAccess",
|
"RpcClientAccess",
|
||||||
|
"MapiHttpEmsmdb",
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(logger log.Logger, config *Config) types.Collector {
|
func New(logger log.Logger, config *Config) types.Collector {
|
||||||
@@ -138,6 +140,7 @@ func (c *collector) GetPerfCounter() ([]string, error) {
|
|||||||
"MSExchangeAutodiscover",
|
"MSExchangeAutodiscover",
|
||||||
"MSExchange WorkloadManagement Workloads",
|
"MSExchange WorkloadManagement Workloads",
|
||||||
"MSExchange RpcClientAccess",
|
"MSExchange RpcClientAccess",
|
||||||
|
"MSExchange MapiHttp Emsmdb",
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,6 +192,7 @@ func (c *collector) Build() error {
|
|||||||
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.enabledCollectors = make([]string, 0, len(exchangeAllCollectorNames))
|
c.enabledCollectors = make([]string, 0, len(exchangeAllCollectorNames))
|
||||||
|
|
||||||
@@ -202,6 +206,7 @@ func (c *collector) Build() error {
|
|||||||
"Autodiscover": "[29240] MSExchange Autodiscover",
|
"Autodiscover": "[29240] MSExchange Autodiscover",
|
||||||
"WorkloadManagement": "[19430] MSExchange WorkloadManagement Workloads",
|
"WorkloadManagement": "[19430] MSExchange WorkloadManagement Workloads",
|
||||||
"RpcClientAccess": "[29336] MSExchange RpcClientAccess",
|
"RpcClientAccess": "[29336] MSExchange RpcClientAccess",
|
||||||
|
"MapiHttpEmsmdb": "[26463] MSExchange MapiHttp Emsmdb",
|
||||||
}
|
}
|
||||||
|
|
||||||
if *c.exchangeListAllCollectors {
|
if *c.exchangeListAllCollectors {
|
||||||
@@ -241,6 +246,7 @@ func (c *collector) Collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
|
|||||||
"Autodiscover": c.collectAutoDiscover,
|
"Autodiscover": c.collectAutoDiscover,
|
||||||
"WorkloadManagement": c.collectWorkloadManagementWorkloads,
|
"WorkloadManagement": c.collectWorkloadManagementWorkloads,
|
||||||
"RpcClientAccess": c.collectRPC,
|
"RpcClientAccess": c.collectRPC,
|
||||||
|
"MapiHttpEmsmdb": c.collectMapiHttpEmsmdb,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, collectorName := range c.enabledCollectors {
|
for _, collectorName := range c.enabledCollectors {
|
||||||
@@ -663,6 +669,28 @@ func (c *collector) collectAutoDiscover(ctx *types.ScrapeContext, ch chan<- prom
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// perflib [26463] MSExchange MapiHttp Emsmdb
|
||||||
|
type perflibMapiHttpEmsmdb struct {
|
||||||
|
ActiveUserCount float64 `perflib:"Active User Count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *collector) collectMapiHttpEmsmdb(ctx *types.ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||||
|
var data []perflibMapiHttpEmsmdb
|
||||||
|
if err := perflib.UnmarshalObject(ctx.PerfObjects["MSExchange MapiHttp Emsmdb"], &data, c.logger); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, mapihttp := range data {
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.ActiveUserCountMapiHttpEmsmdb,
|
||||||
|
prometheus.GaugeValue,
|
||||||
|
mapihttp.ActiveUserCount,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// toLabelName converts strings to lowercase and replaces all whitespaces and dots with underscores
|
// toLabelName converts strings to lowercase and replaces all whitespaces and dots with underscores
|
||||||
func (c *collector) toLabelName(name string) string {
|
func (c *collector) toLabelName(name string) string {
|
||||||
s := strings.ReplaceAll(strings.Join(strings.Fields(strings.ToLower(name)), "_"), ".", "_")
|
s := strings.ReplaceAll(strings.Join(strings.Fields(strings.ToLower(name)), "_"), ".", "_")
|
||||||
|
|||||||
Reference in New Issue
Block a user