grep and awk for windows

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
tommy
Posts: 3
Joined: Mon Sep 16, 2002 6:21 pm

grep and awk for windows

Post by tommy »

I am getting going with Cacti on Windows 2000 IIS5 (Iknow...Iknow ...)

I have got the program working with some help but the graphs are not plotting any info. Right now I am working with a basic ping test.

I noticed that using the SHOW OUTPUT command in the Cron Printout screen would not show anything for my test.

Iran the command line listed in the Cron Printout screen from a dos prompt and recieved a grep error.

I got a copy of grep for windows and am now getting an awk error.

I got a copy of awk for windows and am now recieveing this error:

C:\Documents and Settings\Administrator>perl c:/inetpub/wwwroot/cacti/scripts/ping.pl 4 10.0.0.254
awk: cmd. line:1: '{print
awk: cmd. line:1: ^ Invalid char ''' in expression

awk: cmd. line:1: '{print
awk: cmd. line:1: ^ Invalid char ''' in expression

Clues would be greatly appreciated
Answers would be highly regarded.

Thanks,

Tom
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I recommend using a perl.pl script that does not require awk. Newer cacti releases come with this script:

Code: Select all

#!/usr/bin/perl

$ping = `ping -c $ARGV[0] $ARGV[1] -w 1 | grep icmp_seq`;
$ping =~ s/(.*time=)(.*) (ms|usec)//;

print $2;
Keep in mind that this will not work unless you either:

1) Modify the ping syntax so it works with the Windows 2000 ping.

2) Get a copy of the Unix ping for windows.

-Ian
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests