mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-20 22:03:45 -05:00
HEADS-UP: complete reworking of back-monitor
This commit is contained in:
parent
8321227972
commit
be8820d660
15 changed files with 753 additions and 705 deletions
|
|
@ -41,8 +41,6 @@
|
|||
|
||||
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.
|
||||
|
|
@ -73,28 +71,45 @@ struct monitorentrypriv {
|
|||
};
|
||||
|
||||
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;
|
||||
/*
|
||||
* Config parameters
|
||||
*/
|
||||
struct berval l;
|
||||
|
||||
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;
|
||||
/*
|
||||
* 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 *monitor_ad_description;
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -149,54 +164,41 @@ struct monitorinfo {
|
|||
#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_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_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_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;
|
||||
|
|
|
|||
|
|
@ -77,15 +77,19 @@ monitor_subsys_backend_init(
|
|||
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 );
|
||||
|
|
@ -109,9 +113,9 @@ monitor_subsys_backend_init(
|
|||
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 ) {
|
||||
|
|
@ -123,6 +127,24 @@ monitor_subsys_backend_init(
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -81,9 +81,12 @@ monitor_subsys_conn_init(
|
|||
*/
|
||||
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 ) {
|
||||
|
|
@ -104,7 +107,7 @@ monitor_subsys_conn_init(
|
|||
|
||||
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;
|
||||
|
|
@ -138,9 +141,12 @@ monitor_subsys_conn_init(
|
|||
*/
|
||||
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 ) {
|
||||
|
|
@ -161,7 +167,7 @@ monitor_subsys_conn_init(
|
|||
|
||||
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;
|
||||
|
|
@ -231,7 +237,7 @@ monitor_subsys_conn_update(
|
|||
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 );
|
||||
}
|
||||
|
|
@ -266,9 +272,12 @@ conn_create(
|
|||
|
||||
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 );
|
||||
|
||||
|
|
@ -300,6 +309,7 @@ conn_create(
|
|||
|
||||
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
||||
|
||||
/* monitored info */
|
||||
sprintf( buf,
|
||||
"%ld : %ld "
|
||||
": %ld/%ld/%ld/%ld "
|
||||
|
|
@ -335,7 +345,25 @@ conn_create(
|
|||
|
||||
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;
|
||||
|
|
@ -422,7 +450,7 @@ monitor_subsys_conn_create(
|
|||
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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,6 @@ monitor_subsys_database_init(
|
|||
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 );
|
||||
|
|
@ -79,21 +76,6 @@ monitor_subsys_database_init(
|
|||
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];
|
||||
|
|
@ -108,12 +90,17 @@ monitor_subsys_database_init(
|
|||
|
||||
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 );
|
||||
|
|
@ -135,11 +122,15 @@ monitor_subsys_database_init(
|
|||
}
|
||||
|
||||
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--; ) {
|
||||
|
|
@ -151,7 +142,8 @@ monitor_subsys_database_init(
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -240,7 +232,7 @@ monitor_back_add_plugin( Backend *be, Entry *e_database )
|
|||
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++;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,21 +106,13 @@ struct monitorsubsys monitor_subsys[] = {
|
|||
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,
|
||||
|
|
@ -237,131 +229,9 @@ monitor_back_db_init(
|
|||
)
|
||||
{
|
||||
struct monitorinfo *mi;
|
||||
Entry *e, *e_tmp;
|
||||
struct monitorentrypriv *mp;
|
||||
int i, rc;
|
||||
char buf[1024], *end_of_line;
|
||||
int rc;
|
||||
struct berval dn, ndn;
|
||||
const char *text;
|
||||
struct berval bv;
|
||||
struct m_s {
|
||||
char *name;
|
||||
char *schema;
|
||||
int offset;
|
||||
} moc[] = {
|
||||
#ifdef MONITOR_DEVEL
|
||||
{ "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) },
|
||||
{ "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' "
|
||||
"DESC 'monitor counter class' "
|
||||
"SUP monitor STRUCTURAL )",
|
||||
offsetof(struct monitorinfo, monitor_oc_monitorCounter) },
|
||||
{ "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) },
|
||||
{ "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) },
|
||||
{ "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) },
|
||||
{ "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 */
|
||||
{ NULL, NULL, -1 }
|
||||
}, mat[] = {
|
||||
#ifdef MONITOR_DEVEL
|
||||
{ "monitoredInfo", "( 1.3.6.1.4.1.4203.666.1.14 "
|
||||
"NAME 'monitoredInfo' "
|
||||
"DESC 'monitored info' "
|
||||
/* "SUP name " */
|
||||
"EQUALITY caseIgnoreMatch "
|
||||
"SUBSTR caseIgnoreSubstringsMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} "
|
||||
"NO-USER-MODIFICATION "
|
||||
"USAGE directoryOperation )",
|
||||
offsetof(struct monitorinfo, monitor_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) },
|
||||
{ "monitorCounter", "( 1.3.6.1.4.1.4203.666.1.16 "
|
||||
"NAME 'monitorCounter' "
|
||||
"DESC 'monitor counter' "
|
||||
"EQUALITY integerMatch "
|
||||
"ORDERING integerOrderingMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
|
||||
"NO-USER-MODIFICATION "
|
||||
"USAGE directoryOperation )",
|
||||
offsetof(struct monitorinfo, monitor_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) },
|
||||
{ "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) },
|
||||
{ "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) },
|
||||
{ "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.1.20 "
|
||||
"NAME 'monitorConnectionAuthzDN' "
|
||||
"DESC 'monitor connection authorization DN' "
|
||||
/* "SUP distinguishedName " */
|
||||
"EQUALITY distinguishedNameMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
|
||||
"NO-USER-MODIFICATION "
|
||||
"USAGE directoryOperation )",
|
||||
offsetof(struct monitorinfo, monitor_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) },
|
||||
{ "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 */
|
||||
{ NULL, NULL, -1 }
|
||||
};
|
||||
|
||||
/*
|
||||
* database monitor can be defined once only
|
||||
|
|
@ -414,8 +284,240 @@ monitor_back_db_init(
|
|||
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;
|
||||
char buf[1024], *end_of_line;
|
||||
const char *text;
|
||||
struct berval bv;
|
||||
struct m_s {
|
||||
char *name;
|
||||
char *schema;
|
||||
int offset;
|
||||
} moc[] = {
|
||||
{ "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 "
|
||||
"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, 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, 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, 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, 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, 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, oc_monitoredObject) },
|
||||
{ NULL, NULL, -1 }
|
||||
}, mat[] = {
|
||||
{ "monitoredInfo", "( 1.3.6.1.4.1.4203.666.1.14 "
|
||||
"NAME 'monitoredInfo' "
|
||||
"DESC 'monitored info' "
|
||||
/* "SUP name " */
|
||||
"EQUALITY caseIgnoreMatch "
|
||||
"SUBSTR caseIgnoreSubstringsMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} "
|
||||
"NO-USER-MODIFICATION "
|
||||
"USAGE directoryOperation )",
|
||||
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, ad_managedInfo) },
|
||||
{ "monitorCounter", "( 1.3.6.1.4.1.4203.666.1.16 "
|
||||
"NAME 'monitorCounter' "
|
||||
"DESC 'monitor counter' "
|
||||
"EQUALITY integerMatch "
|
||||
"ORDERING integerOrderingMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
|
||||
"NO-USER-MODIFICATION "
|
||||
"USAGE directoryOperation )",
|
||||
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, 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, 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, ad_monitorConnectionNumber) },
|
||||
{ "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.1.20 "
|
||||
"NAME 'monitorConnectionAuthzDN' "
|
||||
"DESC 'monitor connection authorization DN' "
|
||||
/* "SUP distinguishedName " */
|
||||
"EQUALITY distinguishedNameMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
|
||||
"NO-USER-MODIFICATION "
|
||||
"USAGE directoryOperation )",
|
||||
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, 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, ad_monitorConnectionPeerAddress) },
|
||||
{ NULL, NULL, -1 }
|
||||
};
|
||||
|
||||
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 );
|
||||
#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);
|
||||
|
||||
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,
|
||||
"monitor_back_db_init: description: %s\n", text, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"monitor_back_db_init: description: %s\n", text, 0, 0 );
|
||||
#endif
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if ( slap_str2ad( "seeAlso", &mi->ad_seeAlso, &text ) ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, CRIT,
|
||||
"monitor_back_db_init: seeAlso: %s\n", text, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"monitor_back_db_init: seeAlso: %s\n", text, 0, 0 );
|
||||
#endif
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
for ( i = 0; moc[i].name; i++ ) {
|
||||
LDAPObjectClass *oc;
|
||||
int code;
|
||||
|
|
@ -452,15 +554,15 @@ monitor_back_db_init(
|
|||
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;
|
||||
|
|
@ -470,86 +572,21 @@ monitor_back_db_init(
|
|||
|
||||
Oc = oc_find( moc[i].name );
|
||||
if ( Oc == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: "
|
||||
"unable to find objectClass %s "
|
||||
"(just added)\n", moc[i].name, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
|
||||
"unable to find objectClass %s "
|
||||
"(just added)\n", moc[i].name, 0, 0 );
|
||||
#endif
|
||||
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 );
|
||||
#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);
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Create all the subsystem specific entries
|
||||
*/
|
||||
|
|
@ -600,9 +637,12 @@ monitor_back_db_init(
|
|||
|
||||
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 );
|
||||
|
|
@ -647,12 +687,20 @@ monitor_back_db_init(
|
|||
* 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) {
|
||||
|
|
@ -662,11 +710,12 @@ monitor_back_db_init(
|
|||
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 ) {
|
||||
|
|
@ -674,20 +723,50 @@ monitor_back_db_init(
|
|||
} 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;
|
||||
|
||||
|
|
@ -702,24 +781,14 @@ monitor_back_db_init(
|
|||
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 );
|
||||
|
||||
/*
|
||||
|
|
@ -758,16 +827,30 @@ monitor_back_db_config(
|
|||
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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,13 +91,17 @@ monitor_subsys_listener_init(
|
|||
|
||||
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 );
|
||||
|
||||
|
|
@ -126,7 +130,8 @@ monitor_subsys_listener_init(
|
|||
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
|
||||
|
|
@ -136,7 +141,8 @@ monitor_subsys_listener_init(
|
|||
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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,11 @@ monitor_subsys_log_init(
|
|||
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 );
|
||||
|
||||
|
|
@ -111,18 +115,16 @@ monitor_subsys_log_init(
|
|||
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 ) {
|
||||
|
|
@ -131,12 +133,14 @@ monitor_subsys_log_init(
|
|||
}
|
||||
|
||||
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 );
|
||||
|
|
@ -179,7 +183,7 @@ monitor_subsys_log_modify(
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@
|
|||
#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" ),
|
||||
|
|
@ -62,10 +60,9 @@ monitor_subsys_ops_init(
|
|||
{
|
||||
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 );
|
||||
|
|
@ -91,110 +88,47 @@ monitor_subsys_ops_init(
|
|||
|
||||
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 );
|
||||
mi->oc_monitorOperation->soc_cname.bv_val,
|
||||
mi->oc_monitorOperation->soc_cname.bv_val,
|
||||
bv_op[ i ].bv_val,
|
||||
mi->ad_monitorOpInitiated->ad_cname.bv_val,
|
||||
mi->ad_monitorOpCompleted->ad_cname.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_initiated.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_initiated.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 \
|
||||
|
|
@ -204,161 +138,22 @@ monitor_subsys_ops_init(
|
|||
#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_initiated.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_initiated.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;
|
||||
|
||||
/*
|
||||
* 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",
|
||||
bv_op[ i ].bv_val,
|
||||
bv_completed.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_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_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;
|
||||
|
||||
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_completed.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_completed.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;
|
||||
|
||||
mp = ( struct monitorentrypriv * )e_op->e_private;
|
||||
mp->mp_children = e_tmp;
|
||||
|
||||
|
|
@ -374,75 +169,44 @@ monitor_subsys_ops_update(
|
|||
)
|
||||
{
|
||||
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;
|
||||
rdnvalue = e->e_dn + ( sizeof( "cn=" ) - 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;
|
||||
ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
|
||||
for (i = 0; i < SLAP_OP_LAST; i++ ) {
|
||||
len = bv_op[ i ].bv_len;
|
||||
|
||||
} 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);
|
||||
|
||||
} 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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,14 +69,10 @@ int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
|
|||
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
|
||||
|
|
|
|||
|
|
@ -36,50 +36,204 @@
|
|||
#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;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
int
|
||||
monitor_subsys_writew_update(
|
||||
int
|
||||
monitor_subsys_rww_update(
|
||||
Operation *op,
|
||||
Entry *e
|
||||
)
|
||||
{
|
||||
return monitor_subsys_readw_update_internal( op, e, 1 );
|
||||
}
|
||||
|
||||
static int
|
||||
monitor_subsys_readw_update_internal(
|
||||
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;
|
||||
|
|
@ -93,38 +247,25 @@ monitor_subsys_readw_update_internal(
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
default:
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
if ( b == NULL || b[0].bv_val == NULL ) {
|
||||
struct berval bv;
|
||||
snprintf( buf, sizeof( buf ), "%ld", num );
|
||||
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( buf );
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,9 +78,12 @@ monitor_subsys_sent_init(
|
|||
*/
|
||||
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 ) {
|
||||
|
|
@ -101,7 +104,7 @@ monitor_subsys_sent_init(
|
|||
|
||||
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;
|
||||
|
|
@ -134,9 +137,12 @@ monitor_subsys_sent_init(
|
|||
*/
|
||||
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 ) {
|
||||
|
|
@ -157,7 +163,7 @@ monitor_subsys_sent_init(
|
|||
|
||||
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;
|
||||
|
|
@ -190,9 +196,12 @@ monitor_subsys_sent_init(
|
|||
*/
|
||||
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 ) {
|
||||
|
|
@ -213,7 +222,7 @@ monitor_subsys_sent_init(
|
|||
|
||||
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;
|
||||
|
|
@ -246,9 +255,12 @@ monitor_subsys_sent_init(
|
|||
*/
|
||||
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 ) {
|
||||
|
|
@ -269,7 +281,7 @@ monitor_subsys_sent_init(
|
|||
|
||||
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;
|
||||
|
|
@ -344,16 +356,16 @@ monitor_subsys_sent_update(
|
|||
|
||||
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 );
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ monitor_subsys_thread_init(
|
|||
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 );
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ monitor_subsys_thread_update(
|
|||
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=",
|
||||
|
|
@ -115,7 +115,7 @@ monitor_subsys_thread_update(
|
|||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,10 +102,13 @@ monitor_subsys_time_init(
|
|||
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 );
|
||||
|
|
@ -156,11 +159,14 @@ monitor_subsys_time_init(
|
|||
*/
|
||||
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 );
|
||||
|
|
@ -179,7 +185,7 @@ monitor_subsys_time_init(
|
|||
#endif
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
mp->mp_next = e_tmp;
|
||||
|
|
|
|||
|
|
@ -318,12 +318,6 @@ static struct slap_schema_oc_map {
|
|||
"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' "
|
||||
|
|
@ -793,7 +787,6 @@ static struct slap_schema_ad_map {
|
|||
NULL, NULL, NULL, NULL, NULL,
|
||||
offsetof(struct slap_internal_schema, si_ad_krbName) },
|
||||
#endif
|
||||
|
||||
{ NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -686,7 +686,6 @@ struct slap_internal_schema {
|
|||
ObjectClass *si_oc_rootdse;
|
||||
ObjectClass *si_oc_subentry;
|
||||
ObjectClass *si_oc_subschema;
|
||||
ObjectClass *si_oc_monitor;
|
||||
ObjectClass *si_oc_collectiveAttributeSubentry;
|
||||
ObjectClass *si_oc_dynamicObject;
|
||||
|
||||
|
|
@ -767,7 +766,7 @@ struct slap_internal_schema {
|
|||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
|
||||
AttributeDescription *si_ad_krbName;
|
||||
#endif
|
||||
|
||||
|
||||
/* Undefined Attribute Type */
|
||||
AttributeType *si_at_undefined;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue