From d78230f67b8a6d2a9df4d7e5c2eff839c1121a4b Mon Sep 17 00:00:00 2001 From: Mark Dordoy Date: Wed, 30 Aug 2023 14:36:47 +0100 Subject: [PATCH 1/6] Add new counter Signed-off-by: Mark Dordoy --- collector/ad.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/collector/ad.go b/collector/ad.go index 783ccee1..c27511fd 100644 --- a/collector/ad.go +++ b/collector/ad.go @@ -59,6 +59,7 @@ type ADCollector struct { LdapSearchesTotal *prometheus.Desc LdapUdpOperationsTotal *prometheus.Desc LdapWritesTotal *prometheus.Desc + LdapClientSessions *Prometheus.Desc LinkValuesCleanedTotal *prometheus.Desc PhantomObjectsCleanedTotal *prometheus.Desc PhantomObjectsVisitedTotal *prometheus.Desc @@ -343,6 +344,12 @@ func newADCollector(logger log.Logger) (Collector, error) { nil, nil, ), + LdapClientSessions: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "client_sessions"), + "", + nil, + nil, + ), LinkValuesCleanedTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "link_values_cleaned_total"), "", @@ -1190,6 +1197,11 @@ func (c *ADCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er prometheus.CounterValue, float64(dst[0].LDAPWritesPersec), ) + ch <- prometheus.MustNewConstMetric( + c.LdapClientSessions, + prometheus.CounterValue, + float64(dst[0].LDAPClientSessions), + ) ch <- prometheus.MustNewConstMetric( c.LinkValuesCleanedTotal, From f8b8b2c54660cf8da44eaf2ddad86cf704b52abd Mon Sep 17 00:00:00 2001 From: Mark Dordoy Date: Wed, 30 Aug 2023 14:44:53 +0100 Subject: [PATCH 2/6] Added docs, updated to gague. Signed-off-by: Mark Dordoy Signed-off-by: Mark Dordoy --- collector/ad.go | 2 +- docs/collector.ad.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/collector/ad.go b/collector/ad.go index c27511fd..d93d598a 100644 --- a/collector/ad.go +++ b/collector/ad.go @@ -1199,7 +1199,7 @@ func (c *ADCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er ) ch <- prometheus.MustNewConstMetric( c.LdapClientSessions, - prometheus.CounterValue, + prometheus.GaugeValue, float64(dst[0].LDAPClientSessions), ) diff --git a/docs/collector.ad.md b/docs/collector.ad.md index 9ae159b9..c67e61e9 100644 --- a/docs/collector.ad.md +++ b/docs/collector.ad.md @@ -59,6 +59,7 @@ Name | Description | Type | Labels `windows_ad_ldap_searches_total` | _Not yet documented_ | counter | None `windows_ad_ldap_udp_operations_total` | _Not yet documented_ | counter | None `windows_ad_ldap_writes_total` | _Not yet documented_ | counter | None +`windows_ad_ldap_client_sessions` | | _Not yet documented_ | gauge | None `windows_ad_link_values_cleaned_total` | _Not yet documented_ | counter | None `windows_ad_phantom_objects_cleaned_total` | _Not yet documented_ | counter | None `windows_ad_phantom_objects_visited_total` | _Not yet documented_ | counter | None From 23e1a86aa7b1daa64950275854e3d0b6dbac6c2c Mon Sep 17 00:00:00 2001 From: Mark Dordoy Date: Wed, 30 Aug 2023 14:47:14 +0100 Subject: [PATCH 3/6] Fix docs Signed-off-by: Mark Dordoy --- docs/collector.ad.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/collector.ad.md b/docs/collector.ad.md index c67e61e9..fa70bcf6 100644 --- a/docs/collector.ad.md +++ b/docs/collector.ad.md @@ -59,7 +59,7 @@ Name | Description | Type | Labels `windows_ad_ldap_searches_total` | _Not yet documented_ | counter | None `windows_ad_ldap_udp_operations_total` | _Not yet documented_ | counter | None `windows_ad_ldap_writes_total` | _Not yet documented_ | counter | None -`windows_ad_ldap_client_sessions` | | _Not yet documented_ | gauge | None +`windows_ad_ldap_client_sessions` | _Not yet documented_ | gauge | None `windows_ad_link_values_cleaned_total` | _Not yet documented_ | counter | None `windows_ad_phantom_objects_cleaned_total` | _Not yet documented_ | counter | None `windows_ad_phantom_objects_visited_total` | _Not yet documented_ | counter | None From 1d027579d2a70d2cbfec6b07c02f5a954a913ef4 Mon Sep 17 00:00:00 2001 From: Mark Dordoy Date: Mon, 4 Sep 2023 09:39:26 +0100 Subject: [PATCH 4/6] Add description, fix typo on type Signed-off-by: Mark Dordoy --- collector/ad.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/ad.go b/collector/ad.go index d93d598a..3269492f 100644 --- a/collector/ad.go +++ b/collector/ad.go @@ -59,7 +59,7 @@ type ADCollector struct { LdapSearchesTotal *prometheus.Desc LdapUdpOperationsTotal *prometheus.Desc LdapWritesTotal *prometheus.Desc - LdapClientSessions *Prometheus.Desc + LdapClientSessions *prometheus.Desc LinkValuesCleanedTotal *prometheus.Desc PhantomObjectsCleanedTotal *prometheus.Desc PhantomObjectsVisitedTotal *prometheus.Desc @@ -346,7 +346,7 @@ func newADCollector(logger log.Logger) (Collector, error) { ), LdapClientSessions: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "client_sessions"), - "", + "This is the number of sessions opened by LDAP clients at the time the data is taken. This is helpful in determining LDAP client activity and if the DC is able to handle the load. Of course, spikes during normal periods of authentication — such as first thing in the morning — are not necessarily a problem, but long sustained periods of high values indicate an overworked DC.", nil, nil, ), From 5631166075acec9f4166c309d4ad81ebbc43e359 Mon Sep 17 00:00:00 2001 From: Mark Dordoy Date: Mon, 4 Sep 2023 09:40:50 +0100 Subject: [PATCH 5/6] Add description in docs Signed-off-by: Mark Dordoy --- docs/collector.ad.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/collector.ad.md b/docs/collector.ad.md index fa70bcf6..a7b6c4e6 100644 --- a/docs/collector.ad.md +++ b/docs/collector.ad.md @@ -59,7 +59,7 @@ Name | Description | Type | Labels `windows_ad_ldap_searches_total` | _Not yet documented_ | counter | None `windows_ad_ldap_udp_operations_total` | _Not yet documented_ | counter | None `windows_ad_ldap_writes_total` | _Not yet documented_ | counter | None -`windows_ad_ldap_client_sessions` | _Not yet documented_ | gauge | None +`windows_ad_ldap_client_sessions` | This is the number of sessions opened by LDAP clients at the time the data is taken. This is helpful in determining LDAP client activity and if the DC is able to handle the load. Of course, spikes during normal periods of authentication — such as first thing in the morning — are not necessarily a problem, but long sustained periods of high values indicate an overworked DC | gauge | None `windows_ad_link_values_cleaned_total` | _Not yet documented_ | counter | None `windows_ad_phantom_objects_cleaned_total` | _Not yet documented_ | counter | None `windows_ad_phantom_objects_visited_total` | _Not yet documented_ | counter | None From ca6eb7568523f1104585d109e93f20e929339bda Mon Sep 17 00:00:00 2001 From: Mark Dordoy Date: Mon, 4 Sep 2023 09:49:02 +0100 Subject: [PATCH 6/6] add recommendation to prefix with ldap Signed-off-by: Mark Dordoy --- collector/ad.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/ad.go b/collector/ad.go index 3269492f..16304388 100644 --- a/collector/ad.go +++ b/collector/ad.go @@ -345,7 +345,7 @@ func newADCollector(logger log.Logger) (Collector, error) { nil, ), LdapClientSessions: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, subsystem, "client_sessions"), + prometheus.BuildFQName(Namespace, subsystem, "ldap_client_sessions"), "This is the number of sessions opened by LDAP clients at the time the data is taken. This is helpful in determining LDAP client activity and if the DC is able to handle the load. Of course, spikes during normal periods of authentication — such as first thing in the morning — are not necessarily a problem, but long sustained periods of high values indicate an overworked DC.", nil, nil,