arch12
July 7, 2010, 11:19pm
1
need to check hardware error are zero
iostat -en |awk '{ if ( $2 == 0 ) { print " " } else { print " Hardware errors "} }
can someone please tell me whats wrong with this[COLOR="\#738fbf "]
---------- Post updated at 10:19 PM ---------- Previous update was at 10:16 PM ----------
iostat -en
---- errors ---
s/w h/w trn tot device
2 0 0 2 c1t0d0
3 0 0 3 c0t0d0
2 0 0 2 c1t2d0
0 0 0 0 c4t600A0B80005A4D130000039F4A4689B8d0
0 0 0 0 c4t600A0B80005A4D15000003954A468A59d0
2 0 0 2 c4t600A0B80005A4D13000003A14A468B24d0
2 0 0 2 c4t600A0B80005A4D15000003964A468BE9d0
2 0 0 2 c4t600A0B80005A4D13000003A24A468C64d0
2 0 0 2 c4t600A0B80005A4D15000003974A468E29d0
2 0 0 2 c4t600A0B80005A4D13000003A34A468EDCd0
0 0 0 0 c4t600A0B80005A4D15000003994A468F7Fd0
Hi,
there is a single quote missing at the end of your command.
Try:
iostat -en | awk '/^[0-9]/{if ($2 != 0 ) print "Hardware errors"}'
HTH Chris
i need to print errors instead of the hardware errors can someone help
arch12
September 17, 2010, 12:57am
4
hi its not working it doesnot generate any ouput can u help
sh: iostat: cannot execute
rdcwayx
September 17, 2010, 1:12am
5
iostat -en |awk '{print $0, ($2)?X:"Hardware errors"}'
If the iostat output like this:
iostat -en
---- errors ---
s/w h/w trn tot device
2 0 0 2 c1t0d0
3 0 0 3 c0t0d0
2 0 0 2 c1t2d0
0 0 0 0 c4t600A0B80005A4D130000039F4A4689B8d0
0 0 0 0 c4t600A0B80005A4D15000003954A468A59d0
2 0 0 2 c4t600A0B80005A4D13000003A14A468B24d0
2 123 0 2 c4t600A0B80005A4D15000003964A468BE9d0
2 234 0 2 c4t600A0B80005A4D13000003A24A468C64d0
2 0 0 2 c4t600A0B80005A4D15000003974A468E29d0
2 0 0 2 c4t600A0B80005A4D13000003A34A468EDCd0
0 0 0 0 c4t600A0B80005A4D15000003994A468F7Fd0
the awk ouput is:
---- errors ---
s/w h/w trn tot device
2 0 0 2 c1t0d0 Hardware errors
3 0 0 3 c0t0d0 Hardware errors
2 0 0 2 c1t2d0 Hardware errors
0 0 0 0 c4t600A0B80005A4D130000039F4A4689B8d0 Hardware errors
0 0 0 0 c4t600A0B80005A4D15000003954A468A59d0 Hardware errors
2 0 0 2 c4t600A0B80005A4D13000003A14A468B24d0 Hardware errors
2 123 0 2 c4t600A0B80005A4D15000003964A468BE9d0
2 234 0 2 c4t600A0B80005A4D13000003A24A468C64d0
2 0 0 2 c4t600A0B80005A4D15000003974A468E29d0 Hardware errors
2 0 0 2 c4t600A0B80005A4D13000003A34A468EDCd0 Hardware errors
0 0 0 0 c4t600A0B80005A4D15000003994A468F7Fd0 Hardware errors
arch12
September 17, 2010, 1:32am
6
nope i just want to check only if $2 is zero.print just the h/w errors
iostat -en |awk '{ if ( $2 == 0 ) { print " " } else { print " Hardware errors "} }
rdcwayx
September 17, 2010, 1:56am
7
iostat -en | awk '{print ($2)?"Hardware errors":X}'
arch12
September 17, 2010, 2:08am
8
iostat -en | awk '{print ($2)?"Hardware errors":X}'
Hardware errors
Hardware errors
s/w h/w trn tot device
2 0 0 2 c1t0d0
3 0 0 3 c0t0d0
2 0 0 2 c1t2d0
0 0 0 0 c4t600A0B80005A4D130000039F4A4689B8d0
0 0 0 0 c4t600A0B80005A4D15000003954A468A59d0
2 0 0 2 c4t600A0B80005A4D13000003A14A468B24d0
2 0 0 2 c4t600A0B80005A4D15000003964A468BE9d0
2 0 0 2 c4t600A0B80005A4D13000003A24A468C64d0
2 0 0 2 c4t600A0B80005A4D15000003974A468E29d0
2 0 0 2 c4t600A0B80005A4D13000003A34A468EDCd0
0 0 0 0 c4t600A0B80005A4D15000003994A468F7Fd0
even though its zero its showing hardware errors?
---------- Post updated at 01:08 AM ---------- Previous update was at 01:06 AM ----------
thats not the kind of O/p i want as said before i am trying to check if the device has any hardware errors or not
rdcwayx
September 17, 2010, 2:11am
9
Ok, paste your expect O/P here.
arch12
September 17, 2010, 2:17am
10
device has 4 hardware errors,i have to check if h/w coloumn has zero in it and if there are more errors then that particular device has hardware errors.thanks again
example
c4t600A0B80005A4D130000039F4A4689B8d0 has 5 errors
rdcwayx
September 17, 2010, 2:37am
11
but we can't get your result from your sample data.
What 's meaning of 5 erros? where do you get it?
arch12
September 17, 2010, 7:48am
12
iostat -en |awk '{ if ( $2 == 0 ) { print " " } else { print " Hardware errors "} }
does $2 check the entire coloumn if everything is zero.from the O/p you pasted
incase there are any error it should print that device has errors
iostat -en | awk '/^[0-9]/{if ($2 != 0 ) print "Hardware errors"}'
use to work before but now its not working anymore dont know why please help