[Emerald] Monitoring Terminal Server Ports

Kenneth D. Lenox ( (no email) )
Sun, 18 Apr 1999 05:03:47 +0900

Greetings all,
For those interested, I have managed a way to get MRTG/NT to graph
modem/port usage stats on just about any Terminal Server(we use Computone) .
First thing I found was a grep binary that spits out the number of <regexp>
it finds in a particular file. Next I wrote a small and easy perl script to
execute three commands:

@_ = system ("finger \@xxx.xxx.xxx.xxx > file.cfg");
@_ = system ('grep -c pppfsm file.cfg');
@_ = system ('grep -c pppfsm file.cfg');

"System" is used to call binary executables.
Finger queries the server and returns the output to file.cfg. Part of the
finger output for customers logged in is "pppfsm", so I grep "file.cfg"
twice (one for input and one for output as required by mrtg) and get this:

18 (or how many are logged in now)
18
(grep -c suppresses normal output and only outputs the count)

Here is the mrtg.cfg that calls the server1 script:

Target[TS1]: `perl c:\mrtg\server1`
WithPeak[TS1]: wmyd
Options[TS1]: growright, gauge
YLegend[TS1]: Active Lines
ShortLegend[TS1]: Used
MaxBytes[TS1]: 64
Etc...Etc...

And that's it! If your terminal server supports "finger"(which I suspect
most do), then this should work for you as well. I found the grep.exe file
at winfiles.com, it's version 2.0, and the finger.exe is a generic one(don't
remember where I got it). They both can be in your c:\mrtg directory.
The only problem I've found with this is that the finger output will create
the "file.cfg" in the "WorkDir" specified in your "mrtg.cfg" file. So you
may need to add the full path to your grep command like:
@_ = system ('grep -c pppfsm e:\inetpub\wwwroot\mrtg\file.cfg')

cheers,
Ken Lenox