bdb_db_init( BackendDB *be )
{
struct bdb_info *bdb;
+ int rc;
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_db_init) ": Initializing " BDB_UCTYPE " database\n",
be->be_private = bdb;
be->be_cf_ocs = be->bd_info->bi_cf_ocs;
- return 0;
+ rc = bdb_monitor_init( be );
+
+ return rc;
}
static int
struct bdb_db_info *db;
bdb_idl_cache_entry_t *entry, *next_entry;
- /* monitor setup */
+ /* monitor handling */
(void)bdb_monitor_close( be );
bdb->bi_flags &= ~BDB_IS_OPEN;
int
bdb_monitor_init( BackendDB *be )
{
+ SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_MONITORING;
+
return 0;
}
return 0;
}
- /* monitor_back_register_entry_attrs() with a NULL ndn,
- * base="cn=Databases,cn=Monitor", scope=LDAP_SCOPE_ONE
- * and filter="(namingContexts:distinguishedNameMatch:=<suffix>)" */
-
- bdb->bi_monitor.bdm_scope = LDAP_SCOPE_ONELEVEL;
+ bdb->bi_monitor.bdm_scope = LDAP_SCOPE_SUBORDINATE;
base = &bdb->bi_monitor.bdm_nbase;
BER_BVSTR( base, "cn=databases,cn=monitor" );
filter = &bdb->bi_monitor.bdm_filter;
ldap_bv2escaped_filter_value( &be->be_nsuffix[ 0 ], &suffix );
}
- filter->bv_len = STRLENOF( "(namingContexts:distinguishedNameMatch:=)" ) + suffix.bv_len;
+ filter->bv_len = STRLENOF( "(&(monitoredInfo=" )
+ + strlen( be->bd_info->bi_type )
+ + STRLENOF( ")(namingContexts:distinguishedNameMatch:=" )
+ + suffix.bv_len + STRLENOF( "))" );
ptr = filter->bv_val = ch_malloc( filter->bv_len + 1 );
- ptr = lutil_strcopy( ptr, "(namingContexts:distinguishedNameMatch:=" );
+ ptr = lutil_strcopy( ptr, "(&(monitoredInfo=" );
+ ptr = lutil_strcopy( ptr, be->bd_info->bi_type );
+ ptr = lutil_strcopy( ptr, ")(namingContexts:distinguishedNameMatch:=" );
ptr = lutil_strncopy( ptr, suffix.bv_val, suffix.bv_len );
- ptr[ 0 ] = ')';
- ptr++;
+ ptr = lutil_strcopy( ptr, "))" );
ptr[ 0 ] = '\0';
assert( filter->bv_len == ptr - filter->bv_val );
cb->mc_private = (void *)bdb;
rc = monitor_back_register_entry_attrs( NULL, a, cb,
- base, LDAP_SCOPE_ONELEVEL, filter );
+ base, LDAP_SCOPE_SUBORDINATE, filter );
cleanup:;
if ( rc != 0 ) {