Counting LDAP Connections

Novell Cool Solutions: Tip
By Aaron Burgemeister

Digg This - Slashdot This

Posted: 26 Apr 2006


A Forum reader asked the following question:

"I want to know how many LDAP connections are active on a server. Is there a way to get that information? We are running eDirectory 8.7.3 on Windows 2000."

And here's the response from Novell's Aaron Burgemeister ...


It's simple enough to code. On *nix platforms it would look like this:

netstat -anp | grep "389\|636" | grep ESTABLISHED | wc -l

The above line says to show all connections numerically, looking for 389's or 636's. (Those are secure / insecure ports - that can be trimmed down to one port or another if you like.) In those ports, look for those connections that are established - the command gives you a count of lines (how many there are).

On Windows it's a similar process:

netstat -an

Take that output and look for lines with "389" and "ESTABLISHED" and then count the lines. This is simple enough in Perl, probably a one-line Perl script, if you install it from ActiveState or something similar.

Peter Kuo adds:

"Note that unless you have presistent connections, usually an LDAP 'connection' doesn't really exist - in the sense that the client authenticates, queries for the info, gets the data, and disconnects right away."

Akos Szechy adds:

"On Windows you can also use the same utilities, as there is a port for grep and wc at http://unxutils.sourceforge.net/ ... It works quite nicely."

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© Micro Focus