Debugging IBM Tivoli Directory Server related issues
This chapter discusses the various debugging and tracing capabilities provided by ITDS 5.2. These facilities provide a directory administrator greater insight into what on side of the directory any given time.
18.1 Overview
The process of installing and configuring ITDS, for various reasons, is not always error free. The directory administrator can encounter problems with basic installation of the server, configuring various server components, or the server might fail to start for no obvious reason.
Debugging is the process of finding the cause of the problem using various tools and techniques and eliminating them. Due of these inherent problems, ITDS provides administrators various command line options, tools and detailed log files that help the user find the cause of the problem.
18.2 Debugging problems
The following sections describe how to debug configuration problems, directory server errors, directory server debug modes, and DB2 debug logs.
18.2.1 Debugging configuration problems
The first thing that is to be done after installation of the product is the configuration. If this fails then there is no way you can go but to resolve the issue. The very basic steps towards making the IBM Tivoli Directory Server up and running are:
Configuring an Admin DN and password
Configuring the Directory server database
The above basic tasks are performed by using the configuration tools provided by the directory server. These are:
ldapcfg: Command-line tool for configuring the directory server (admin dn, password, database and other tasks).
ldapxcfg: GUI for doing the same tasks as ldapcfg. In other words, it is the GUI equivalent of ldapcfg.
ldapucfg: Command-line tool for unconfiguring the directory server(admin dn, password, directory and changelog database etc.).
While the configuration of Admin DN and password is fairly straightforward and is less error prone, the database configuration may not be that easy. Generally, the only reasons the configuration of the Admin DN fails are if the IBM Directory configuration file (<ldapinstalldir>/etc/ibmslapd.conf) has had the permissions accidentally changed, or if the user enters an invalid DN. If the database configuration fails, the following sources can be checked to find the cause of the failure:
1. Output on the screen
All of the configuration programs are either started from a console command line prompt (ldapcfg, ldapucfg) or open a background console (ldapxcfg). As the database configuration progresses, status messages (and limited error messages) are displayed in the associated console window. If a problem occurs, the user should copy these messages to the system clipboard and then save them in a file for the support teams.
2. DB2 log files
If the error is a direct error from DB2, then DB2 often creates message/error files in the /tmp directory (on UNIX platforms). If the user has a database configuration problem on UNIX systems, they need to examine all of the files in the /tmp directory that were created around the time of the attempted configuration. On Windows systems, examine any DB2 error logs in the directory named for the instance you were trying to configure under the DB2 install directory under. For example, if your were trying to create the default ldapdb2 instance and database, and if your DB2 was installed in D:sqllib, then you need to examine the files in the D:sqllibldapdb2 directory if it exists. Especially look for and examine the db2diag.log file in that directory.
3. IBM Directory logs for configuration issues
IBM Directory logs most configuration errors in the file ldacfg.out. On UNIX platforms, this file can be found in the /tmp directory. On Windows platforms, this file is created in the root directory of the drive you ran configuration from.
If the above sources are not sufficient for determining the cause of the problem, we can resort to advanced debugging. In advanced debugging we set two environment variables and collect the relevant logs as explained below:
1. JAVA_DEBUG
Set this environment variable to any non-empty value, for example:
JAVA_DEBUG=1
On UNIX platforms, use export JAVA_DEBUG=1. This causes certain Java debug information built into the code to be displayed on stdout (the console). The best practice is to redirect the output to a file and then analyses the same.
2. LDAP_DBG
Set this environment variable to any non-empty value. For example:
LDAP_DBG =1
On UNIX platforms, use export LDAP_DBG=1. This causes a debug file to be created for the IBM support and development teams. The file name that is created is dbg.log. It is created in /var/ldap/ directory.
On the Windows NT and Windows 2000 platforms, dbg.log is created in the <ldapinstalldir> var directory.
18.2.2 Debugging directory server related errors using log files
When a problem occurs that appears to be related to the IBM Directory Server, you should first check the following files for error messages. The default locations of these files are /var/ldap in case of Unix and <ldapinstalldir>var in case of windows.
ibmslapd.log: When the server starts up, it logs all messages to this file. During the normal operations of the directory server, if any operation is requested of the server, which it does not like to do, it would log the same. For instance, if a user tries to add an object with an invalid schema, server will not add the same and would record the relevant message in ibmslapd.log. Moreover, you can also get information like the number of additions that ldif2db did, or the number of entries that db2ldif managed to export successfully etc. Hence, ibmslapd.log is quite handy in resolving issues.
audit.log: The audit log shows what searches are being performed and the parameters used in each search. The audit log also shows the timestamp of when a client binds and unbinds from the directory, for that matter it timestamps all the operations it is supposed to log. Observing these measurements allows the LDAP administrator to identify LDAP operations that take a long time to complete.
db2cli.log: All errors encountered while the directory server tries to access the backend database using CLI (Call Level Interface) routines are logged into the db2cli.log file.
You can change the location of these files by modifying the appropriate settings from the Web administration tool or by directly editing the ibmslapd.conf file.
For more information on how to handle the above log files, please go through Chapter 17, “Monitoring IBM Tivoli Directory Server” on page 547.
18.2.3 Using server debug modes
If the above listed log files do not provide enough information about the problem, you can run the IBM Tivoli Directory Server in a special debug mode that generates very detailed information. An ibmslapd trace provides a list of the SQL commands issued to the DB2 database. These commands can help you identify operations that are taking a long time to complete.
Here is a snippet of the server debug trace:
053:08:12:32 T1452 61882676 423 usec SQLExecute => 0, hstmt=20001
053:08:12:32 T1452 61882977 26 usec SQLFetch => 100, hstmt=20001
The above statements show that the time taken to do the SQLExecutes of the statement with a handle of 20001 is 423 micro seconds and that the time required by the SQLFetch for the same SQL statement is 26 micro seconds.
In some cases, the log files you have collected seem to provide that some problem had occurred with the directory server, but fail to hint at the probable cause. The debug trace would help in such situations, as it would give more detailed steps of the server operations. The best example would be, suppose due to some error, the database starts up in configuration mode. The logs will not provide you the problem cause. They will just hint that there was a problem with the server. So how do you get to the root of the problem? Of course yes, by running the server in debug mode. That helps out to know the exact cause of the server starting up in configuration mode. You just correct the problem, pointed to, by the trace, and there you are, you’re server is up and running once again.
The server executable ibmslapd must be run from a command prompt to enable debug output. The syntax is as follows:
ldtrc on -l 20000000
ibmslapd -h <bitmask>
The above means to turn (on) the ldap trace and keep a buffer of 20 Million lines. that is, out of the total trace information only the last 20 Million lines would be kept in the buffer and not more than that. This is handy sometimes, in situations where you want to reduce the size of the debug file to be analyses and are sure that you would stop the server instantly when the problem occurs. Let us see what the above commands mean. First We will look into what ldtrc means for us.
ldtrc
This command is used for enabling/disabling the trace options for ibmslapd. In the sense that you would need to use this command to turn on the trace options for allowing ibmslapd to run in debug mode. What debug level ibmslapd runs at is a later issue. This command is just a preparatory step towards enabling the debug mode of ibmslapd.
ldtrc usage:
Usage: ldtrc (chg|clr|dmp|flw|fmt|inf|off|on) options
chg|change : change the trace mask, pid.tid, cpid or maxSevereErrors
clr|clear : clear the trace
dmp|dump : dump the trace to a binary trace file
flw|flow : show control flow of the trace
fmt|format : format the trace
inf|info|information : get information on the trace
off : turn the trace off
on : turn the trace on
For more information type ldtrc (chg|clr|dmp|flw|fmt|inf|off|on) help
The further details for the above shall not be given here and can be found in the description of ldaptrace in one of the following sections.
ibmslapd in debug mode
Once you have turned on the trace options using ldtrc, we can go ahead with collecting the server debug information by running ibmslapd in debug mode. The server is run in debug mode by specifying a bitmask. The bitmask helps the server in deciding the set of operations it is supposed to run with extensive tracing. Like if you have replication related issues and want to debug the replication operations of the server, you can turn on just the flags pertaining to replication (1024) that is, specify this debug bitmask while starting the server. A value of 65535 for the bitmask indicates that the maximum debug output should be generated. Table 18-1 describes the various flags you can set in the bitmask.
Table 18-1 Debug categories
Hex
Decimal
Value
Description
0x0001
1
LDAP_DEBUG_TRACE
Entry and exit from routines
0x0002
2
LDAP_DEBUG_PACKETS
Packet activity
0x0004
4
LDAP_DEBUG_ARGS
Data arguments from requests
0x0008
8
LDAP_DEBUG_CONNS
Connection activity
0x0010
16
LDAP_DEBUG_BER
Encoding and decoding of data
0x0020
32
LDAP_DEBUG_FILTER
Search filters
0x0040
64
LDAP_DEBUG_MESSAGE
Messaging subsystem activities and events
0x0080
128
LDAP_DEBUG_ACL
Access Control List activities
0x0100
256
LDAP_DEBUG_STATS
Operational statistics
0x0200
512
LDAP_DEBUG_THREAD
Threading statistics
0x0400
1024
LDAP_DEBUG_REPL
Replication statistics
0x0800
2048
LDAP_DEBUG_PARSE
Parsing activities
0x1000
4096
LDAP_DEBUG_PERFORMANCE
Relational backend performance statistics
0x2000
8192
LDAP_DEBUG_RDBM
Relational backend activities (RDBM)
0x4000
16384
LDAP_DEBUG_REFERRAL
Referral activities
0x8000
32768
LDAP_DEBUG_ERROR
Error conditions
0xffff
65535
LDAP_DEBUG_ANY
All levels of debug
Now depending upon the type of operations you want to debug, just form the relevant bitmask by ORing the individual bitmasks and pass the consolidated bitmask to ibmslapd, during its startup.
The trace output will be directed to the standard output. It is recommended that you redirect the same to a file for analyzing later, as the console buffer might not be sufficient to retain all the information on the screen. The file redirection can be achieved by following any of the given steps below.
For Windows:
ibmslapd -h bitmask > filename 2>&1
OR
set LDAP_DBG_FILE=filename
ibmslapd -h <bitmask> 2>&1
For Unix:
ibmslapd -h bitmask 2&>1 | tee filename
OR
export LDAP_DBG_FILE=filename
ibmslapd -h <bitmask> 2>&1
Running a trace on several operations will definitely result in slow performance, so remember to turn the trace off when you are finished using it by the following command:
ldtrc off
It is not always feasible to have the server run in debug mode for all times especially in a production environment, where high performance is always a mandate. In such circumstances, it is recommended to go for dynamic tracing, as will be seen in the next section.
Dynamic tracing
Sometimes it is observed that there are problems with the directory server, after running the directory server for a long time that is, say of the order of eight hours. The log files indicate that there is some problem, but it is not clear. However, it is essential to get to know the problem, because that’s impacting business. What do we do in such cases? It is not feasible to run the server in debug mode for say 8 hours and then analyze the tons of data that this will generate, taking a lot more time in debugging the issue. In some cases, we aren’t even sure that the problem would get generated after taking all the efforts of running the server in debug mode, in a planned downtime. Such situations are common and in such circumstances, it is better to go for dynamic tracing of the server. That would not impact the server’s performance, during the period when we know that the problem will not occur and also the amount of trace generated would be comparatively much smaller to amount generated using the static tracing. The utility being used for dynamic tracing is known as ldaptrace. Let us study this tool in more depth.
ldaptrace
The administration tracing utility, ldaptrace, is used to dynamically activate or deactivate tracing of the Directory Server. This extended operation can also be used to set the message level and specify the name of the file, where the output is written. If LDAP trace facility (ldtrc) options are requested, they must be preceded by --.
To display syntax help for ldaptrace, type:
ldaptrace -?
 
 
Note: While the ldaptrace utility can be used with SSL or TLS, only the simple bind mechanism is supported.
Here is a synopsis of what sort of parameters ldaptrace would take:
ldaptrace -a port -l [on|off|clr|chg|info|dump] --[ldtrc options] -D adminDn -h hostname -K keyfile -m debugLevel -N key_name -o debugFile -p port -P key_pw -t [start|stop] -v -w adminPW -Z -?
 
 
Note: Only the administrator or a member of the administrative group can use this utility.
Using ldaptrace consumes resources and affects the performance of the server.
Options of ldaptrace
The options are:
-a port: Specifies an alternate TCP port where IBM Administration Daemon (ibmdiradm), not the Directory Server, is listening. The default port is 3538. If not specified and -Z is specified, the default SSL port 3539 is used.
-l [on|off|clr|chg|info|dump] -[ldtrc options]:
 – on: Turns on the tracing facility. You can specify any of the following ldtrc options preceded by an extra -.
 • [-m <mask>] where <mask> = <products>.<events>.<components>.<classes>.<functions>.
 • [-p <pid>[.<tid>]] traces only the specified process or thread.
 • [-c <cpid>] traces only the specified companion process.
 • [-e <maxSevereErrors>] stops tracing after the maximum number of severe errors (maxSevereErrors) is reached.
 • [-s | -f <fileName>] sends the output to shared memory or a file.
 • [-l [<bufferSize>] | -i [<bufferSize>]] specifies to retain the last or the initial records. The default buffer is 1M.
 • [-this <thisPointer>] trace only the specified object.
 
 
