cancel
Showing results for 
Search instead for 
Did you mean: 

Need Script on Cleaning Count Remaining

2013
Level 5

I checked the below  Post but script is not in place.

 

https://www-secure.symantec.com/connect/forums/report-cleaning-tapes

Martin mentioned:

Script it ...

nbemmcmd -listmedia -mediaid shows a field "Cleanings remaining" ....

Loop through each cleaning tape, pull out the single line containing 'Cleaings'.

vmquery I suspect (don't have a system to hand to check) .... has a cleaning remaining field, and has the option to give a single line output for each tape. This is even easier, as yo can id each line that is a ceaning tape by using the density type, and then just print the two fields that refer to the media id and the cleanings remaining

 

Need to know how....can you please give me exact command which will shows Cleaning Count.We have 4 libraries.

 

Looking for help...

1 ACCEPTED SOLUTION

Accepted Solutions

Andy_Welburn
Level 6

Simplest thing to do would probably save something like the following as a script & schedule it via cron:

 

vmquery -b -p 0 | grep CL |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}' > clean.out

mailx -s "Cleaning Tapes - uses left" someonewhocares@company.com < clean.out

 

View solution in original post

22 REPLIES 22

StefanosM
Level 6
Partner    VIP    Accredited Certified

for UNIX:

 vmquery  -b  -p 0 |grep CL |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}'

if you have windows find the grep and awk for windows.

 

Or just run the  "vmquery  -b  -p 0"  command (p 0 is the NONE pool)

2013
Level 5

Thanks StefanosM

Actually i have 3 Tape libraries.TLD0,TLD1,TLD2.

So if i have to ran a script it should be like this:

Reqquest you to please check...In our enviorment Cleaining is set to 40....

#!/bin/ksh

vmquery  -b  -p 0 |grep CL |awk '{print "tape:"$1, "robot:"$0, "cleanings_Remaining:"$8}'

vmquery  -b  -p 0 |grep CL |awk '{print "tape:"$1, "robot:"$1, "cleanings_Remaining:"$8}'

vmquery  -b  -p 0 |grep CL |awk '{print "tape:"$1, "robot:"$2, "cleanings_Remaining:"$8}'

echo "Current TLD0 = $TLD0 Cleaning Tapes, TLD1 = $TLD1 Cleaning Tapes, TLD2 = $TLD2 Cleaning Tapes" | mailx -s "CLEANING TAPES REMAINING IN LIBRARY - TLD0 $cleaning TLD1 $Cleaning1 TLD2 $cleaning2" company@mail.com

 

StefanosM
Level 6
Partner    VIP    Accredited Certified

no.

Just run the command from the command line. It is not a script.

You have to redirect the output to a file and then send it as email.

Configuring the email client is something I can not help you.

Can you send emails from the Linux CLI?
Do  you have any working script that sent email to you?

 

2013
Level 5

I donot have script but i will do it if the command will give me coorect output and it shows me Cleaning remaining.When i ran command it doesnot show me any output...

 

2013
Level 5

I donot have script but i will do it if the command will give me coorect output and it shows me Cleaning remaining.When i ran command it doesnot show me any output...

 

Andy_Welburn
Level 6

Unfortunately I do not have a suitable system to enable me to test any library/tape related scripts, so I will need you to help me so I can try & help you.

 

Initially, can you provide the output from vmquery -b -p 0 per Stefanos' original post?

Marianne
Level 6
Partner    VIP    Accredited Certified

Try this first:

vmquery  -b  -p 0 -rn 0 

Depending on the output, we can 'fine tune' the rest of the command.

2013
Level 5

media   media  robot  robot  robot  side/  optical  # mounts/      last
 ID     type   type     #    slot   face   partner  cleanings    mount time
-------------------------------------------------------------------------------
CLN001  HC2_CL TLD      1      48     -       -           0     00/00/0000 00:00
CLN002  HC2_CL TLD      1      89     -       -          23     00/00/0000 00:00
CLN003  HC2_CL TLD      1     103     -       -          23     00/00/0000 00:00
CLN004  HC2_CL TLD      0     298     -       -          44     00/00/0000 00:00
CLN005  HC2_CL TLD      0     300     -       -          45     00/00/0000 00:00
CLN006  HC2_CL TLD      0     299     -       -          44     00/00/0000 00:00
CLN007  HC2_CL TLD      0     297     -       -          44     00/00/0000 00:00
CLNU08  HC2_CL TLD      2     109     -       -          38     00/00/0000 00:00
CLNU09  HC2_CL TLD      2     110     -       -          39     00/00/0000 00

