]> git.sur5r.net Git - openldap/commitdiff
cleanup subsystems monitoring OID handling
authorPierangelo Masarati <ando@openldap.org>
Wed, 6 Sep 2006 16:06:49 +0000 (16:06 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 6 Sep 2006 16:06:49 +0000 (16:06 +0000)
servers/slapd/back-bdb/monitor.c
servers/slapd/back-monitor/init.c

index 5cd3bc22c0ced25dee85093b102064d65799d4a8..26079e7295a54f38ce6f3144827fb4108bde03a4 100644 (file)
@@ -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;
 
index 85d9fe825d53de749b5d6d3fc4472f806fc46fd3..6aa67d54f4b18435b8a5aeee46103997e80445f8 100644 (file)
@@ -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;