Note: The tracing facility must be on for server data to be traced.
 – off: Turns off the tracing facility.
 – clr: Clears the existing trace buffer.
 – chg: The trace must be active before you can use the chg option to change the values for the following ldtrc options:
 • [-m <mask>] where <mask> = <products>.<events>.<components>.<classes>.<functions>.
 • [-p <pid>[.<tid>]] traces only the specified process or thread.
 • [-c <cpid>] traces only the specified companion process.
 • [-e <maxSevereErrors>] stops tracing after the maximum number of severe errors (maxSevereErrors) is reached.
 • [-this <thisPointer>] trace only the specified object.
 – info: Gets information about the trace. You must specify the source file which can be either a binary trace file, or trace buffer and a destination file. The following is an example of the information that the info parameter gives:
C:>ldtrc info
Trace Version : 1.00
Op. System : NT
Op. Sys. Version : 4.0
H/W Platform : 80x86
Mask : *.*.*.*.*.*
pid.tid to trace : all
cpid to trace : all
this pointer to trace : all
Treat this rc as sys err: none
Max severe errors : 1
Max record size : 32768 bytes
Trace destination : shared memory
Records to keep : last
Trace buffer size : 1048576 bytes
Trace data pointer check: no
 – dump: Dumps the trace information to a file. This information includes process flow data as well as server debug messages. You can specify the name of the destination file where you want to dump the trace. The default destination files is:
For Unix-based systems:
/var/ldap/ibmslapd.drace.dump
For Windows-based systems:
<installationpath>varibmslapd.trace.dump
 
 
Note: This file contains binary ldtrc data that must be formatted with the ldtrc format command.
-h ldaphost: Specify an alternate host on which the Directory Server and the Administration Daemon are running.
-K keyfile: Specify the name of the SSL or TLS key database file with default extension of kdb. If the key database file is not in the current directory, specify the fully-qualified key database filename. If a key database filename is not specified, this utility will first look for the presence of the SSL_KEYRING environment variable with an associated filename. If the SSL_KEYRING environment variable is not defined, the default keyring file will be used, if present.
A default keyring file that is, ldapkey.kdb, and the associated password stash file that is, ldapkey.sth, are installed in the /lib directory under LDAPHOME, where LDAPHOME is the path to the installed LDAP support. LDAPHOME varies by operating system platform:
AIX operating systems - /usr/ldap
HP-UX operating systems - /usr/IBMldap
Linux operating systems - /usr/ldap
Solaris operating systems - /opt/IBMldaps
Windows operating systems - c:Program FilesIBMLDAP
 
 
Note: This is the default install location. The actual LDAPHOME is determined during installation.
See IBM Directory C-Client SDK Programming Reference for more information about default key database files, and default Certificate Authorities. This document can be found at:
If a keyring database file cannot be located, a “hard-coded” set of default trusted certificate authority roots is used. The key database file typically contains one or more certificates of certificate authorities (CAs) that are trusted by the client. These types of X.509 certificates are also known as trusted roots. For more information on managing an SSL or TLS key database, see “SSL/TLS support” on page 455.
This parameter effectively enables the -Z switch.
-m debuglevel: Set the mask debugging level for server debug messages. Refer Table 20-1 on page 622 for more information on the debuglevel to be used. It is same as the bitmask, we pass to ibmslapd, as already discussed.
-N certificatename: Specify the label associated with the client certificate in the key database file. If the LDAP server is configured to perform server authentication only, a client certificate is not required. If the LDAP server is configured to perform client and server Authentication, a client certificate might be required. Certificatename is not required if a default certificate/private key pair has been designated as the default. Similarly, certificatename is not required if there is a single certificate/private key pair in the designated key database file. This parameter is ignored if neither -Z nor -K is specified.
-o debugfile: Specifies the output file name for the server debug messages.
-p port: Specify an alternate TCP port where the ldap server is listening. The default LDAP port is 389. If not specified and -Z is specified, the default LDAP SSL port 636 is used.
-P keyfilepw: Specify the key database password. This password is required to access the encrypted information in the key database file, which may include one or more private keys. If a password stash file is associated with the key database file, the password is obtained from the password stash file, and the -P parameter is not required. This parameter is ignored if neither -Z nor -K is specified.
-t [start|stop]:
 – start starts the collection of server trace data.
 – stop stops the collection of server trace data.
-v: Specifies to run in verbose mode.
-w adminPW | ? : Use adminPW as the password for authentication. Use the ? to generate a password prompt. Using this prompt prevents your password from being visible through the ps command.
-?: Displays the help screen.
Now let us see some examples for using the ldaptrace utility.
To turn the ldtrc facility on and start the server trace with a 2M trace buffer, issue the command:
ldaptrace -h <hostname> -D <adminDN> -w <adminpw> -l on -t start --l 2000000
To stop the server trace, issue the command:
ldaptrace -h <hostname> -D <adminDN> -w <adminpw> -t stop
To turn off the ldtrc facility, issue the command:
ldaptrace -h <hostname> -D <adminDN> -w <adminpw> -l off
To collect the trace over SSL, issue the command:
ldaptrace -h <hostname> -D <adminDN> -w <adminPW> -Z -K <SSL key db> -P <SSL key db password> -l on -t start --l 2000000
Thus using ldaptrace we can debug the server dynamically. Consequently we can maintain the performance of the server, by not running it in debug mode all the time and by taking the desired debug information as and when necessary.
18.2.4 DB2 error log file
The main db2 log file you need to check in case of errors is db2diag.log. This file is mainly meant for the support people and the developers to analyze.
In case of UNIX systems, it is located in <Directory containing your database>/sqllib/db2dump directory. In windows it is located in x:sqllib<instance_name> directory where x is the drive where DB2 is installed.
 
 
Note: The location of the db2diag.log file is controlled by the DB2 server configuration parameter DIAGPATH, so the directory paths on your system might be different from the default paths.
You can control the level of detailed information that is written to the db2diag.log file by using the DIAGLEVEL configuration parameter and the DLFM_LOG_LEVEL registry value.
DIAGLEVEL
Determines the severity of DB2 diagnostic information recorded in the db2diag.log error log file. Valid values are from 1–4. 1 denotes that a minimal amount of information is to be recorded, and 4 denotes that the maximum amount of information is to be recorded. The default setting is 3. You can increase the amount of error information recorded using the following command: db2 update dbm cfg using DIAGLEVEL 4. This setting should be changed only at the request of IBM service or development for debugging purposes.
DLFM_LOG_LEVEL
Determines the severity of DLFM diagnostic information recorded in the db2diag.log error log file. Its default setting is LOG_ERR. You can increase the amount of error information recorded using the following command:
db2set DLFM_LOG_LEVEL=LOG_DEBUG
18.3 Summary
In summary:
To start with, we went through the necessity of debugging the server.
Then we went through different types of the problems encountered with the directory server and the means to debug the same.
 – Configuration problems
 – Server related problems
 • Using log files
 • Using the server debug trace
 • Using the dynamic trace facility to debug server operations
Finally we went through debugging issues pertaining to DB2.
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset