Commit b6099078 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

custom monitoring can be enabled/disabled via config

parent 4d55aeb5
......@@ -44,8 +44,6 @@ static AttributeDescription *ad_olmBDBEntryCache,
* Databases monitor objectclasses 1.3.6.1.4.1.4203.666.3.16.0.1
* BDB database monitor objectclasses 1.3.6.1.4.1.4203.666.3.16.0.1.1
*/
#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;
......@@ -348,11 +346,9 @@ bdb_monitor_open( BackendDB *be )
char *ptr;
int rc = 0;
bdb->bi_monitor_cleanup.bdm_scope = LDAP_SCOPE_ONELEVEL;
base = &bdb->bi_monitor_cleanup.bdm_base;
BER_BVSTR( base, "cn=databases,cn=monitor" );
filter = &bdb->bi_monitor_cleanup.bdm_filter;
BER_BVZERO( filter );
if ( !SLAP_DBMONITORING( be ) ) {
return 0;
}
/* don't bother if monitor is not configured */
if ( !monitor_back_is_configured() ) {
......@@ -372,6 +368,12 @@ bdb_monitor_open( BackendDB *be )
* base="cn=Databases,cn=Monitor", scope=LDAP_SCOPE_ONE
* and filter="(namingContexts:distinguishedNameMatch:=<suffix>)" */
bdb->bi_monitor_cleanup.bdm_scope = LDAP_SCOPE_ONELEVEL;
base = &bdb->bi_monitor_cleanup.bdm_base;
BER_BVSTR( base, "cn=databases,cn=monitor" );
filter = &bdb->bi_monitor_cleanup.bdm_filter;
BER_BVZERO( filter );
suffix.bv_len = ldap_bv2escaped_filter_value_len( &be->be_nsuffix[ 0 ] );
if ( suffix.bv_len == be->be_nsuffix[ 0 ].bv_len ) {
suffix = be->be_nsuffix[ 0 ];
......
......@@ -163,6 +163,7 @@ enum {
CFG_TTHREADS,
CFG_MIRRORMODE,
CFG_HIDDEN,
CFG_MONITORING,
CFG_LAST
};
......@@ -382,6 +383,10 @@ static ConfigTable config_back_cf_table[] = {
#endif
"( OLcfgGlAt:31 NAME 'olcModulePath' "
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
{ "monitoring", "TRUE|FALSE", 2, 2, 0,
ARG_MAGIC|CFG_MONITORING|ARG_DB|ARG_ON_OFF, &config_generic,
"( OLcfgDbAt:0.18 NAME 'olcMonitoring' "
"SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
{ "objectclass", "objectclass", 2, 0, 0, ARG_PAREN|ARG_MAGIC|CFG_OC|ARG_NO_DELETE|ARG_NO_INSERT,
&config_generic, "( OLcfgGlAt:32 NAME 'olcObjectClasses' "
"DESC 'OpenLDAP object classes' "
......@@ -704,7 +709,8 @@ static ConfigOCs cf_ocs[] = {
"olcReplicaArgsFile $ olcReplicaPidFile $ olcReplicationInterval $ "
"olcReplogFile $ olcRequires $ olcRestrict $ olcRootDN $ olcRootPW $ "
"olcSchemaDN $ olcSecurity $ olcSizeLimit $ olcSyncrepl $ "
"olcTimeLimit $ olcUpdateDN $ olcUpdateRef $ olcMirrorMode ) )",
"olcTimeLimit $ olcUpdateDN $ olcUpdateRef $ olcMirrorMode $ "
"olcMonitoring ) )",
Cft_Database, NULL, cfAddDatabase },
{ "( OLcfgGlOc:5 "
"NAME 'olcOverlayConfig' "
......@@ -941,6 +947,9 @@ config_generic(ConfigArgs *c) {
else
rc = 1;
break;
case CFG_MONITORING:
c->value_int = (SLAP_DBMONITORING(c->be) != 0);
break;
case CFG_SSTR_IF_MAX:
c->value_int = index_substr_if_maxlen;
break;
......@@ -1028,6 +1037,7 @@ config_generic(ConfigArgs *c) {
case CFG_DEPTH:
case CFG_LASTMOD:
case CFG_MIRRORMODE:
case CFG_MONITORING:
case CFG_SASLSECP:
case CFG_SSTR_IF_MAX:
case CFG_SSTR_IF_MIN:
......@@ -1418,6 +1428,13 @@ config_generic(ConfigArgs *c) {
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
break;
case CFG_MONITORING:
if(c->value_int)
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_MONITORING;
else
SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_MONITORING;
break;
case CFG_HIDDEN:
if (c->value_int)
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_HIDDEN;
......@@ -2041,7 +2058,7 @@ config_restrict(ConfigArgs *c) {
{ BER_BVC("compare"), SLAP_RESTRICT_OP_COMPARE },
{ BER_BVC("read"), SLAP_RESTRICT_OP_READS },
{ BER_BVC("write"), SLAP_RESTRICT_OP_WRITES },
{ BER_BVC("extended"), SLAP_RESTRICT_OP_EXTENDED },
{ BER_BVC("extended"), SLAP_RESTRICT_OP_EXTENDED },
{ BER_BVC("extended=" LDAP_EXOP_START_TLS ), SLAP_RESTRICT_EXOP_START_TLS },
{ BER_BVC("extended=" LDAP_EXOP_MODIFY_PASSWD ), SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
{ BER_BVC("extended=" LDAP_EXOP_X_WHO_AM_I ), SLAP_RESTRICT_EXOP_WHOAMI },
......
......@@ -1707,6 +1707,7 @@ struct slap_backend_db {
#define SLAP_DBFLAG_OVERLAY 0x0100U /* this db struct is an overlay */
#define SLAP_DBFLAG_GLOBAL_OVERLAY 0x0200U /* this db struct is a global overlay */
#define SLAP_DBFLAG_DYNAMIC 0x0400U /* this db allows dynamicObjects */
#define SLAP_DBFLAG_MONITORING 0x0800U /* custom monitoring enabled */
#define SLAP_DBFLAG_SHADOW 0x8000U /* a shadow */
#define SLAP_DBFLAG_SINGLE_SHADOW 0x4000U /* a single-master shadow */
#define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */
......@@ -1718,6 +1719,7 @@ struct slap_backend_db {
#define SLAP_DBHIDDEN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_HIDDEN)
#define SLAP_ISOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_OVERLAY)
#define SLAP_ISGLOBALOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLOBAL_OVERLAY)
#define SLAP_DBMONITORING(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_MONITORING)
#define SLAP_NO_SCHEMA_CHECK(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_NO_SCHEMA_CHECK)
#define SLAP_GLUE_INSTANCE(be) \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment