LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-03-2008, 11:29 PM   #1
Paris Heng
Member
 
Registered: Jul 2007
Location: Kuala Lumpur, Malaysia
Distribution: Ubuntu 8.04, Solaris 10
Posts: 198

Rep: Reputation: 30
Extracting ICMP Output for Plotting


Dear,

I want to perform a plotting using xgraph, and the plotting data (ping.txt) is as below. For the graph I just want to plot the time for x-axis (line count) and the RTT for y-axis (time in ms). Below are script i write for that purpose but it seen did not work. Any guide for me because i think the script is wrong. The plot is about like this,

Ping Plot Example

ping.txt
-------------------------------------------------------------
64 bytes from 192.168.1.100: icmp_seq=0 ttl=255 time=0.712 ms
64 bytes from 192.168.1.100: icmp_seq=1 ttl=255 time=0.620 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=255 time=0.698 ms
64 bytes from 192.168.1.100: icmp_seq=3 ttl=255 time=0.662 ms
64 bytes from 192.168.1.100: icmp_seq=4 ttl=255 time=0.649 ms
-------------------------------------------------------------

Quote:
#!/bin/sh
#For x-axis (Time)
wc -l ping.txt > plot.txt

#For y-axis (RTT)
ping.txt | awk '{print $7}' > plot.txt

#Plotting graph using xgraph
xgraph -bb -tk -x "Time" -y "RTT" plot.txt
Intended plot.txt
-----------------
1 0.712
2 0.620
3 0.698
4 0.662
5 0.649
-----------------

Last edited by Paris Heng; 02-03-2008 at 11:43 PM.
 
Old 02-04-2008, 01:40 AM   #2
cetialphav
Member
 
Registered: Sep 2003
Location: Raleigh, NC, USA
Distribution: Fedora
Posts: 88

Rep: Reputation: 16
Does this get you closer to what you want?

Code:
#!/bin/sh
#For x-axis (Time)
wc -l ping.txt > plot.txt

#For y-axis (RTT)
cat ping.txt | awk '{print $8}' | awk 'FS="=" {print $1}' > plot.txt

#Plotting graph using xgraph
xgraph -bb -tk -x "Time" -y "RTT" plot.txt
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
plotting points in scilab kevinlyfellow Linux - Software 3 03-12-2006 06:05 PM
graph plotting in c/c++ vrdhananjay Programming 1 01-20-2005 08:11 PM
ICMP traffic archives/writing ICMP traffic in a file maia_1 Programming 0 07-20-2004 03:43 AM
Can't ping - iptable problem (possibly ICMP or OUTPUT) hamish Linux - Networking 3 04-21-2004 08:30 PM
redhat 7.1 plotting programs suqu Red Hat 2 10-16-2003 12:28 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration