From d2100abf8a49f7e3c6fbb32c46786addafe399d0 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Aug 2026 18:51:33 +0000 Subject: [PATCH] exchange: export LDAP average-timer denominator counters for ADAccess metrics (#2474) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jkroepke <1560587+jkroepke@users.noreply.github.com> Co-authored-by: Jan-Otto Kröpke Signed-off-by: Jan-Otto Kröpke --- docs/collector.exchange.md | 3 ++ .../exchange/exchange_ad_access_processes.go | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/docs/collector.exchange.md b/docs/collector.exchange.md index 0cfa1609..52167fd2 100644 --- a/docs/collector.exchange.md +++ b/docs/collector.exchange.md @@ -27,8 +27,11 @@ Comma-separated list of collectors to use, for example: `--collectors.exchange.e | `windows_exchange_rpc_operations_total` | The rate at which RPC operations occur | | `windows_exchange_rpc_user_count` | Number of users | | `windows_exchange_ldap_read_time_sec` | Time (sec) to send an LDAP read request and receive a response | +| `windows_exchange_ldap_read_operations_total` | Total number of LDAP read operations | | `windows_exchange_ldap_search_time_sec` | Time (sec) to send an LDAP search request and receive a response | +| `windows_exchange_ldap_search_operations_total` | Total number of LDAP search operations | | `windows_exchange_ldap_write_time_sec` | Time (sec) to send an LDAP Add/Modify/Delete request and receive a response | +| `windows_exchange_ldap_write_operations_total` | Total number of LDAP Add/Modify/Delete operations | | `windows_exchange_ldap_timeout_errors_total` | Total number of LDAP timeout errors | | `windows_exchange_ldap_long_running_ops_per_sec` | Long Running LDAP operations per second | | `windows_exchange_transport_queues_external_active_remote_delivery` | External Active Remote Delivery Queue length | diff --git a/internal/collector/exchange/exchange_ad_access_processes.go b/internal/collector/exchange/exchange_ad_access_processes.go index 4dfc645c..b507c329 100644 --- a/internal/collector/exchange/exchange_ad_access_processes.go +++ b/internal/collector/exchange/exchange_ad_access_processes.go @@ -30,9 +30,12 @@ type collectorADAccessProcesses struct { perfDataCollectorADAccessProcesses *pdh.Collector perfDataObjectADAccessProcesses []perfDataCounterValuesADAccessProcesses + ldapReadOperations *prometheus.Desc ldapReadTime *prometheus.Desc + ldapSearchOperations *prometheus.Desc ldapSearchTime *prometheus.Desc ldapTimeoutErrorsPerSec *prometheus.Desc + ldapWriteOperations *prometheus.Desc ldapWriteTime *prometheus.Desc longRunningLDAPOperationsPerMin *prometheus.Desc } @@ -41,8 +44,11 @@ type perfDataCounterValuesADAccessProcesses struct { Name string LdapReadTime float64 `perfdata:"LDAP Read Time"` + LdapReadOperationsTotal float64 `perfdata:"LDAP Read Time,secondvalue"` LdapSearchTime float64 `perfdata:"LDAP Search Time"` + LdapSearchOperationsTotal float64 `perfdata:"LDAP Search Time,secondvalue"` LdapWriteTime float64 `perfdata:"LDAP Write Time"` + LdapWriteOperationsTotal float64 `perfdata:"LDAP Write Time,secondvalue"` LdapTimeoutErrorsPerSec float64 `perfdata:"LDAP Timeout Errors/sec"` LongRunningLDAPOperationsPerMin float64 `perfdata:"Long Running LDAP Operations/min"` } @@ -61,18 +67,36 @@ func (c *Collector) buildADAccessProcesses() error { []string{"name"}, nil, ) + c.ldapReadOperations = prometheus.NewDesc( + prometheus.BuildFQName(types.Namespace, Name, "ldap_read_operations_total"), + "Total number of LDAP read operations", + []string{"name"}, + nil, + ) c.ldapSearchTime = prometheus.NewDesc( prometheus.BuildFQName(types.Namespace, Name, "ldap_search_time_sec"), "Time (sec) to send an LDAP search request and receive a response", []string{"name"}, nil, ) + c.ldapSearchOperations = prometheus.NewDesc( + prometheus.BuildFQName(types.Namespace, Name, "ldap_search_operations_total"), + "Total number of LDAP search operations", + []string{"name"}, + nil, + ) c.ldapWriteTime = prometheus.NewDesc( prometheus.BuildFQName(types.Namespace, Name, "ldap_write_time_sec"), "Time (sec) to send an LDAP Add/Modify/Delete request and receive a response", []string{"name"}, nil, ) + c.ldapWriteOperations = prometheus.NewDesc( + prometheus.BuildFQName(types.Namespace, Name, "ldap_write_operations_total"), + "Total number of LDAP Add/Modify/Delete operations", + []string{"name"}, + nil, + ) c.ldapTimeoutErrorsPerSec = prometheus.NewDesc( prometheus.BuildFQName(types.Namespace, Name, "ldap_timeout_errors_total"), "Total number of LDAP timeout errors", @@ -114,6 +138,13 @@ func (c *Collector) collectADAccessProcesses(ch chan<- prometheus.Metric) error labelName, ) + ch <- prometheus.MustNewConstMetric( + c.ldapReadOperations, + prometheus.CounterValue, + data.LdapReadOperationsTotal, + labelName, + ) + ch <- prometheus.MustNewConstMetric( c.ldapSearchTime, prometheus.CounterValue, @@ -121,6 +152,13 @@ func (c *Collector) collectADAccessProcesses(ch chan<- prometheus.Metric) error labelName, ) + ch <- prometheus.MustNewConstMetric( + c.ldapSearchOperations, + prometheus.CounterValue, + data.LdapSearchOperationsTotal, + labelName, + ) + ch <- prometheus.MustNewConstMetric( c.ldapWriteTime, prometheus.CounterValue, @@ -128,6 +166,13 @@ func (c *Collector) collectADAccessProcesses(ch chan<- prometheus.Metric) error labelName, ) + ch <- prometheus.MustNewConstMetric( + c.ldapWriteOperations, + prometheus.CounterValue, + data.LdapWriteOperationsTotal, + labelName, + ) + ch <- prometheus.MustNewConstMetric( c.ldapTimeoutErrorsPerSec, prometheus.CounterValue,