# Enable monitoring in ldap.

It is a prerequisite that the OpenLDAP monitoring module is enabled and configured.

Check if your monitoring module is enabled in your OpenLDAP installation:

```bash
ldapsearch -Y EXTERNAL -H ldapi:/// -b "cn=module{0},cn=config"
```

If`olcModuleLoad: {1}back_monitor` is included in the response, the monitoring module is enabled. You can skip to step 3.

To enable the monitoring module, create a `module_monitoring.ldif` file

```bash
dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: {1}back_monitor
```

and execute the command:

```bash
ldapmodify -Y EXTERNAL -H ldapi:/// -f module_monitoring.ldif
```

Create an encrypted password for the monitoring user:

```bash
slapdpasswd -s <MONITOR_USER_PASSWORD>
```

If this does not work, try the following:

```bash
sudo -i slappasswd
```

Create a cn\_monitor.ldif file

```bash
dn: <NEW_MONITORING_USER_DISTINGUISHED_NAME>
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: <COMMON_NAME_OF_THE_NEW_MONITORING_USER>
description: LDAP monitor
userPassword: <ENCRYPTED_PASSWORD>
```

[![image.png](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/scaled-1680-/gfFimage.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/gfFimage.png)

and run the following command to add the supervisory user:

```bash
ldapadd -x -D <ADMIN_DISTINGUISHED_NAME> -w <ADMIN_PASSWORD> -f cn_monitor.ldif
```

Create a database\_monitor.ldif file

```bash
dn: olcDatabase={2}Monitor,cn=config
objectClass: olcDatabaseConfig
objectClass: olcMonitorConfig
olcDatabase: {2}Monitor
olcAccess: {0}to dn.subtree="cn=Monitor" by dn.base="<NEW_MONITORING_USER_DISTINGUISHED_NAME>" read by * none
```

[![image.png](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/scaled-1680-/za5image.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/za5image.png)

and run the following command to configure the monitoring database:

```bash
ldapadd -Y EXTERNAL -H ldapi:/// -f database_monitor.ldif
```

View of all commands used

[![image.png](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/scaled-1680-/6eZimage.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/6eZimage.png)

To test the monitoring module, run the following command:

```bash
ldapsearch -x -D <NEW_MONITORING_USER_DISTINGUISHED_NAME> -w <MONITOR_USER_PASSWORD> -b cn=Uptime,cn=Time,cn=Monitor -s base '(objectClass=*)' '*' '+'
```

[![image.png](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/scaled-1680-/35Qimage.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/35Qimage.png)