From: Pierangelo Masarati Date: Wed, 6 Sep 2006 16:06:49 +0000 (+0000) Subject: cleanup subsystems monitoring OID handling X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~195 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4d55aeb57c43944a8204e386e7047cfcb73a3858;p=openldap cleanup subsystems monitoring OID handling --- diff --git a/servers/slapd/back-bdb/monitor.c b/servers/slapd/back-bdb/monitor.c index 5cd3bc22c0..26079e7295 100644 --- a/servers/slapd/back-bdb/monitor.c +++ b/servers/slapd/back-bdb/monitor.c @@ -47,12 +47,22 @@ static AttributeDescription *ad_olmBDBEntryCache, #define BDB_MONITOR_SCHEMA_AD "1.3.6.1.4.1.4203.666.1.55.0.1.1" #define BDB_MONITOR_SCHEMA_OC "1.3.6.1.4.1.4203.666.3.16.0.1.1" +static struct { + char *name; + char *oid; +} s_oid[] = { + { "olmBDBAttributes", "olmDatabaseAttributes:1" }, + { "olmBDBObjectClasses", "olmDatabaseObjectClasses:1" }, + + { NULL } +}; + static struct { char *name; char *desc; AttributeDescription **ad; } s_at[] = { - { "olmBDBEntryCache", "( " BDB_MONITOR_SCHEMA_AD ".1 " + { "olmBDBEntryCache", "( olmBDBAttributes:1 " "NAME ( 'olmBDBEntryCache' ) " "DESC 'Number of items in Entry Cache' " "SUP monitorCounter " @@ -60,7 +70,7 @@ static struct { "USAGE directoryOperation )", &ad_olmBDBEntryCache }, - { "olmBDBEntryInfo", "( " BDB_MONITOR_SCHEMA_AD ".2 " + { "olmBDBEntryInfo", "( olmBDBAttributes:2 " "NAME ( 'olmBDBEntryInfo' ) " "DESC 'Number of items in EntryInfo Cache' " "SUP monitorCounter " @@ -68,7 +78,7 @@ static struct { "USAGE directoryOperation )", &ad_olmBDBEntryInfo }, - { "olmBDBIDLCache", "( " BDB_MONITOR_SCHEMA_AD ".3 " + { "olmBDBIDLCache", "( olmBDBAttributes:3 " "NAME ( 'olmBDBIDLCache' ) " "DESC 'Number of items in IDL Cache' " "SUP monitorCounter " @@ -76,7 +86,7 @@ static struct { "USAGE directoryOperation )", &ad_olmBDBIDLCache }, - { "olmDbDirectory", "( " BDB_MONITOR_SCHEMA_AD ".4 " + { "olmDbDirectory", "( olmBDBAttributes:4 " "NAME ( 'olmDbDirectory' ) " "DESC 'Path name of the directory " "where the database environment resides' " @@ -95,7 +105,7 @@ static struct { } s_oc[] = { /* augments an existing object, so it must be AUXILIARY * FIXME: derive from some ABSTRACT "monitoredEntity"? */ - { "olmBDBDatabase", "( " BDB_MONITOR_SCHEMA_OC ".1 " + { "olmBDBDatabase", "( olmBDBObjectClasses:1 " "NAME ( 'olmBDBDatabase' ) " "SUP top AUXILIARY " "MAY ( " @@ -211,6 +221,22 @@ bdb_monitor_initialize( void ) return 0; } + for ( i = 0; s_oid[ i ].name; i++ ) { + char *argv[ 3 ]; + + argv[ 0 ] = "back-bdb/back-hdb monitor"; + argv[ 1 ] = s_oid[ i ].name; + argv[ 2 ] = s_oid[ i ].oid; + + if ( parse_oidm( argv[ 0 ], i, 3, argv, 0, NULL ) != 0 ) { + Debug( LDAP_DEBUG_ANY, + "bdb_monitor_initialize: unable to add " + "objectIdentifier \"%s=%s\"\n", + s_oid[ i ].name, s_oid[ i ].oid, 0 ); + return 1; + } + } + for ( i = 0; s_at[ i ].name != NULL; i++ ) { LDAPAttributeType *at; diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index 85d9fe825d..6aa67d54f4 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -1502,10 +1502,55 @@ monitor_back_initialize( { NULL, NULL, 0, -1 } }; + static struct { + char *name; + char *oid; + } s_oid[] = { + { "olmAttributes", "1.3.6.1.4.1.4203.666.1.55" }, + { "olmSubSystemAttributes", "olmAttributes:0" }, + { "olmGenericAttributes", "olmSubSystemAttributes:0" }, + { "olmDatabaseAttributes", "olmSubSystemAttributes:1" }, + + /* for example, back-bdb specific attrs + * are in "olmDatabaseAttributes:1" + * + * NOTE: developers, please record here OID assignments + * for other modules */ + + { "olmObjectClasses", "1.3.6.1.4.1.4203.666.3.16" }, + { "olmSubSystemObjectClasses", "olmObjectClasses:0" }, + { "olmGenericObjectClasses", "olmSubSystemObjectClasses:0" }, + { "olmDatabaseObjectClasses", "olmSubSystemObjectClasses:1" }, + + /* for example, back-bdb specific objectClasses + * are in "olmDatabaseObjectClasses:1" + * + * NOTE: developers, please record here OID assignments + * for other modules */ + + { NULL } + }; + int i, rc; const char *text; monitor_info_t *mi = &monitor_info; + for ( i = 0; s_oid[ i ].name; i++ ) { + char *argv[ 3 ]; + + argv[ 0 ] = "monitor"; + argv[ 1 ] = s_oid[ i ].name; + argv[ 2 ] = s_oid[ i ].oid; + + if ( parse_oidm( argv[ 0 ], i, 3, argv, 0, NULL ) != 0 ) { + Debug( LDAP_DEBUG_ANY, + "monitor_back_initialize: unable to add " + "objectIdentifier \"%s=%s\"\n", + s_oid[ i ].name, s_oid[ i ].oid, 0 ); + return 1; + } + } + /* schema integration */ for ( i = 0; mat[ i ].name; i++ ) { LDAPAttributeType *at;