Skip to main content

OpenLDAP

Monitor OpenLDAP — operation rates, connection counts, thread usage, and replication status — using openldap_exporter.

Pattern: openldap_exporter → Prometheus scrape → xScaler remote_write


Prerequisites

  • OpenLDAP 2.4+
  • Bind credentials with access to cn=Monitor
  • xScaler tenant credentials (token + tenant ID)

Option A — Prometheus Exporter

docker run -d \
-p 9330:9330 \
-e LDAP_ADDR=ldap://localhost:389 \
-e LDAP_USER=cn=admin,dc=example,dc=com \
-e LDAP_PASS=secret \
tomcz/openldap_exporter

Add to prometheus.yml:

scrape_configs:
- job_name: openldap
static_configs:
- targets: ['localhost:9330']

remote_write:
- url: https://euw1-01.m.xscalerlabs.com/api/v1/push
authorization:
credentials: <token>
headers:
X-Scope-OrgID: <tenant-id>

Option B — Grafana Alloy

prometheus.scrape "openldap" {
targets = [{"__address__" = "localhost:9330"}]
forward_to = [prometheus.remote_write.xscaler.receiver]
scrape_interval = "30s"
}

prometheus.remote_write "xscaler" {
endpoint {
url = "https://euw1-01.m.xscalerlabs.com/api/v1/push"
authorization {
type = "Bearer"
credentials = "<token>"
}
headers = { "X-Scope-OrgID" = "<tenant-id>" }
}
}

Option C — OpenTelemetry Collector

receivers:
prometheus:
config:
scrape_configs:
- job_name: openldap
static_configs:
- targets: ['localhost:9330']
scrape_interval: 30s

processors:
batch:
timeout: 10s

exporters:
otlphttp/xscaler:
endpoint: https://euw1-01.m.xscalerlabs.com
headers:
Authorization: "Bearer <token>"
X-Scope-OrgID: "<tenant-id>"
compression: gzip

service:
pipelines:
metrics:
receivers: [prometheus]
processors: [batch]
exporters: [otlphttp/xscaler]

Logs

Collect OpenLDAP slapd log. Add the following to your Alloy config:

local.file_match "openldap_logs" {
path_targets = [{
__address__ = "localhost",
__path__ = "/var/log/slapd.log",
instance = constants.hostname,
job = "integrations/openldap",
}]
}

loki.source.file "openldap_logs" {
targets = local.file_match.openldap_logs.targets
forward_to = [loki.write.xscaler.receiver]
}

loki.write "xscaler" {
endpoint {
url = "https://euw1-01.l.xscalerlabs.com/api/v1/logs/push"

http_client_config {
authorization {
type = "Bearer"
credentials = env("XSCALER_TOKEN")
}
}

headers = { "X-Scope-OrgID" = env("XSCALER_TENANT_ID") }
}
}

Key metrics

MetricDescription
openldap_monitored_objectMonitored object count
openldap_operations_initiated_totalOperations initiated
openldap_operations_completed_totalOperations completed
openldap_connections_currentCurrent active connections
openldap_connections_totalTotal connections since start
openldap_waiters_writeThreads waiting for write lock
openldap_statistics_bytesTotal bytes sent