summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/snmp_collator.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2007-10-18 01:22:29 +0000
committerRich Megginson <rmeggins@redhat.com>2007-10-18 01:22:29 +0000
commit33c33e1cfde3580cb74a7b69bf8c5e3545362c0b (patch)
treef67e4305224dc0ee4e86bfa53a0195726ffc017b /ldap/servers/slapd/snmp_collator.c
parent19cd513a509aa6e45361df774e74f2d39451e08a (diff)
downloadds-33c33e1cfde3580cb74a7b69bf8c5e3545362c0b.tar.gz
ds-33c33e1cfde3580cb74a7b69bf8c5e3545362c0b.tar.xz
ds-33c33e1cfde3580cb74a7b69bf8c5e3545362c0b.zip
Resolves: bug 250179
Description: tmpwatch whacks stats Reviewed by: nkinder (Thanks!) Fix Description: move the snmp slapd.stats file to run_dir (/var/run/dirsrv) and rename to slapd-instance.stats. Had to add nsslapd-rundir to cn=config in order for ldap-agent to be able to get it. Doc: Yes, we need to document the new attribute nsslapd-rundir.
Diffstat (limited to 'ldap/servers/slapd/snmp_collator.c')
-rw-r--r--ldap/servers/slapd/snmp_collator.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 016b55c8..0aadf9b6 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -60,6 +60,7 @@
#include "prlock.h"
#include "prerror.h"
#include "prcvar.h"
+#include "plstr.h"
#include "snmp_collator.h"
#include "../snmp/ntagt/nslagtcom_nt.h"
@@ -397,8 +398,10 @@ int snmp_collator_start()
{
int err;
- char *statspath = config_get_tmpdir();
+ char *statspath = config_get_rundir();
char *lp = NULL;
+ char *instdir = config_get_configdir();
+ char *instname = NULL;
/*
* Get directory for our stats file
@@ -407,10 +410,18 @@ int snmp_collator_start()
statspath = slapi_ch_strdup("/tmp");
}
- PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s",
- statspath, AGT_STATS_FILE);
+ instname = PL_strrstr(instdir, "slapd-");
+ if (!instname) {
+ instname = PL_strrstr(instdir, "/");
+ if (instname) {
+ instname++;
+ }
+ }
+ PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s%s",
+ statspath, instname, AGT_STATS_EXTENSION);
tmpstatsfile = szStatsFile;
- slapi_ch_free((void **) &statspath);
+ slapi_ch_free_string(&statspath);
+ slapi_ch_free_string(&instname);
/* open the memory map */
if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR, &hdl) != 0))