Visit Our UNIX and Linux User Community


Negate alerting for particular metadevice.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Negate alerting for particular metadevice.
# 1  
Old 08-10-2009
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.
Code:
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!!!!
# 2  
Old 08-10-2009
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:

Code:
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:

Code:
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.
# 3  
Old 08-10-2009
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
Code:
metastat -s DISKSETNAME |......

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

I am very sorry about my poor explanation
# 4  
Old 08-10-2009
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?
# 5  
Old 08-10-2009
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.
# 6  
Old 08-10-2009
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.
# 7  
Old 08-11-2009
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/alternativesSmilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #898
Difficulty: Medium
The Toybox project was started in 2012 and became a BSD-licensed BusyBox alternative.
True or False?

8 More Discussions You Might Find Interesting

1. AIX

Rlogin alerting

// AIX 6.1 lsuser root returns the attributes. # lsuser root root id=0 pgrp=system groups=system,bin,sys,security,cron,audit,lp,dba,mqm,patrol home=/ shell=/usr/bin/ksh auditclasses=general log in=true su=true rlogin=false daemon=true admin=true sugroups=ALL... (2 Replies)
Discussion started by: Daniel Gate
2 Replies

2. Shell Programming and Scripting

How to get the negate of decimal to binary?

Hi All, New to this forum (and yes , a newbie in programming..:p) I have a decimal to binary converter script done this way : i=$1 bit0=$(( (i & 0x01) > 0 )) bit1=$(( (i & 0x02) > 0 )) bit2=$(( (i & 0x04) > 0 )) bit3=$(( (i & 0x08) > 0 )) bit4=$((... (6 Replies)
Discussion started by: digiteltlc
6 Replies

3. Shell Programming and Scripting

How to negate pattern within sed?

Example: I have data like, H|1|2|#||4|4|5|6 D|f|g|h|j|j|k|k| D|f|g|h|j|j|k|k| D|f|g|h|j|j|k|k| D|f|g|h|j|j|k|k| D|f|g|h|j|j|k|k| T|g|g|G|G|g|g| T|g|g|G|G|g|g| I have to write command, it should delete all the lines except line starting with "D". I have tried sed '/^\(D\)|/!d'... (2 Replies)
Discussion started by: duplicate
2 Replies

4. UNIX for Dummies Questions & Answers

Code for alerting admin regarding process

Hello everyone. I want code for 1.reporting an alert to admin if a particular user tries to initiate more than 5 processes in the interval of 5 mins. 2. Reporting an alert if a user runs one particular process for more than 5 minutes. Both should be reported in a log file with machine... (1 Reply)
Discussion started by: safijunaid
1 Replies

5. Shell Programming and Scripting

Grep Alerting - command or script assistance

Hello! I need some help with grep from various logs we use for monitoring transactions. The logs contain the following information (which is consistent in all of the files): 12:28:33.157 EWY D 1 (tcpip.c:282): tcpip.c: Unable to connect to x.x.x.x on port xxxx. (79) Connection refused ... (1 Reply)
Discussion started by: sbchecko
1 Replies

6. HP-UX

HPUX monitoring and alerting script per CPU

Hi Guys, Hopefully someone would be able to help me out. Basically I have an HPUX 11.11i system which is backed up by Data Protector 4.5. Every so often the vdba process hangs and chews up 100% of one of the systems CPU resources. As our monitoring tool can only monitor on a per system basis... (3 Replies)
Discussion started by: fulhamfcboy
3 Replies

7. Shell Programming and Scripting

negate search help

Hi, I've tried a lot of negate codes in this forum, but they do not perform what I intended. Please help. inputfile: Paragraph1 contents: die1, die2, die3, pr_name1, pr_name2 pr_name3, pr_name4 Paragraph2 more contents: die1, die2, die3, pr_name1, pr_name2 pr_name3, pr_name4 ... (5 Replies)
Discussion started by: shamushamu
5 Replies

8. Shell Programming and Scripting

how do I negate a sed match

I have a text file that has links in it. I can write a match for sed to replace the link with anything. For example: http://www.google.com becomes XxX But what I'm after is not to replace the link with something but to remove everything else and just leave the link. I want a... (5 Replies)
Discussion started by: muxman
5 Replies

Featured Tech Videos