StefanosM
Level 6
Partner    VIP    Accredited Certified

and a screen shot of GUI from the NONE volume pool (media and device management -> media -> volume pools -> None)

also the output of the command
vmpool -list_all -b

 

Some times the copy paste does not copy the minus symbol (-) correctly. Check the commands before you run them or type them.

2013
Level 5

Marianne: Its is ot showing anything when i ran vmquery  -b  -p 0 -rn 0 

Output of vmpool -list_all -b

pool           max partially full   description
--------------------------------------------------------------------------------
None               0                the None pool
NetBackup          0                the NetBackup pool
DataStore          0                the DataStore pool
CatalogBackup      0                NetBackup Catalog Backup poo
NoBarcode          0                Media without Barcodes
UNKNOWN            0                New Media Inventoried
Scratch            0                Scratch Pool
Exchange           0                Exchange Volume Pool
FileSystem         0                File system volume pool
Exchange-LegalHold     0 Exchange-LegalHold volume po
NDMP               0                NDMP volume pool
VMWare             0                VMWare Backup Policy Type
Exchange_Imports    50                       ------
ENCR_Netbackup     0                Encryption Pool
Exchange_Import2    50                       ------
Exchange_Import3    50                       ------
Import             0                Restore Process

 

 

StefanosM
Level 6
Partner    VIP    Accredited Certified

Good.

Is the output of vmquery  -b  -p 0  ok for you?

 

Marianne
Level 6
Partner    VIP    Accredited Certified

This should work:

vmquery  -b  -p 0  |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}' 

(You will just need to clean up header output.)

Andy_Welburn
Level 6

So immediate output (again per Stefanos' original post):

vmquery -b -p 0 | grep CL |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}'

gives the following output:

tape:CLN001 robot:1 cleanings_Remaining:0
tape:CLN002 robot:1 cleanings_Remaining:23
tape:CLN003 robot:1 cleanings_Remaining:23
tape:CLN004 robot:0 cleanings_Remaining:44
tape:CLN005 robot:0 cleanings_Remaining:45
tape:CLN006 robot:0 cleanings_Remaining:44
tape:CLN007 robot:0 cleanings_Remaining:44
tape:CLNU08 robot:2 cleanings_Remaining:38
tape:CLNU09 robot:2 cleanings_Remaining:39

2013
Level 5

yes it would be fine....

 

2013
Level 5

Andy and Marine,the command which you gave working good.Can you please tell me how can i put the same in script.

Marianne
Level 6
Partner    VIP    Accredited Certified

Similar to your other script:

#!/usr/bin/ksh
/usr/openv/volmgr/bin/vvmquery -b -rn 0 |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}' >/tmp/cleanings.txt

cat /tmp/cleanings.txt | mailx -s "CLEANING TAPE COUNT " company.com

Andy_Welburn
Level 6

Simplest thing to do would probably save something like the following as a script & schedule it via cron:

 

vmquery -b -p 0 | grep CL |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}' > clean.out

mailx -s "Cleaning Tapes - uses left" someonewhocares@company.com < clean.out

 

2013
Level 5

i am trying to put it in script but no luck:

see below:

#!/bin/ksh
Cleaning=`/usr/openv/volmgr/bin/vmquery -b -p 0 | grep CL |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}' > clean.out
echo | mailx -s "Cleaning Tapes - uses left" somewhere@company.com < clean.out

**********************************************************************************************************

Its giving me syntax error at line2..can you please help me Andy

2013
Level 5

Hi Marianne/Andy/Experts,

I tried the script which you gave me..it worked but its showing all Cleaning Media + All Media which needs Cleaning...I only want output of the command which You and Andy gave me 

vmquery -b -p 0 | grep CL |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}'

I want to put it in a script but its not working when i ran in script.

********************************************************************************

#!/bin/ksh

/usr/openv/volmgr/bin/vvmquery -b -rn 0 |awk '{print "tape:"$1, "robot:"$4, "cleanings_Remaining:"$8}'

mailx -s "Cleaning Tapes - uses left" somewhere@.com

********************************************************************************

Please help me...