LDAP_BEGIN_DECL
-/* #define MONITOR_DEVEL */
-
/*
* The cache maps DNs to Entries.
* Each entry, on turn, holds the list of its children in the e_private field.
};
struct monitorinfo {
+
+ /*
+ * Internal data
+ */
Avlnode *mi_cache;
ldap_pvt_thread_mutex_t mi_cache_mutex;
- ObjectClass *monitor_oc_monitorServer;
- ObjectClass *monitor_oc_monitorContainer;
- ObjectClass *monitor_oc_monitorCounter;
- ObjectClass *monitor_oc_monitorOperation;
- ObjectClass *monitor_oc_monitorConnection;
- ObjectClass *monitor_oc_managedObject;
- ObjectClass *monitor_oc_monitoredObject;
-
- AttributeDescription *monitor_ad_monitoredInfo;
- AttributeDescription *monitor_ad_managedInfo;
- AttributeDescription *monitor_ad_monitorCounter;
- AttributeDescription *monitor_ad_monitorOpCompleted;
- AttributeDescription *monitor_ad_monitorOpInitiated;
- AttributeDescription *monitor_ad_monitorConnectionNumber;
- AttributeDescription *monitor_ad_monitorConnectionAuthzDN;
- AttributeDescription *monitor_ad_monitorConnectionLocalAddress;
- AttributeDescription *monitor_ad_monitorConnectionPeerAddress;
-
- AttributeDescription *monitor_ad_description;
+ /*
+ * Config parameters
+ */
+ struct berval l;
+
+ /*
+ * Specific schema entities
+ */
+ ObjectClass *oc_monitor;
+ ObjectClass *oc_monitorServer;
+ ObjectClass *oc_monitorContainer;
+ ObjectClass *oc_monitorCounterObject;
+ ObjectClass *oc_monitorOperation;
+ ObjectClass *oc_monitorConnection;
+ ObjectClass *oc_managedObject;
+ ObjectClass *oc_monitoredObject;
+
+ AttributeDescription *ad_monitoredInfo;
+ AttributeDescription *ad_managedInfo;
+ AttributeDescription *ad_monitorCounter;
+ AttributeDescription *ad_monitorOpCompleted;
+ AttributeDescription *ad_monitorOpInitiated;
+ AttributeDescription *ad_monitorConnectionNumber;
+ AttributeDescription *ad_monitorConnectionAuthzDN;
+ AttributeDescription *ad_monitorConnectionLocalAddress;
+ AttributeDescription *ad_monitorConnectionPeerAddress;
+
+ /*
+ * Generic description attribute
+ */
+ AttributeDescription *ad_description;
+ AttributeDescription *ad_seeAlso;
};
/*
#define SLAPD_MONITOR_CONN_DN \
SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
-#define SLAPD_MONITOR_READW 7
-#define SLAPD_MONITOR_READW_NAME "Read Waiters"
-#define SLAPD_MONITOR_READW_RDN \
- "cn=" SLAPD_MONITOR_READW_NAME
-#define SLAPD_MONITOR_READW_DN \
- SLAPD_MONITOR_READW_RDN "," SLAPD_MONITOR_DN
-
-#define SLAPD_MONITOR_WRITEW 8
-#define SLAPD_MONITOR_WRITEW_NAME "Write Waiters"
-#define SLAPD_MONITOR_WRITEW_RDN \
- "cn=" SLAPD_MONITOR_WRITEW_NAME
-#define SLAPD_MONITOR_WRITEW_DN \
- SLAPD_MONITOR_WRITEW_RDN "," SLAPD_MONITOR_DN
-
-#define SLAPD_MONITOR_LOG 9
+#define SLAPD_MONITOR_RWW 7
+#define SLAPD_MONITOR_RWW_NAME "Waiters"
+#define SLAPD_MONITOR_RWW_RDN \
+ "cn=" SLAPD_MONITOR_RWW_NAME
+#define SLAPD_MONITOR_RWW_DN \
+ SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
+
+#define SLAPD_MONITOR_LOG 8
#define SLAPD_MONITOR_LOG_NAME "Log"
#define SLAPD_MONITOR_LOG_RDN \
"cn=" SLAPD_MONITOR_LOG_NAME
#define SLAPD_MONITOR_LOG_DN \
SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
-#define SLAPD_MONITOR_OPS 10
+#define SLAPD_MONITOR_OPS 9
#define SLAPD_MONITOR_OPS_NAME "Operations"
#define SLAPD_MONITOR_OPS_RDN \
"cn=" SLAPD_MONITOR_OPS_NAME
#define SLAPD_MONITOR_OPS_DN \
SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
-#define SLAPD_MONITOR_SENT 11
+#define SLAPD_MONITOR_SENT 10
#define SLAPD_MONITOR_SENT_NAME "Statistics"
#define SLAPD_MONITOR_SENT_RDN \
"cn=" SLAPD_MONITOR_SENT_NAME
#define SLAPD_MONITOR_SENT_DN \
SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
-#define SLAPD_MONITOR_TIME 12
+#define SLAPD_MONITOR_TIME 11
#define SLAPD_MONITOR_TIME_NAME "Time"
#define SLAPD_MONITOR_TIME_RDN \
"cn=" SLAPD_MONITOR_TIME_NAME
#define SLAPD_MONITOR_TIME_DN \
SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
-#define SLAPD_MONITOR_OBJECTCLASSES \
- "objectClass: top\n" \
- "objectClass: monitor\n" \
- "objectClass: extensibleObject\n" \
- "structuralObjectClass: monitor\n"
-
struct monitorsubsys {
int mss_type;
char *mss_name;
char buf[1024];
BackendInfo *bi;
struct berval bv;
+ int j;
bi = &backendInfo[i];
snprintf( buf, sizeof( buf ),
"dn: cn=Backend %d,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Backend %d\n",
i,
monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
i );
e = str2entry( buf );
bv.bv_val = bi->bi_type;
bv.bv_len = strlen( bv.bv_val );
- attr_merge_normalize_one( e, mi->monitor_ad_description,
+ attr_merge_normalize_one( e, mi->ad_monitoredInfo,
&bv, NULL );
- attr_merge_normalize_one( e_backend, mi->monitor_ad_description,
+ attr_merge_normalize_one( e_backend, mi->ad_monitoredInfo,
&bv, NULL );
if ( bi->bi_controls ) {
attr_merge_one( e, slap_schema.si_ad_supportedControl, &bv, NULL );
}
}
+
+ for ( j = 0; j < nBackendDB; j++ ) {
+ BackendDB *be = &backendDB[j];
+ char buf[ SLAP_LDAPDN_MAXLEN ];
+ struct berval dn;
+
+ if ( be->bd_info != bi ) {
+ continue;
+ }
+
+ snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
+ j, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val );
+ dn.bv_val = buf;
+ dn.bv_len = strlen( buf );
+
+ attr_merge_normalize_one( e, mi->ad_seeAlso,
+ &dn, NULL );
+ }
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Total,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Total\n",
- monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Current,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Current\n",
- monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
Attribute *a;
char buf[16];
- a = attr_find( e->e_attrs, mi->monitor_ad_description );
+ a = attr_find( e->e_attrs, mi->ad_monitorCounter );
if ( a == NULL ) {
return( -1 );
}
snprintf( buf, sizeof( buf ),
"dn: cn=" CONN_CN_PREFIX " %ld,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: " CONN_CN_PREFIX " %ld\n",
c->c_connid, monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
+ mi->oc_monitorConnection->soc_cname.bv_val,
+ mi->oc_monitorConnection->soc_cname.bv_val,
c->c_connid );
e = str2entry( buf );
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
+ /* monitored info */
sprintf( buf,
"%ld : %ld "
": %ld/%ld/%ld/%ld "
bv.bv_val = buf;
bv.bv_len = strlen( buf );
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitoredInfo, &bv, NULL );
+
+ /* connection number */
+ snprintf( buf, sizeof( buf ), "%ld", c->c_connid );
+ bv.bv_val = buf;
+ bv.bv_len = strlen( buf );
+ attr_merge_one( e, mi->ad_monitorConnectionNumber, &bv, NULL );
+
+ /* authz DN */
+ attr_merge_one( e, mi->ad_monitorConnectionAuthzDN,
+ &c->c_dn, &c->c_ndn );
+
+ /* local address */
+ attr_merge_one( e, mi->ad_monitorConnectionLocalAddress,
+ &c->c_sock_name, NULL );
+
+ /* peer address */
+ attr_merge_one( e, mi->ad_monitorConnectionPeerAddress,
+ &c->c_peer_name, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
c = connection_next( c, &connindex )) {
if ( c->c_connid == connid ) {
if ( conn_create( mi, c, ep ) || *ep == NULL ) {
- connection_done(c);
+ connection_done( c );
return( -1 );
}
Entry *e, *e_database, *e_tmp;
int i;
struct monitorentrypriv *mp;
- AttributeDescription *ad_nc = slap_schema.si_ad_namingContexts;
- AttributeDescription *ad_mc = slap_schema.si_ad_monitorContext;
- AttributeDescription *ad_seeAlso = NULL;
const char *text = NULL;
assert( be != NULL );
return( -1 );
}
- if ( slap_str2ad( "seeAlso", &ad_seeAlso, &text ) != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_database_init: "
- "unable to find 'seeAlso' attribute description\n",
- 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_database_init: "
- "unable to find 'seeAlso' attribute description\n",
- 0, 0, 0 );
-#endif
- return( -1 );
- }
-
e_tmp = NULL;
for ( i = nBackendDB; i--; ) {
char buf[1024];
snprintf( buf, sizeof( buf ),
"dn: cn=Database %d,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Database %d\n"
- "description: %s",
+ "description: This object contains the type of the database.\n"
+ "%s: %s",
i,
monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
i,
+ mi->ad_monitoredInfo->ad_cname.bv_val,
be->bd_info->bi_type );
e = str2entry( buf );
}
if ( be->be_flags & SLAP_BFLAG_MONITOR ) {
- attr_merge( e, ad_mc, be->be_suffix, be->be_nsuffix );
- attr_merge( e_database, ad_mc, be->be_suffix, be->be_nsuffix );
+ attr_merge( e, slap_schema.si_ad_monitorContext,
+ be->be_suffix, be->be_nsuffix );
+ attr_merge( e_database, slap_schema.si_ad_monitorContext,
+ be->be_suffix, be->be_nsuffix );
} else {
- attr_merge( e, ad_nc, be->be_suffix, be->be_nsuffix );
- attr_merge( e_database, ad_nc, be->be_suffix, be->be_nsuffix );
+ attr_merge( e, slap_schema.si_ad_namingContexts,
+ be->be_suffix, be->be_nsuffix );
+ attr_merge( e_database, slap_schema.si_ad_namingContexts,
+ be->be_suffix, be->be_nsuffix );
}
for ( j = nBackendInfo; j--; ) {
j, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val );
bv.bv_val = buf;
bv.bv_len = strlen( buf );
- attr_merge_normalize_one( e, ad_seeAlso, &bv, NULL );
+ attr_merge_normalize_one( e, mi->ad_seeAlso,
+ &bv, NULL );
break;
}
}
bv.bv_val = buf;
bv.bv_len = strlen( buf );
attr_merge_normalize_one( e_database,
- mi->monitor_ad_description, &bv, NULL );
+ mi->ad_monitoredInfo, &bv, NULL );
i++;
monitor_subsys_conn_create,
NULL /* modify */
}, {
- SLAPD_MONITOR_READW, SLAPD_MONITOR_READW_NAME,
+ SLAPD_MONITOR_RWW, SLAPD_MONITOR_RWW_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
- MONITOR_F_NONE,
- NULL, /* init */
- monitor_subsys_readw_update,
+ MONITOR_F_PERSISTENT_CH,
+ monitor_subsys_rww_init,
+ monitor_subsys_rww_update,
NULL, /* create */
NULL /* modify */
- }, {
- SLAPD_MONITOR_WRITEW, SLAPD_MONITOR_WRITEW_NAME,
- BER_BVNULL, BER_BVNULL, BER_BVNULL,
- MONITOR_F_NONE,
- NULL, /* init */
- monitor_subsys_writew_update,
- NULL, /* create */
- NULL /* modify */
}, {
SLAPD_MONITOR_LOG, SLAPD_MONITOR_LOG_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
)
{
struct monitorinfo *mi;
+ int rc;
+ struct berval dn, ndn;
+ struct berval bv;
+
+ /*
+ * database monitor can be defined once only
+ */
+ if ( be_monitor ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "only one monitor backend is allowed\n", 0, 0, 0);
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "only one monitor backend is allowed\n", 0, 0, 0 );
+#endif
+ return( -1 );
+ }
+ be_monitor = be;
+
+ /* indicate system schema supported */
+ be->be_flags |= SLAP_BFLAG_MONITOR;
+
+ dn.bv_val = SLAPD_MONITOR_DN;
+ dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
+
+ rc = dnNormalize2( NULL, &dn, &ndn, NULL );
+ if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "unable to normalize monitor DN \"" SLAPD_MONITOR_DN
+ "\"\n" , 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "unable to normalize monitor DN \"" SLAPD_MONITOR_DN
+ "\"\n", 0, 0, 0 );
+#endif
+ return -1;
+ }
+
+ ber_dupbv( &bv, &dn );
+ ber_bvarray_add( &be->be_suffix, &bv );
+ ber_bvarray_add( &be->be_nsuffix, &ndn );
+
+ mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
+ if ( mi == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "unable to initialize monitor backend\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "unable to initialize monitor backend\n", 0, 0, 0 );
+#endif
+ return -1;
+ }
+
+ memset( mi, 0, sizeof( struct monitorinfo ) );
+
+ ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
+
+ be->be_private = mi;
+
+ return 0;
+}
+
+int
+monitor_back_db_open(
+ BackendDB *be
+)
+{
+ struct monitorinfo *mi = (struct monitorinfo *)be->be_private;
+ struct monitorsubsys *ms;
Entry *e, *e_tmp;
struct monitorentrypriv *mp;
- int i, rc;
+ int i;
char buf[1024], *end_of_line;
- struct berval dn, ndn;
const char *text;
struct berval bv;
struct m_s {
char *schema;
int offset;
} moc[] = {
-#ifdef MONITOR_DEVEL
+ { "monitor", "( 1.3.6.1.4.1.4203.666.3.2 "
+ "NAME 'monitor' "
+ "DESC 'OpenLDAP system monitoring' "
+ "SUP top STRUCTURAL "
+ "MUST cn "
+ "MAY ( "
+ "description "
+ "$ seeAlso "
+ "$ monitoredInfo "
+ ") )",
+ offsetof(struct monitorinfo, oc_monitor) },
{ "monitorServer", "( 1.3.6.1.4.1.4203.666.3.7 "
"NAME 'monitorServer' "
"DESC 'Server monitoring root entry' "
- "SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_monitorServer) },
+ "SUP monitor STRUCTURAL "
+ "MAY ( "
+ "l "
+ ") )",
+ offsetof(struct monitorinfo, oc_monitorServer) },
{ "monitorContainer", "( 1.3.6.1.4.1.4203.666.3.8 "
"NAME 'monitorContainer' "
"DESC 'monitor container class' "
"SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_monitorContainer) },
- { "monitorCounter", "( 1.3.6.1.4.1.4203.666.3.9 "
- "NAME 'monitorCounter' "
+ offsetof(struct monitorinfo, oc_monitorContainer) },
+ { "monitorCounterObject", "( 1.3.6.1.4.1.4203.666.3.9 "
+ "NAME 'monitorCounterObject' "
"DESC 'monitor counter class' "
"SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_monitorCounter) },
+ offsetof(struct monitorinfo, oc_monitorCounterObject) },
{ "monitorOperation", "( 1.3.6.1.4.1.4203.666.3.10 "
"NAME 'monitorOperation' "
"DESC 'monitor operation class' "
"SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_monitorOperation) },
+ offsetof(struct monitorinfo, oc_monitorOperation) },
{ "monitorConnection", "( 1.3.6.1.4.1.4203.666.3.11 "
"NAME 'monitorConnection' "
"DESC 'monitor connection class' "
"SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_monitorConnection) },
+ offsetof(struct monitorinfo, oc_monitorConnection) },
{ "managedObject", "( 1.3.6.1.4.1.4203.666.3.12 "
"NAME 'managedObject' "
"DESC 'monitor managed entity class' "
"SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_managedObject) },
+ offsetof(struct monitorinfo, oc_managedObject) },
{ "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.13 "
"NAME 'monitoredObject' "
"DESC 'monitor monitored entity class' "
"SUP monitor STRUCTURAL )",
- offsetof(struct monitorinfo, monitor_oc_monitoredObject) },
-#endif /* MONITOR_DEVEL */
+ offsetof(struct monitorinfo, oc_monitoredObject) },
{ NULL, NULL, -1 }
}, mat[] = {
-#ifdef MONITOR_DEVEL
{ "monitoredInfo", "( 1.3.6.1.4.1.4203.666.1.14 "
"NAME 'monitoredInfo' "
"DESC 'monitored info' "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo, monitor_ad_monitoredInfo) },
+ offsetof(struct monitorinfo, ad_monitoredInfo) },
{ "managedInfo", "( 1.3.6.1.4.1.4203.666.1.15 "
"NAME 'managedInfo' "
"DESC 'monitor managed info' "
"SUP name )",
- offsetof(struct monitorinfo, monitor_ad_managedInfo) },
+ offsetof(struct monitorinfo, ad_managedInfo) },
{ "monitorCounter", "( 1.3.6.1.4.1.4203.666.1.16 "
"NAME 'monitorCounter' "
"DESC 'monitor counter' "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo, monitor_ad_monitorCounter) },
+ offsetof(struct monitorinfo, ad_monitorCounter) },
{ "monitorOpCompleted", "( 1.3.6.1.4.1.4203.666.1.17 "
"NAME 'monitorOpCompleted' "
"DESC 'monitor completed operations' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo, monitor_ad_monitorOpCompleted) },
+ offsetof(struct monitorinfo, ad_monitorOpCompleted) },
{ "monitorOpInitiated", "( 1.3.6.1.4.1.4203.666.1.18 "
"NAME 'monitorOpInitiated' "
"DESC 'monitor initiated operations' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo, monitor_ad_monitorOpInitiated) },
+ offsetof(struct monitorinfo, ad_monitorOpInitiated) },
{ "monitorConnectionNumber", "( 1.3.6.1.4.1.4203.666.1.19 "
"NAME 'monitorConnectionNumber' "
"DESC 'monitor connection number' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo, monitor_ad_monitorConnectionNumber) },
+ offsetof(struct monitorinfo, ad_monitorConnectionNumber) },
{ "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.1.20 "
"NAME 'monitorConnectionAuthzDN' "
"DESC 'monitor connection authorization DN' "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo, monitor_ad_monitorConnectionAuthzDN) },
+ offsetof(struct monitorinfo, ad_monitorConnectionAuthzDN) },
{ "monitorConnectionLocalAddress", "( 1.3.6.1.4.1.4203.666.1.21 "
"NAME 'monitorConnectionLocalAddress' "
"DESC 'monitor connection local address' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo,
- monitor_ad_monitorConnectionLocalAddress) },
+ offsetof(struct monitorinfo, ad_monitorConnectionLocalAddress) },
{ "monitorConnectionPeerAddress", "( 1.3.6.1.4.1.4203.666.1.22 "
"NAME 'monitorConnectionPeerAddress' "
"DESC 'monitor connection peer address' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )",
- offsetof(struct monitorinfo,
- monitor_ad_monitorConnectionPeerAddress) },
-#endif /* MONITOR_DEVEL */
+ offsetof(struct monitorinfo, ad_monitorConnectionPeerAddress) },
{ NULL, NULL, -1 }
};
- /*
- * database monitor can be defined once only
- */
- if ( be_monitor ) {
+ for ( i = 0; mat[i].name; i++ ) {
+ LDAPAttributeType *at;
+ int code;
+ const char *err;
+ AttributeDescription **ad;
+
+ at = ldap_str2attributetype( mat[i].schema, &code,
+ &err, LDAP_SCHEMA_ALLOW_ALL );
+ if ( !at ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "only one monitor backend is allowed\n", 0, 0, 0);
+ LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
+ "in AttributeType '%s' %s before %s\n",
+ mat[i].name, ldap_scherr2str(code), err );
#else
- Debug( LDAP_DEBUG_ANY,
- "only one monitor backend is allowed\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
+ "in AttributeType '%s' %s before %s\n",
+ mat[i].name, ldap_scherr2str(code), err );
#endif
- return( -1 );
- }
- be_monitor = be;
+ return -1;
+ }
- /* indicate system schema supported */
- be->be_flags |= SLAP_BFLAG_MONITOR;
+ if ( at->at_oid == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
+ "null OID for attributeType '%s'\n",
+ mat[i].name, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
+ "null OID for attributeType '%s'\n",
+ mat[i].name, 0, 0 );
+#endif
+ return -1;
+ }
- dn.bv_val = SLAPD_MONITOR_DN;
- dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
+ code = at_add(at, &err);
+ if ( code ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
+ "%s in attributeType '%s'\n",
+ scherr2str(code), mat[i].name, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
+ "%s in attributeType '%s'\n",
+ scherr2str(code), mat[i].name, 0 );
+#endif
+ return -1;
+ }
+ ldap_memfree(at);
- rc = dnNormalize2( NULL, &dn, &ndn, NULL );
- if( rc != LDAP_SUCCESS ) {
+ ad = ((AttributeDescription **)&(((char *)mi)[mat[i].offset]));
+ ad[0] = NULL;
+ if ( slap_str2ad( mat[i].name, ad, &text ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_back_db_init: %s\n", text, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_back_db_init: %s\n", text, 0, 0 );
+#endif
+ return -1;
+ }
+ }
+
+ if ( slap_str2ad( "description", &mi->ad_description, &text ) ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
- "unable to normalize monitor DN \"" SLAPD_MONITOR_DN
- "\"\n" , 0, 0, 0 );
+ "monitor_back_db_init: description: %s\n", text, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "unable to normalize monitor DN \"" SLAPD_MONITOR_DN
- "\"\n", 0, 0, 0 );
+ "monitor_back_db_init: description: %s\n", text, 0, 0 );
#endif
- return -1;
+ return( -1 );
}
- ber_dupbv( &bv, &dn );
- ber_bvarray_add( &be->be_suffix, &bv );
- ber_bvarray_add( &be->be_nsuffix, &ndn );
-
- mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
- if ( mi == NULL ) {
+ if ( slap_str2ad( "seeAlso", &mi->ad_seeAlso, &text ) ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
- "unable to initialize monitor backend\n", 0, 0, 0 );
+ "monitor_back_db_init: seeAlso: %s\n", text, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "unable to initialize monitor backend\n", 0, 0, 0 );
+ "monitor_back_db_init: seeAlso: %s\n", text, 0, 0 );
#endif
- return -1;
+ return( -1 );
}
- ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
-
for ( i = 0; moc[i].name; i++ ) {
LDAPObjectClass *oc;
int code;
return -1;
}
- code = oc_add(oc,1,&err);
+ code = oc_add(oc, 0, &err);
if ( code ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
- "objectclass '%s': %s before %s\n" ,
+ "objectclass '%s': %s \"%s\"\n" ,
moc[i].name, scherr2str(code), err );
#else
Debug( LDAP_DEBUG_ANY,
- "objectclass '%s': %s before %s\n" ,
+ "objectclass '%s': %s \"%s\"\n" ,
moc[i].name, scherr2str(code), err );
#endif
return -1;
Oc = oc_find( moc[i].name );
if ( Oc == NULL ) {
- return -1;
- }
-
- ((ObjectClass **)&(((char *)mi)[moc[i].offset]))[0] = Oc;
- }
-
- for ( i = 0; mat[i].name; i++ ) {
- LDAPAttributeType *at;
- int code;
- const char *err;
- AttributeDescription **ad;
-
- at = ldap_str2attributetype( mat[i].schema, &code,
- &err, LDAP_SCHEMA_ALLOW_ALL );
- if ( !at ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
- "in AttributeType '%s' %s before %s\n",
- mat[i].name, ldap_scherr2str(code), err );
-#else
- Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
- "in AttributeType '%s' %s before %s\n",
- mat[i].name, ldap_scherr2str(code), err );
-#endif
- return -1;
- }
-
- if ( at->at_oid == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
- "null OID for attributeType '%s'\n",
- mat[i].name, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
- "null OID for attributeType '%s'\n",
- mat[i].name, 0, 0 );
-#endif
- return -1;
- }
-
- code = at_add(at,&err);
- if ( code ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
- "%s in attributeType '%s'\n",
- scherr2str(code), mat[i].name, 0 );
+ "unable to find objectClass %s "
+ "(just added)\n", moc[i].name, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
- "%s in attributeType '%s'\n",
- scherr2str(code), mat[i].name, 0 );
+ "unable to find objectClass %s "
+ "(just added)\n", moc[i].name, 0, 0 );
#endif
return -1;
}
- ldap_memfree(at);
- ad = ((AttributeDescription **)&(((char *)mi)[mat[i].offset]));
- ad[0] = NULL;
- if ( slap_str2ad( mat[i].name, ad, &text ) ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_back_db_init: %s\n", text, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_back_db_init: %s\n", text, 0, 0 );
-#endif
- return -1;
- }
- }
-
- if ( slap_str2ad( "description", &mi->monitor_ad_description, &text ) ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_back_db_init: %s\n", text, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_back_db_init: %s\n", text, 0, 0 );
-#endif
- return( -1 );
+ ((ObjectClass **)&(((char *)mi)[moc[i].offset]))[0] = Oc;
}
/*
snprintf( buf, sizeof( buf ),
"dn: %s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: %s\n",
monitor_subsys[ i ].mss_dn.bv_val,
+ mi->oc_monitorContainer->soc_cname.bv_val,
+ mi->oc_monitorContainer->soc_cname.bv_val,
monitor_subsys[ i ].mss_name );
e = str2entry( buf );
* creates the "cn=Monitor" entry
*/
snprintf( buf, sizeof( buf ),
- "dn: " SLAPD_MONITOR_DN "\n"
- "objectClass: top\n"
- "objectClass: monitor\n"
- "objectClass: extensibleObject\n"
- "structuralObjectClass: monitor\n"
- "cn: Monitor" );
+ "dn: " SLAPD_MONITOR_DN "\n"
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
+ "cn: Monitor\n"
+ "%s: This subtree contains monitoring/managing objects.\n"
+ "%s: This object contains information about this server.\n"
+ "%s: createTimeStamp reflects the time this server instance was created.\n"
+ "%s: modifyTimeStamp reflects the current time.\n",
+ mi->oc_monitorServer->soc_cname.bv_val,
+ mi->oc_monitorServer->soc_cname.bv_val,
+ mi->ad_description->ad_cname.bv_val,
+ mi->ad_description->ad_cname.bv_val,
+ mi->ad_description->ad_cname.bv_val,
+ mi->ad_description->ad_cname.bv_val );
e = str2entry( buf );
if ( e == NULL) {
SLAPD_MONITOR_DN, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "unable to create '%s' entry\n%s%s",
- SLAPD_MONITOR_DN, "", "" );
+ "unable to create '%s' entry\n",
+ SLAPD_MONITOR_DN, 0, 0 );
#endif
return( -1 );
}
+
bv.bv_val = (char *) Versionstr;
end_of_line = strchr( Versionstr, '\n' );
if ( end_of_line ) {
} else {
bv.bv_len = strlen( Versionstr );
}
- if ( attr_merge_normalize_one( e, mi->monitor_ad_description,
+
+ if ( attr_merge_normalize_one( e, mi->ad_monitoredInfo,
&bv, NULL ) ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
- "unable to add description to '%s' entry\n",
+ "unable to add monitoredInfo to '%s' entry\n",
SLAPD_MONITOR_DN, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "unable to add description to '%s' entry\n%s%s",
- SLAPD_MONITOR_DN, "", "" );
+ "unable to add monitoredInfo to '%s' entry\n",
+ SLAPD_MONITOR_DN, 0, 0 );
#endif
return( -1 );
}
+ if ( mi->l.bv_len ) {
+ AttributeDescription *ad = NULL;
+ const char *text = NULL;
+
+ if ( slap_str2ad( "l", &ad, &text ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT, "unable to get 'l'\n",
+ SLAPD_MONITOR_DN, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "unable to get 'l'\n",
+ SLAPD_MONITOR_DN, 0, 0 );
+#endif
+ return( -1 );
+ }
+
+ if ( attr_merge_normalize_one( e, ad, &mi->l, NULL ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "unable to add locality to '%s' entry\n",
+ SLAPD_MONITOR_DN, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "unable to add locality to '%s' entry\n",
+ SLAPD_MONITOR_DN, 0, 0 );
+#endif
+ return( -1 );
+ }
+ }
+
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
SLAPD_MONITOR_DN, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "unable to add entry '%s' to cache\n%s%s",
- SLAPD_MONITOR_DN, "", "" );
+ "unable to add entry '%s' to cache\n",
+ SLAPD_MONITOR_DN, 0, 0 );
#endif
return -1;
}
be->be_private = mi;
- return 0;
-}
-
-int
-monitor_back_db_open(
- BackendDB *be
-)
-{
- struct monitorsubsys *ms;
-
assert( be );
/*
char **argv
)
{
+ struct monitorinfo *mi = (struct monitorinfo *)be->be_private;
+
/*
* eventually, will hold database specific configuration parameters
*/
+ if ( strcasecmp( argv[ 0 ], "l" ) == 0 ) {
+ if ( argc != 2 ) {
+ return 1;
+ }
+
+ ber_str2bv( argv[ 1 ], 0, 1, &mi->l );
+
+ } else {
#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, INFO,
- "line %d of file '%s' will be ignored\n", lineno, fname, 0 );
+ LDAP_LOG( CONFIG, INFO,
+ "line %d of file '%s' will be ignored\n",
+ lineno, fname, 0 );
#else
- Debug( LDAP_DEBUG_CONFIG,
- "line %d of file '%s' will be ignored\n%s", lineno, fname, "" );
+ Debug( LDAP_DEBUG_CONFIG,
+ "line %d of file '%s' will be ignored\n",
+ lineno, fname, 0 );
#endif
+ }
+
return( 0 );
}
snprintf( buf, sizeof( buf ),
"dn: cn=Listener %d,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Listener %d\n"
- "description: %s\n"
+ "%s: %s\n"
"labeledURI: %s",
i,
monitor_subsys[SLAPD_MONITOR_LISTENER].mss_dn.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
i,
+ mi->ad_monitorConnectionLocalAddress->ad_cname.bv_val,
l[i]->sl_name.bv_val,
l[i]->sl_url.bv_val );
bv.bv_val = "TLS";
bv.bv_len = sizeof("TLS")-1;
- attr_merge_normalize_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_normalize_one( e, mi->ad_monitoredInfo,
+ &bv, NULL );
}
#endif /* HAVE_TLS */
#ifdef LDAP_CONNECTIONLESS
bv.bv_val = "UDP";
bv.bv_len = sizeof("UDP")-1;
- attr_merge_normalize_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_normalize_one( e, mi->ad_monitoredInfo,
+ &bv, NULL );
}
#endif /* HAVE_TLS */
struct monitorinfo *mi;
Entry *e;
int i;
- struct berval bv[2];
+ struct berval desc[] = {
+ BER_BVC("This entry allows to set the log level runtime."),
+ BER_BVC("Set the attribute 'managedInfo' to the desired log levels."),
+ { 0, NULL }
+ };
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
return( -1 );
}
- bv[1].bv_val = NULL;
-
/* initialize the debug level(s) */
for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
- if ( mi->monitor_ad_description->ad_type->sat_equality->smr_normalize ) {
+ if ( mi->ad_managedInfo->ad_type->sat_equality->smr_normalize ) {
int rc;
- rc = (*mi->monitor_ad_description->ad_type->sat_equality->smr_normalize)(
+ rc = (*mi->ad_managedInfo->ad_type->sat_equality->smr_normalize)(
0,
- mi->monitor_ad_description->ad_type->sat_syntax,
- mi->monitor_ad_description->ad_type->sat_equality,
+ mi->ad_managedInfo->ad_type->sat_syntax,
+ mi->ad_managedInfo->ad_type->sat_equality,
&int_2_level[ i ].s,
&int_2_level[ i ].n, NULL );
if ( rc ) {
}
if ( int_2_level[ i ].i & ldap_syslog ) {
- attr_merge_one( e, mi->monitor_ad_description,
+ attr_merge_one( e, mi->ad_managedInfo,
&int_2_level[ i ].s,
&int_2_level[ i ].n );
}
}
+ attr_merge( e, mi->ad_description, desc, NULL );
+
monitor_cache_release( mi, e );
return( 0 );
/*
* only the monitor description attribute can be modified
*/
- } else if ( mod->sm_desc != mi->monitor_ad_description ) {
+ } else if ( mod->sm_desc != mi->ad_managedInfo) {
rc = LDAP_UNWILLING_TO_PERFORM;
break;
}
#include "lber_pvt.h"
static struct berval
- bv_initiated = BER_BVC( "Initiated" ),
- bv_completed = BER_BVC( "Completed" ),
bv_op[] = {
BER_BVC( "Bind" ),
BER_BVC( "Unbind" ),
{
struct monitorinfo *mi;
- Entry *e, *e_tmp, *e_op, *e_children;
+ Entry *e, *e_tmp, *e_op;
struct monitorentrypriv *mp;
char buf[1024];
- struct berval bv;
int i;
assert( be != NULL );
e_tmp = NULL;
- /*
- * Initiated ops
- */
- snprintf( buf, sizeof( buf ),
- "dn: cn=%s,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
- "cn: %s\n",
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val,
- bv_initiated.bv_val );
-
- e = str2entry( buf );
- if ( e == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,%s'\n",
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,%s'\n%s",
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
- "" );
-#endif
- return( -1 );
- }
-
- bv.bv_val = "0";
- bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
-
- mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
- e->e_private = ( void * )mp;
- mp->mp_next = e_tmp;
- mp->mp_children = NULL;
- mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OPS];
- mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OPS].mss_flags \
- | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
-
- if ( monitor_cache_add( mi, e ) ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,%s'\n",
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,%s'\n%s",
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
- "" );
-#endif
- return( -1 );
- }
-
- e_tmp = e;
- e_children = NULL;
-
for ( i = SLAP_OP_LAST; i-- > 0; ) {
/*
* Initiated ops
*/
snprintf( buf, sizeof( buf ),
- "dn: cn=%s,cn=%s,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
- "cn: %s\n",
+ "dn: cn=%s,%s\n"
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
+ "cn: %s\n"
+ "%s: 0\n"
+ "%s: 0\n",
bv_op[ i ].bv_val,
- bv_initiated.bv_val,
monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val,
- bv_op[ i ].bv_val );
-
- e = str2entry( buf );
- if ( e == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,cn=%s,%s'\n",
+ mi->oc_monitorOperation->soc_cname.bv_val,
+ mi->oc_monitorOperation->soc_cname.bv_val,
bv_op[ i ].bv_val,
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,cn=%s,%s'\n",
- bv_op[ i ].bv_val,
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
-#endif
- return( -1 );
- }
-
- bv.bv_val = "0";
- bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
-
- mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
- e->e_private = ( void * )mp;
- mp->mp_next = e_children;
- mp->mp_children = NULL;
- mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OPS];
- mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OPS].mss_flags \
- | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
+ mi->ad_monitorOpInitiated->ad_cname.bv_val,
+ mi->ad_monitorOpCompleted->ad_cname.bv_val );
- if ( monitor_cache_add( mi, e ) ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,cn=%s,%s'\n",
- bv_op[ i ].bv_val,
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,cn=%s,%s'\n",
- bv_op[ i ].bv_val,
- bv_initiated.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
-#endif
- return( -1 );
- }
-
- e_children = e;
- }
-
- mp = ( struct monitorentrypriv * )e_tmp->e_private;
- mp->mp_children = e_children;
-
- /*
- * Completed ops
- */
- snprintf( buf, sizeof( buf ),
- "dn: cn=%s,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
- "cn: %s\n",
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val,
- bv_completed.bv_val );
-
- e = str2entry( buf );
- if ( e == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,%s'\n",
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,%s'\n%s",
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
- "" );
-#endif
- return( -1 );
- }
-
- bv.bv_val = "0";
- bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
-
- mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
- e->e_private = ( void * )mp;
- mp->mp_next = e_tmp;
- mp->mp_children = NULL;
- mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OPS];
- mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OPS].mss_flags \
- | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
-
- if ( monitor_cache_add( mi, e ) ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,%s'\n",
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,%s'\n%s",
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
- "" );
-#endif
- return( -1 );
- }
-
- e_tmp = e;
- e_children = NULL;
-
- for ( i = SLAP_OP_LAST; i-- > 0; ) {
-
- /*
- * Completed ops
- */
- snprintf( buf, sizeof( buf ),
- "dn: cn=%s,cn=%s,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
- "cn: %s\n",
- bv_op[ i ].bv_val,
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val,
- bv_op[ i ].bv_val );
-
e = str2entry( buf );
if ( e == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
"monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,cn=%s,%s'\n",
+ "unable to create entry 'cn=%s,%s'\n",
bv_op[ i ].bv_val,
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_ops_init: "
- "unable to create entry 'cn=%s,cn=%s,%s'\n",
+ "unable to create entry 'cn=%s,%s'\n",
bv_op[ i ].bv_val,
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
#endif
return( -1 );
}
-
- bv.bv_val = "0";
- bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
- mp->mp_next = e_children;
+ mp->mp_next = e_tmp;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OPS];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OPS].mss_flags \
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT,
"monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,cn=%s,%s'\n",
+ "unable to add entry 'cn=%s,%s'\n",
bv_op[ i ].bv_val,
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_ops_init: "
- "unable to add entry 'cn=%s,cn=%s,%s'\n",
+ "unable to add entry 'cn=%s,%s'\n",
bv_op[ i ].bv_val,
- bv_completed.bv_val,
- monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
#endif
return( -1 );
}
- e_children = e;
+ e_tmp = e;
}
- mp = ( struct monitorentrypriv * )e_tmp->e_private;
- mp->mp_children = e_children;
-
mp = ( struct monitorentrypriv * )e_op->e_private;
mp->mp_children = e_tmp;
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
- long n = -1;
- char *dn;
+ long nInitiated = -1, nCompleted = -1;
+ char *rdnvalue;
+ int i;
+ ber_len_t len;
+ Attribute *a;
+ char buf[] = "+9223372036854775807L";
assert( mi );
assert( e );
- dn = e->e_dn + 3;
-
- if ( strncmp( dn, bv_initiated.bv_val,
- bv_initiated.bv_len ) == 0 ) {
- ldap_pvt_thread_mutex_lock(&num_ops_mutex);
- n = num_ops_initiated;
- ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
+ rdnvalue = e->e_dn + ( sizeof( "cn=" ) - 1 );
- } else if ( strncmp( dn, bv_completed.bv_val,
- bv_completed.bv_len ) == 0 ) {
- ldap_pvt_thread_mutex_lock(&num_ops_mutex);
- n = num_ops_completed;
- ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
+ for (i = 0; i < SLAP_OP_LAST; i++ ) {
+ len = bv_op[ i ].bv_len;
- } else {
- int i;
- ber_len_t len;
-
- for (i = 0; i < SLAP_OP_LAST; i++ ) {
- len = bv_op[ i ].bv_len;
-
- if ( strncmp( dn, bv_op[ i ].bv_val, len ) == 0 ) {
- break;
- }
- }
-
- if ( i == SLAP_OP_LAST ) {
- return( 0 );
- }
-
- dn += len + 3 + 1;
-
- if ( strncmp( dn, bv_initiated.bv_val,
- bv_initiated.bv_len ) == 0 ) {
- ldap_pvt_thread_mutex_lock(&num_ops_mutex);
- n = num_ops_initiated_[ i ];
- ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
-
- } else if ( strncmp( dn, bv_completed.bv_val,
- bv_completed.bv_len ) == 0 ) {
- ldap_pvt_thread_mutex_lock(&num_ops_mutex);
- n = num_ops_completed_[ i ];
- ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
-
- } else {
- assert( 0 );
+ if ( strncmp( rdnvalue, bv_op[ i ].bv_val, len ) == 0 ) {
+ nInitiated = num_ops_initiated_[ i ];
+ nCompleted = num_ops_completed_[ i ];
+ break;
}
}
- if ( n != -1 ) {
- Attribute *a;
- char buf[16];
-
- a = attr_find( e->e_attrs, mi->monitor_ad_description );
- if ( a == NULL ) {
- return( -1 );
- }
-
- snprintf( buf, sizeof( buf ), "%ld", n );
- free( a->a_vals[ 0 ].bv_val );
- ber_str2bv( buf, 0, 1, a->a_vals );
+ if ( i == SLAP_OP_LAST ) {
+ return( 0 );
}
+ a = attr_find( e->e_attrs, mi->ad_monitorOpInitiated );
+ assert ( a != NULL );
+ snprintf( buf, sizeof( buf ), "%ld", nInitiated );
+ free( a->a_vals[ 0 ].bv_val );
+ ber_str2bv( buf, 0, 1, &a->a_vals[ 0 ] );
+
+ a = attr_find( e->e_attrs, mi->ad_monitorOpCompleted );
+ assert ( a != NULL );
+ snprintf( buf, sizeof( buf ), "%ld", nCompleted );
+ free( a->a_vals[ 0 ].bv_val );
+ ber_str2bv( buf, 0, 1, &a->a_vals[ 0 ] );
+
return( 0 );
}
Entry *e_parent, Entry **ep ));
/*
- * read waiters
+ * waiters
*/
-int monitor_subsys_readw_update LDAP_P(( Operation *op, Entry *e ));
-
-/*
- * write waiters
- */
-int monitor_subsys_writew_update LDAP_P(( Operation *op, Entry *e ));
+int monitor_subsys_rww_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
/*
* log
#include <stdio.h>
#include "slap.h"
+#include "lutil.h"
#include "back-monitor.h"
-static int monitor_subsys_readw_update_internal( Operation *op, Entry *e, int rw );
-
-int
-monitor_subsys_readw_update(
- Operation *op,
- Entry *e
+int
+monitor_subsys_rww_init(
+ BackendDB *be
)
{
- return monitor_subsys_readw_update_internal( op, e, 0 );
-}
+ struct monitorinfo *mi;
+
+ Entry *e, *e_tmp, *e_conn;
+ struct monitorentrypriv *mp;
+ char buf[1024];
+ struct berval bv;
-int
-monitor_subsys_writew_update(
- Operation *op,
- Entry *e
-)
-{
- return monitor_subsys_readw_update_internal( op, e, 1 );
+ assert( be != NULL );
+
+ mi = ( struct monitorinfo * )be->be_private;
+
+ if ( monitor_cache_get( mi,
+ &monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn, &e_conn ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_rww_init: "
+ "unable to get entry '%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_rww_init: "
+ "unable to get entry '%s'\n%s%s",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val,
+ "", "" );
+#endif
+ return( -1 );
+ }
+
+ e_tmp = NULL;
+
+ /*
+ * Total conns
+ */
+ snprintf( buf, sizeof( buf ),
+ "dn: cn=Read,%s\n"
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
+ "cn: Read\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
+
+ e = str2entry( buf );
+ if ( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_rww_init: "
+ "unable to create entry 'cn=Read,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_rww_init: "
+ "unable to create entry 'cn=Read,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#endif
+ return( -1 );
+ }
+
+ bv.bv_val = "0";
+ bv.bv_len = 1;
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
+
+ mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
+ e->e_private = ( void * )mp;
+ mp->mp_next = e_tmp;
+ mp->mp_children = NULL;
+ mp->mp_info = &monitor_subsys[SLAPD_MONITOR_RWW];
+ mp->mp_flags = monitor_subsys[SLAPD_MONITOR_RWW].mss_flags \
+ | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
+
+ if ( monitor_cache_add( mi, e ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_rww_init: "
+ "unable to add entry 'cn=Read,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_rww_init: "
+ "unable to add entry 'cn=Read,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#endif
+ return( -1 );
+ }
+
+ e_tmp = e;
+
+ /*
+ * Current conns
+ */
+ snprintf( buf, sizeof( buf ),
+ "dn: cn=Write,%s\n"
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
+ "cn: Write\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
+
+ e = str2entry( buf );
+ if ( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_rww_init: "
+ "unable to create entry 'cn=Write,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_rww_init: "
+ "unable to create entry 'cn=Write,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#endif
+ return( -1 );
+ }
+
+ bv.bv_val = "0";
+ bv.bv_len = 1;
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
+
+ mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
+ e->e_private = ( void * )mp;
+ mp->mp_next = e_tmp;
+ mp->mp_children = NULL;
+ mp->mp_info = &monitor_subsys[SLAPD_MONITOR_RWW];
+ mp->mp_flags = monitor_subsys[SLAPD_MONITOR_RWW].mss_flags \
+ | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
+
+ if ( monitor_cache_add( mi, e ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_rww_init: "
+ "unable to add entry 'cn=Write,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_rww_init: "
+ "unable to add entry 'cn=Write,%s'\n",
+ monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+#endif
+ return( -1 );
+ }
+
+ e_tmp = e;
+
+ mp = ( struct monitorentrypriv * )e_conn->e_private;
+ mp->mp_children = e_tmp;
+
+ monitor_cache_release( mi, e_conn );
+
+ return( 0 );
}
-static int
-monitor_subsys_readw_update_internal(
+int
+monitor_subsys_rww_update(
Operation *op,
- Entry *e,
- int rw
+ Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
Connection *c;
int connindex;
- int nconns, nwritewaiters, nreadwaiters;
+ long nconns, nwritewaiters, nreadwaiters;
+
+#define RWW_NONE 0
+#define RWW_READ 1
+#define RWW_WRITE 2
+ int type = RWW_NONE;
Attribute *a;
struct berval *b = NULL;
- char buf[1024];
+ char buf[] = "+9223372036854775807L";
char *str = NULL;
- int num = 0;
+ long num = 0;
assert( mi != NULL );
assert( e != NULL );
+ if ( strncasecmp( e->e_ndn, "cn=read",
+ sizeof("cn=read")-1 ) == 0 ) {
+ type = RWW_READ;
+
+ } else if ( strncasecmp( e->e_ndn, "cn=write",
+ sizeof("cn=write")-1 ) == 0 ) {
+ type = RWW_WRITE;
+
+ } else {
+ return( 0 );
+ }
+
nconns = nwritewaiters = nreadwaiters = 0;
for ( c = connection_first( &connindex );
c != NULL;
}
connection_done(c);
- switch ( rw ) {
- case 0:
- str = "read waiters";
+ switch ( type ) {
+ case RWW_READ:
num = nreadwaiters;
break;
- case 1:
- str = "write waiters";
+
+ case RWW_WRITE:
num = nwritewaiters;
break;
- }
- snprintf( buf, sizeof( buf ), "%s=%d", str, num );
-
- a = attr_find( e->e_attrs, mi->monitor_ad_description );
- if ( a != NULL ) {
- for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) {
- if ( strncmp( b[0].bv_val, str, strlen( str ) ) == 0 ) {
- free( b[0].bv_val );
- ber_str2bv( buf, 0, 1, b );
- break;
- }
- }
- }
- if ( b == NULL || b[0].bv_val == NULL ) {
- struct berval bv;
+ default:
+ assert( 0 );
+ }
- bv.bv_val = buf;
- bv.bv_len = strlen( buf );
+ snprintf( buf, sizeof( buf ), "%ld", num );
- attr_merge_normalize_one( e, mi->monitor_ad_description,
- &bv, NULL );
- }
+ a = attr_find( e->e_attrs, mi->ad_monitorCounter );
+ assert( a );
+ free( a->a_vals[0].bv_val );
+ ber_str2bv( buf, 0, 1, &a->a_vals[ 0 ] );
return( 0 );
}
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Entries,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Entries\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Referrals,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Referrals\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=PDU,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: PDU\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Bytes,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Bytes\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
if ( n != -1 ) {
Attribute *a;
- char buf[16];
+ char buf[] = "+9223372036854775807L";
- a = attr_find( e->e_attrs, mi->monitor_ad_description );
+ a = attr_find( e->e_attrs, mi->ad_monitorCounter);
if ( a == NULL ) {
return( -1 );
}
snprintf( buf, sizeof( buf ), "%ld", n );
free( a->a_vals[ 0 ].bv_val );
- ber_str2bv( buf, 0, 1, a->a_vals );
+ ber_str2bv( buf, 0, 1, &a->a_vals[ 0 ] );
}
return( 0 );
bv.bv_val = buf;
bv.bv_len = strlen( bv.bv_val );
- attr_merge_normalize_one( e, mi->monitor_ad_description, &bv, NULL );
+ attr_merge_normalize_one( e, mi->ad_monitoredInfo, &bv, NULL );
monitor_cache_release( mi, e );
snprintf( buf, sizeof( buf ), "backload=%d",
ldap_pvt_thread_pool_backload( &connection_pool ) );
- a = attr_find( e->e_attrs, mi->monitor_ad_description );
+ a = attr_find( e->e_attrs, mi->ad_monitoredInfo );
if ( a != NULL ) {
for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) {
if ( strncmp( b[0].bv_val, "backload=",
bv.bv_val = buf;
bv.bv_len = strlen( buf );
- attr_merge_normalize_one( e, mi->monitor_ad_description,
+ attr_merge_normalize_one( e, mi->ad_monitoredInfo,
&bv, NULL );
}
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
snprintf( buf, sizeof( buf ),
"dn: cn=Start,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Start\n"
"createTimestamp: %s",
monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
tmbuf );
e = str2entry( buf );
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Current,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Current\n"
"createTimestamp: %s\n"
- "modifyTimestamp: %s",
+ "modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
+ mi->oc_monitoredObject->soc_cname.bv_val,
tmbuf, tmbuf );
e = str2entry( buf );
#endif
return( -1 );
}
-
+
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
mp->mp_next = e_tmp;
"matchingRuleUse ) )",
subentryObjectClass, SLAP_OC_OPERATIONAL,
offsetof(struct slap_internal_schema, si_oc_subschema) },
- { "monitor", "( 1.3.6.1.4.1.4203.666.3.2 NAME 'monitor' "
- "DESC 'OpenLDAP system monitoring' "
- "STRUCTURAL "
- "MUST cn )",
- 0, SLAP_OC_OPERATIONAL,
- offsetof(struct slap_internal_schema, si_oc_monitor) },
#ifdef LDAP_DEVEL
{ "collectiveAttributeSubentry", "( 2.5.17.2 "
"NAME 'collectiveAttributeSubentry' "
NULL, NULL, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_krbName) },
#endif
-
{ NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0 }
};
ObjectClass *si_oc_rootdse;
ObjectClass *si_oc_subentry;
ObjectClass *si_oc_subschema;
- ObjectClass *si_oc_monitor;
ObjectClass *si_oc_collectiveAttributeSubentry;
ObjectClass *si_oc_dynamicObject;
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
AttributeDescription *si_ad_krbName;
#endif
-
+
/* Undefined Attribute Type */
AttributeType *si_at_undefined;