vmstat output with date & timestamp


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers vmstat output with date & timestamp
# 8  
Old 11-15-2006
One minor issue ...

This is the statement that I run ...It appends the date , but I get these annoying errors as well ...

$ vmstat 3 5 | appendDate

appendDate: function: not found

procs memory page disk faults cpu 11-15-2006 10:44:43
r b w swap free re mf pi po fr de sr hx s0 s1 s6 in sy cs us sy id 11-15-2006 10:44:43
0 0 1 2520 10776 63 108 757 1162 1231 0 17 0 5 0 0 1665 3314 1071 12 5 83 11-15-2006 10:44:43
0 0 1 1844016 32504 3 101 0 24 24 0 0 0 0 0 0 422 386 117 0 1 99 11-15-2006 10:44:46
0 0 1 1844016 32504 3 34 0 24 24 0 0 0 0 0 0 425 326 129 0 0 100 11-15-2006 10:44:49
0 0 1 1844016 32496 5 34 0 45 45 0 0 0 5 0 0 449 328 122 0 1 99 11-15-2006 10:44:52
0 0 1 1844016 32496 3 34 0 24 24 0 0 0 0 0 0 428 337 94 0 0 100 11-15-2006 10:44:55

appendDate: syntax error at line 8: `}' unexpected

Why do I get these errors ..Am i missing something ...

appendDate: function: not found
appendDate: syntax error at line 8: `}' unexpected

Additional Info ..

$ ls -l appendDate
-rwx--x--x 1 oracle dba 104 Nov 15 10:37 appendDate

$ cat appendDate

function appendDate{
while read line
do
printf "$line"
date '+ %m-%d-%Y %H:%M:%S'
done
}


$ echo $SHELL
/bin/sh

$ uname -a
SunOS Westpark 5.7 Generic_106541-34 sun4u sparc SUNW,Ultra-60
$

Thanks
# 9  
Old 11-15-2006
You have implemented the code that I provided as a script not a function, so just change your appendDate script to...
Code:
while read line
do
  printf "$line"
  date '+ %m-%d-%Y %H:%M:%S'
done

# 10  
Old 11-16-2006
Function Vs Script

Thanks Ygor for clarifying that ...It works fine now, as a script ...

How do I compile the code, that you gave me initially, as a function ....

Thanks for your time ....
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Pls. help with vmstat output...

Hi, Users are reporting performance issue on my Sun Solaris 10 server. I am on the server. I don't see a issue or I might be looking at the wrong thing. Please help. I don't see anything on sar. it's all zero on that. Not sure why users are reporting high CPU and unresponsive at times. ... (1 Reply)
Discussion started by: samnyc
1 Replies

2. Shell Programming and Scripting

grep with date & unique output

alert.log has the entries with ORA-XXXX, .... Mon Sep 24 15:08:09 2012 WARNING: inbound connection timed out (ORA-3136) Mon Sep 24 15:08:09 2012 WARNING: inbound connection timed out (ORA-3136) Mon Sep 24 15:08:09 2012 WARNING: inbound connection timed out (ORA-3136) Mon Sep 24 15:15:01... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

3. Shell Programming and Scripting

Check if a date field has date or timestamp or date&timestamp

Hi, In a field, I should receive the date with time stamp in a particular field. But sometimes the vendor sends just the date or the timestamp or correctl the date&timestamp. I have to figure out the the data is a date or time stamp or date&timestamp. If it is date then append "<space>00:00:00"... (1 Reply)
Discussion started by: machomaddy
1 Replies

4. Solaris

help with vmstat output

Hi all. I need some assistance with my vmstat output. We have several oracle db's running on our solaris machine: SunOS rcworaprd 5.9 Generic_112233-07 sun4u sparc SUNW,Sun-Fire-480R Recently I bumped up our main Oracle database to use 6 GB instead of 4 GB as vmstat output was showing... (1 Reply)
Discussion started by: jamie_collins
1 Replies

5. AIX

vmstat incomprehensible output

Hello everybody, When i run Nmon the output is really incomprehensible vmstat 5 System configuration: lcpu=16 mem=24576MB ent=4.00 kthr memory page faults cpu ----- ----------- ------------------------ ------------ -----------------------... (3 Replies)
Discussion started by: Vit0_Corleone
3 Replies

6. Solaris

Howto troubleshoot Perfomance using vmstat & iostat

Can anyone tell me what to look for in terms of abnormal numbers on vmstat or iostat? I have a box with figures pbelow, how would I tell if it's underperforming & what remedies \ perfomance tuning could I perform? thanks all ------------------------------------- -vmstat 5 5 kthr ... (4 Replies)
Discussion started by: stevie_velvet
4 Replies

7. Shell Programming and Scripting

how to display date along with vmstat

Hi Unix Gurus, I have a script which runs vmstat and puts the output to a file. I am pulling the runq,usr,sys,idle columns using awk vmstat 2|awk {'print $1,$14,$15,$16'} Now within this command is there any way i can pass the date too. Please do let me know. Thanks in advance. Arun (5 Replies)
Discussion started by: arunrao_oradba
5 Replies

8. Shell Programming and Scripting

Timestamp & date

Hi, I have list of files as below, with prefix named as date & time. Anyone how to transform each file as below to yyyy-mm-dd hh:mm:ss Regards, (8 Replies)
Discussion started by: rauphelhunter
8 Replies

9. UNIX for Advanced & Expert Users

output of vmstat

i have 2 question about vmstat 1) pin (pagein) output of vmstat is always zero for our system what is the meaning of this? (pout significantly changes depending on the running processes) 2) sometimes react output of vmstat is given in K like 44K sometimes it is given without any unit... (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

10. UNIX for Dummies Questions & Answers

BOX Status with vmstat & top Solaris 2.8

Hi there, I´m trying to get the information of vmstat & top in two different logfiles. That not that difficult. vmstat 30 >> myfile.log top >> myfile2.log But I also like to include a timestamp every 30 sec to be sure from what date the logs are. For the Top command I were able to... (2 Replies)
Discussion started by: isacs
2 Replies
Login or Register to Ask a Question