metastat |grep Needs


 
Thread Tools Search this Thread
Operating Systems Solaris metastat |grep Needs
# 1  
Old 06-21-2011
metastat |grep Needs

Dear,

Required an script such that :

If metastat |grep Needs , results in some output then this command to be executed for the same :

opcmsg object=metastat a=OS msg_grp=OpC severity=critical msg_text="Need maintenance for the system $line"


With regards,
Mjoshi
# 2  
Old 06-21-2011
if the grep command gives some output, then opcmsg command will execute

Code:
 
metastat | grep Needs > /dev/null
 
if [ "$?" -eq "0" ]
then
opcmsg object=metastat a=OS msg_grp=OpC severity=critical msg_text="Need maintenance for the system $line"
fi

# 3  
Old 06-21-2011
Can you please explain :

if [ "$?" -eq "0" ]
# 4  
Old 06-21-2011
$? - holding the previous command exit status

Code:
 
echo "abc" | grep abc
echo $?
 
echo "xyz" | grep abc
echo $?

if the value of $? is zero, then the previous command is success
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Metastat shows state needs maintenance

Hi, We have a Solaris 10 machine with update 11 and was configured with IBM storage. It was assigned 2 LUNs (each 70GB) which were striped to make it 140GB. we have taken full backup of entire machine and Our storage team replaced IBM storage with Nimble storage (they did storage-level... (6 Replies)
Discussion started by: prvnrk
6 Replies

2. Shell Programming and Scripting

Grep contents from metastat command

Hi, after issuing metastat command I am getting output as follows Actually these soft partitions are more than 100. I want output as Device Name & Size. for eg d4004 2.0 GB (4 Replies)
Discussion started by: tuxian
4 Replies

3. Solaris

restore metastat configuration after solaris upgrade

Greetings How can i restore metastat db after a solaris upgrade (9 to 10)? will it work if i save and restore /etc/vfstab and /etc/lvm/md.cf file? root@netad# metastat d35: Mirror Submirror 0: d38 State: Okay Submirror 1: d39 State: Okay Pass:... (2 Replies)
Discussion started by: kashif_islam
2 Replies

4. Solaris

SVM Solaris 8 Problem. Metastat output looping

Hi friends, I'm newbie to SVM. Just wanna try installed it on one of our server (to do mirroring for disk0 and disk1) but i think im lost until now. :( the steps i've taken is as below:- 1.prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2 2.metadb -a -c 3 -f c1t0d0s7... (3 Replies)
Discussion started by: kronenose
3 Replies

5. Solaris

Softpartition State: Errored in Command MetaStat

Hi people, I have on problem when execute the command METASTAT... d60: Soft Partition Device: d10 State: Errored Size: 12582912 blocks (6.0 GB) Someone help me? Thank you very much (4 Replies)
Discussion started by: denisgomes
4 Replies

6. Filesystems, Disks and Memory

What should I do with this metastat result? metareplace everything?

I have to rescue the volumes in a soloris 7 machine. The metastat returns the following result: d6 is dying with iostat -nE returns Harderror 3, Transports error 9 Can some offer me some help? Thank you very much. (6 Replies)
Discussion started by: nickychung
6 Replies

7. Solaris

SVM - metastat - Last Erred

My company is running a solaris 2.7 machine. The machine is getting slow recently. I have no expert in solaris. Please help. I checked the log in /var/adm/message: I also checked with the command iostat -nE. It returns: Metastat returns the followings: What should i do now?... (10 Replies)
Discussion started by: nickychung
10 Replies

8. Solaris

metastat error information send to mail script

Hi frnds, I want excute the command through shell script. command is #metastat once u excute this cmd we will get some information on raid configuration status. Once it is working properly we will get status 'okey' otherwise will get status 'error'. i want to script for once we get... (5 Replies)
Discussion started by: arjunreddy3
5 Replies

9. Solaris

Help on metastat

hi all, can someone pls pass on your suggestion? Firs thing I am testing a script which checks for the pattern 'Needs Maintenance' from metastat output and prints some messages in the screen. So i need to simulate an error in mirrored disk for metastat to give this message 'Needs Maintenance'.... (3 Replies)
Discussion started by: srirammad007
3 Replies

10. Solaris

SVM metastat -- needs maintenance

Running Solaris 9 with SVM. I'm not that familiar with it, but metastat output gives "needs maintenance" message on 2 of the mirrors. There are no errors in /var/adm/messages. What do I need to do to fix this error? Thanks. (14 Replies)
Discussion started by: dangral
14 Replies
Login or Register to Ask a Question