multiple graphs on same window


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers multiple graphs on same window
# 1  
Old 07-28-2010
Error multiple graphs on same window

Hi All,

I have written a script to get live data after 5 minutes from a remote system and then plot the graph using gnuplot.All this has been working correctly with only one problem where i need to pull all these graphs into one page.I am not able to get this working.I tried reading about multiplot but couldnt get it too work.I am putting my script details to see if any one can help me in this regard.


Current working script with individual Gnuplot outputs.

Code:
#!/bin/sh
today=`perl /root/scripts/getYYYYMMDD.pl -0`;
yesterday=`perl /root/scripts/getYYYYMMDD.pl -1`;
old=`perl /root/scripts/getYYYYMMDD.pl -7`;
rm /root/msc/scripts/files/*$old*.*
sleep 1
/usr/bin/expect /root/msc/scripts/traffic_ssh.exp > /root/msc/scripts/files/traffic_$today.log
sleep 2
grep "DIXIN1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_DX.log
#grep "DIXIN1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DX.log
grep "DIXIN2O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_DX.log
#grep "DIXIN2I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DX.log
grep "DIYIN1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_DY.log 
#grep "DIYIN1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DY.log
grep "TLMOB1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_TELMO.log
grep "TLMOB1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_TELMI.log
grep "TLPSTO" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fil
es/SUM_TELPO.log
grep "TLPST1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_TELPO.log
grep "TLPSTI" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fil
es/SUM_TELPI.log
grep "TLPST1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_TELPI.log
grep "SRM1B1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_BSC.log
grep "SRM1B1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_BSC.log
sleep 1
#### DX traffic####
sed -n '/^DATE/ {n; p;}' /root/msc/scripts/files/traffic_$today.log | awk -F" " '{print $1,$2}' > /root/msc/scripts/files/dat
e_time.txt
#echo "Date Time MIAMI/DX total_dev" > /root/msc/scripts/files/DX_traffic_$today.dat
awk -F"," '{x += $2} END {print x,238}' /root/msc/scripts/files/SUM_DX.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/DX_traffi
c_$today.dat
sleep 1
cp /root/msc/scripts/files/DX_traffic_$today.dat /root/msc/scripts/graph/DX_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/dx.pg > /root/msc/scripts/graph/dx.png
sleep 1
######## DY Traffic #############
#echo "Date Time New-York/DY total_dev" > /root/msc/scripts/files/DY_traffic_$today.dat
awk -F"," '{x += $2} END {print x,238}' /root/msc/scripts/files/SUM_DY.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/DY_traffi
c_$today.dat
sleep 1
cp /root/msc/scripts/files/DY_traffic_$today.dat /root/msc/scripts/graph/DY_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/dy.pg > /root/msc/scripts/graph/dy.png
######### Telesur Mobile Originating ################
sleep 1
#echo "Date Time Telesur-Mobile/Originating total_dev" > /root/msc/scripts/files/TELMO_traffic_$today.dat
awk -F"," '{x += $2} END {print x,480}' /root/msc/scripts/files/SUM_TELMO.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELMO_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELMO_traffic_$today.dat /root/msc/scripts/graph/TELMO_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELMO.pg > /root/msc/scripts/graph/TELMO.png
######### Telesur Mobile Terminating ################
sleep 1
#echo "Date Time Telesur-Mobile/terminating total_dev" > /root/msc/scripts/files/TELMI_traffic_$today.dat
awk -F"," '{x += $2} END {print x,480}' /root/msc/scripts/files/SUM_TELMI.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELMI_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELMI_traffic_$today.dat /root/msc/scripts/graph/TELMI_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELMI.pg > /root/msc/scripts/graph/TELMI.png
################### Telesur PSTN Originating ##################################################
sleep 1
#echo "Date Time Telesur-PSTN/Originating total_dev" > /root/msc/scripts/files/TELPO_traffic_$today.dat
awk -F"," '{x += $2} END {print x,120}' /root/msc/scripts/files/SUM_TELPO.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELPO_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELPO_traffic_$today.dat /root/msc/scripts/graph/TELPO_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELPO.pg > /root/msc/scripts/graph/TELPO.png
#####################Telesur PSTN Terminating #################################################
sleep 1
#echo "Date Time Telesur-PSTN/terminating total_dev" > /root/msc/scripts/files/TELPI_traffic_$today.dat
awk -F"," '{x += $2} END {print x,120}' /root/msc/scripts/files/SUM_TELPI.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELPI_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELPI_traffic_$today.dat /root/msc/scripts/graph/TELPI_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELPI.pg > /root/msc/scripts/graph/TELPI.png
##################### Digicel BSC ###############################################
sleep 1
#echo "Date Time BSC total_dev" > /root/msc/scripts/files/BSC_traffic_$today.dat
awk -F"," '{x += $2} END {print x,5766}' /root/msc/scripts/files/SUM_BSC.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/BSC_traff
ic_$today.dat
sleep 1
cp /root/msc/scripts/files/BSC_traffic_$today.dat /root/msc/scripts/graph/BSC_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/BSC.pg > /root/msc/scripts/graph/BSC.png
sleep 1
################################################################################################################

# 2  
Old 07-29-2010
Your code is little long, and can be simplified. First from the "grep-tail-awk"

Code:
grep "DIXIN1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_DX.log
#grep "DIXIN1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DX.log
grep "DIXIN2O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_DX.log
#grep "DIXIN2I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DX.log

Can be replaced by one awk

Code:
awk 'BEGIN{OFS=","} 
     /DIXIN1O/ {a[1]=$1;a[2]=$2;a[3]=$3]}
     /DIXIN2O/ {b[1]=$1;b[2]=$2;b[3]=$3]}
     END {print a[1],a[3],a[2]
          print b[1],b[3],b[2]} /root/msc/scripts/files/traffic_$today.log > /root/msc/scripts/files/SUM_DX.log



---------- Post updated at 04:41 PM ---------- Previous update was at 04:31 PM ----------

Code:
sed -n '/^DATE/ {n; p;}' /root/msc/scripts/files/traffic_$today.log | awk -F" " '{print $1,$2}' > /root/msc/scripts/files/date_time.txt

can be changed to :

Code:
awk '/^DATE/ {next;print $1,$2}' /root/msc/scripts/files/traffic_$today.log >/root/msc/scripts/files/date_time.txt

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Toggle between xterm window and standard terminal window

Is it possible to toggle back and forth between an xterm invoked from one tty, and a shell invoked from a different tty? I am running Centos 7 with KDE and booting in non-graphic mode. After logging in on the default window (/dev/tty1) , I can then use ALT-F2 to access a new window (/dev/tty2),... (1 Reply)
Discussion started by: rhgscty
1 Replies

2. Red Hat

Do not show graphs cacti

hi installed caci and Snmp connection is established 10.10 (192.168.10.10) SNMP Information System:Hardware: Intel64 Family 6 Model 23 Stepping 6 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7601 Multiprocessor Free) Uptime: 7550665 (0 days,... (2 Replies)
Discussion started by: mnnn
2 Replies

3. Shell Programming and Scripting

Script to launch a KDE Konsole window with multiple tabs

Gents, I found this script to to launch a KDE Konsole window with multiple tabs.. #!/bin/bash # # Create my standard konsole windows. if ]; then profile=Shell fi sessions=( sh1 $profile 'clear; bash' sh1 $profile 'clear; bash' su1 $profile 'clear; su'... (1 Reply)
Discussion started by: jiam912
1 Replies

4. Programming

Help with Graphs (BFS mostly)

Okay so I posted a thread about my project before, how I need to create generated word ladders and all that. Now I am to the point where I need to create a method which will find the shortests path between a start word and an end word. For example: startWord: Head endWord: Feet And then a... (3 Replies)
Discussion started by: SilvarHawke
3 Replies

5. Shell Programming and Scripting

How to create multiple input box in same window using dialog

Hi All, I was trying to generate GUI using shell script. After long search I found the utility called “dialog”. Using this utility I am able to generate window to collect the input. dialog --inputbox "Input 1" 10 45 dialog --inputbox "Input 2" 10 45 dialog --inputbox "Input 3" 10 45 Using... (2 Replies)
Discussion started by: kalpeer
2 Replies

6. Ubuntu

run multiple command at the same time in one window terminal using multiplexer

Hi, I would like to ask if someone knows or accomplished this task in the terminal multiplexer in a single window with multiple splitted pane: In the script run multiple command at the same time in diff splitted pane or simulatneously. As an example: I would like to run iptraf, iotop, htop,... (2 Replies)
Discussion started by: jao_madn
2 Replies

7. Shell Programming and Scripting

Creating graphs

Platform: solaris 9 x86 I want to be able to create excel like line graphs with basic input data and use it on a webpage or worst case so I can use it to insert to a document type of input file I would have, example below datainput.txt: date,requests,failures,success 20100501,80,10,70... (5 Replies)
Discussion started by: frustrated1
5 Replies

8. Solaris

Multiple Hosts on Solaris CDE window

I forgot how to configure multiple host servers on the my CDE windows in Solaris. I'll appreciate any help Thanks, Remi (2 Replies)
Discussion started by: Remi
2 Replies

9. Windows & DOS: Issues & Discussions

window 2000 professional not pinging my window 98 system.

Hello, We someone help me resolve this problem. I have window 2000 professional, windows 98 and Unixware 7.0.1 on the network. I was able to establish connection with all. However, l was unable to ping window 98 from window 2000 professional. I was able to ping the window 2000 from the window... (10 Replies)
Discussion started by: kayode
10 Replies
Login or Register to Ask a Question