Negate alerting for particular metadevice.

Hi All...
I have a script that checks for any problems(particularly looks for 'Needs Maintenance') with metadevices and alerts accordingly. This was not configured to alert for a particular metadevice. Now i want to negate alerting for a particular metadevice(say d40). Is this possible? I am currently going with an alternative - trying to remove all the lines between two strings which contains info about d40 from the metastat output using sed. It works fine. But is there any way to negate the output of metastat command for a particular metadevice? Please suggest me an alternative if any????

My Script:

  1. Get the metastat output and redirect it to a temp file
  2. Grep for string 'Needs Maintenance' in the temp file and alert.
    So that we can check that there is some problem underlying beneath some metadevice.

Now i have included a code to remove all lines for d41 and d42 so that script skips these lines.

metastat -s $DSN|sed '/dsn\/d41: Mirror/,/dsn\/d43: Submirror of dsn\/d41/d' >$TMPFILE

DSN is diskset name. d41 is mirror. d42 and d43 are sub-mirrors in which d42 has gone bad.
Then applying step 2.

It would be clear if you see the metastat output in your Solaris box. Hope you know the difficulty in explaining things in the post!!!!

I guess I'm not clear on exactly what you're looking to do. In light of me not knowing, here are a couple of thoughts. You can use metastat with just the specific device you're wanting, such as:

metastat d41

This will display only the device/subdevices of d41.

The way I'd probably approach this problem would be to just do something like this:

metastat | grep c.t.d.s. | grep -v Okay

Then anything that is a problem will be found and notification can be sent appropriately. I probably wouldn't care at that point what device it is, just which machine it is and that there is a problem with a disk. I could find out the details after that.

Hello peterro...
Thank you so much for your reply.
If i am correct!!! I wonder if the above command works on DISKSETS? I hope that works only on NONDISKSETS.
If i use

metastat -s DISKSETNAME |......

the o/p format may not conatin c#t#d#.

I am very sorry about my poor explanation

If you're still looking for help, can you show what the output of a simple 'metastat' would be and then highlight (possibly in a different color) what you really want?

If you look into the attachement, i dont want the o/p of metadevice d10(with in first =====). As my script looks for word 'Needs Maintenance' i have taken out those lines using sed. I've specified the starting string and ending string in the attachement itself. I wonder if this is possible with grep?
Grep a pattern, remove the next line of the pattern.
I knew that grep with -C option displays both the lines above and below once it matches pattern. But not sure how to achieve.
I have attached other file which has my expected o/p.

But i would be happy if there is some way to negate the entire o/p for d10.

The -C option is only in the GNU version of grep. If you could install that, you could also use the -B or -A options (before and after) which might get what you're looking for.

Hello Peterro... Thank you very much for the solution.
But there is no option for me to install GNU version of grep on the box.
Looking for some more solutions/alternatives:(