I'll be the first to confess that I'm a mental midget when it comes to programming, so things like regular expressions and Perl/PHP in general are way over my head. Unfortunately, capturing the output of many command line utilities for RRDTOOL requires more brain cells than I have left. There's SED, CUT, AWK in the Unix/Cygwin world and other than CUT, the docs are almost as long as the Perl manual.
I'm also a lazy sod, so I found a small free console util called LMOD http://home.mnet-online.de/horst.muc/int/lmod12.zip which has proven to be very good for capturing certain fields in the output of a command.
Here's an example: (I'm using TCPSPRAY.EXE - just do a Yahoo search if you want it)
c:\> tcpspray.exe -n 1000 192.168.1.1
Transmitted 1025024 bytes in 3.680 seconds (149.850±0.225 kbytes/s)
Let's say we want to capture the number of seconds it takes to transfer around 1MB of data to host 192.168.1.1 - In the case above, we see it takes 3.680 seconds. The only data we want to enter into an .RRD file is
3.680, the FIFTH word in the line. Using LMOD, the syntax is:
c:\> tcpspray.exe -n 1000 192.168.1.1 | lmod [$5]
3.680
Nice, huh ?
If you want to get tricky, you can even update the .RRD file by putting the
RRDTOOL.exe update command right between the word lmod and [$5] and piping the output to a batch file which you can call - like this :
<your app> | lmod RRDTOOL update your-rrd.rrd N:[$5] >mybatch.bat
call mybatch.bat (BTW, check the exact Update syntax at http://people.ee.ethz.ch/~oetiker/webto ... pdate.html
ta da !
LMOD has a ton of additional options and switches. And the sucka is free!
Go forth, and enjoy.
VJ
Here's a Very Nice Additional Util for Windows Users
Moderators: Developers, Moderators
-
- Posts: 4
- Joined: Tue Apr 16, 2002 1:00 pm
Other useful utilities
FYI, you should also try the pstools suite of tools from sysinternals.
Their website is here: http://www.sysinternals.com/ the pstools download is here: http://www.sysinternals.com/files/Pstools.zip
btw, these toosl are free.
Here is what they can do (btw, they are all command line)
PsExec - execute processes remotely
PsFile - shows files opened remotely
PsGetSid - display the SID of a computer or a user
PsKill - kill processes by name or process ID
PsInfo - list information about a system
PsList - list detailed information about processes
PsLoggedOn - see who's logged on locally and via resource sharing (full source is included)
PsLogList - dump event log records
PsService - view and control services
PsShutdown - shuts down and optionally reboots a computer
PsSuspend - suspends processes
PsUptime - shows you how long a system has been running since its last reboot (PsUptime's functionality has been incorporated into PsInfo)
pstools combined with some of the unix tools from http://unxutils.sourceforge.net/ (sed, awk, grep, etc) are a nice combo.
-ec
Their website is here: http://www.sysinternals.com/ the pstools download is here: http://www.sysinternals.com/files/Pstools.zip
btw, these toosl are free.
Here is what they can do (btw, they are all command line)
PsExec - execute processes remotely
PsFile - shows files opened remotely
PsGetSid - display the SID of a computer or a user
PsKill - kill processes by name or process ID
PsInfo - list information about a system
PsList - list detailed information about processes
PsLoggedOn - see who's logged on locally and via resource sharing (full source is included)
PsLogList - dump event log records
PsService - view and control services
PsShutdown - shuts down and optionally reboots a computer
PsSuspend - suspends processes
PsUptime - shows you how long a system has been running since its last reboot (PsUptime's functionality has been incorporated into PsInfo)
pstools combined with some of the unix tools from http://unxutils.sourceforge.net/ (sed, awk, grep, etc) are a nice combo.
-ec
Who is online
Users browsing this forum: No registered users and 3 guests