Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

999

March 31st, 2016 05:00

Remind me when low on free tapes

Hi folks,

I am looking for a way to get reminded when there are less

than 5 appendable tapes in my library.

Does anyone know how this can be set up?

Many thanks in advance!

Best Regards,

Ulf Krueger

45 Posts

March 31st, 2016 07:00

I'd do a script along the lines of the following (ksh)

volumes=$( nsradmin -s gblonnws01 -i - << EOF | sed -e "s/\"\"//g" -e "s/-//g" -e "s/;//" -e "s/,//g" -e "s/Current query set//" -e "s/volumes: //"

. type: nsr jukebox; name: whatever

show volumes

print

EOF

)

appends=0

for i in $volumes

do

     appends=$((appends+$(mminfo -s gblonnws01 -q !full -r volume 2>/dev/null | grep $i | wc -l)))

done

if [[ $appends -le 5 ]]

then

     echo "Less than 5 appendable tapes in the library" | mailx -s "!!!NetWorker Available Media Warning!!!" me@mydomain.com

fi

2 Intern

 • 

14.3K Posts

March 31st, 2016 06:00

I believe NW checks this based on native usage. Not sure which value they use to trigger alert - some stats you get with nsrjb -v at the bottom, for example:

Capture4.JPG.jpg

If you wish to have alert for what you asked, you must create script.  I use script to get basic overview (summary and verbose) and here is the summary one (it is function in script and I didn't check if I used any function call defined outside this function; there is couple of other things which I skipped - it won't necessary work for you, but it should get you going - use approach to determine appendable tapes and if number of those is less than 5 have email sent to you):

report_summary()

{

for LOCATION in `$MMINFO -avot -q near -r location | $SORT -u`; do

        TOTVOLREC=0

        TOTVOLEMP=0

        TOTVOLAPP=0

        echo "*****************   Tape library: $LOCATION  ******************"

        for POOL in `$MMINFO -avot -q location=$LOCATION -r pool | $SORT -u`; do

                REC_COUNT=`$MMINFO -a -r 'volume' -q "location=$LOCATION,pool=$POOL,volrecycle" 2>&1 | $GREP -v "no matches" | wc -l | tr -s " " | cut -d" " -f2`

                let TOTVOLREC=$TOTVOLREC+$REC_COUNT

                EMP_COUNT=`$MMINFO -a -r 'volume,%used' -q "location=$LOCATION,pool=$POOL,%used=0" 2>&1 | $GREP "0%" | $GREP -v "no matches" | wc -l | tr -s " " | cut -d" " -f2`

                let TOTVOLEMP=$TOTVOLEMP+$EMP_COUNT

                APP_COUNT=`$MMINFO -a -r 'volume' -q "location=$LOCATION,pool=$POOL,!full" 2>&1 | $GREP -v "no matches" | wc -l | tr -s " " | cut -d" " -f2`

                let TOTVOLAPP=$TOTVOLAPP+$APP_COUNT

                echo ""

                echo "Recyclable tapes in pool $POOL: [ $REC_COUNT ]"

                echo "================================================================="

                echo ""

                echo ""

                echo "Empty tapes in pool $POOL: [ $EMP_COUNT ]"

                echo "================================================================="

                echo ""

                echo ""

                echo "Appendable tapes in pool $POOL: [ $APP_COUNT ]"

                echo "================================================================="

                echo ""

        done

        echo "================================================================="

        echo "Total number of recyclable tapes in jukebox: [ $TOTVOLREC ]"

        echo "================================================================="

        echo "Total number of empty tapes in jukebox: [ $TOTVOLEMP ]"

        echo "================================================================="

        echo "Total number of appendable tapes in jukebox: [ $TOTVOLAPP ]"

        echo "================================================================="

        if [ `amm_loc` = "No" ]; then

                echo "Auto Media Management for $LOCATION is disabled (recommended)"

        else

                echo "Auto Media Management for $LOCATION is enabled (not recommended)"

        fi

        echo " "

        VALUE1=`$NSRJB -j $LOCATION | $GREP "\-\*" | wc -l 2>&1`

        echo "Number of unlabeled tapes in jukebox $LOCATION: [ `echo $VALUE1` ]"

        echo " "

done

9 Posts

April 4th, 2016 03:00

Thank You very much! This is exactly what I was looking for!

Now I have this script called from my crontab of my newest nsr server to check all my nsr servers:

#/usr/bin/ksh

# ----------------------------

# Usage:

#   $1 = nsr host name

#   $2 = library name

#   $3 = min. remaininig appendable media

volumes=$( nsradmin -s $1 -i - << EOF | sed -e "s/\"\"//g" -e "s/-//g" -e "s/;//" -e "s/,//g" -e "s/Current query set//" -e "s/volumes: //"

. type: nsr jukebox; name: $2

show volumes

print

EOF

)

#echo $volumes   /* for debugging

cleaning=0

cleaning=$((cleaning+$( echo $volumes | grep "(0 uses left" | wc -l )))

cleaning=$((cleaning+$( echo $volumes | grep "(1 uses left" | wc -l )))

cleaning=$((cleaning+$( echo $volumes | grep "(2 uses left" | wc -l )))

cleaning=$((cleaning+$( echo $volumes | grep "(3 uses left" | wc -l )))

#echo $cleaning   /* for debugging

if [[ $cleaning -eq 1 ]]

then

  echo "$1: Warning: Cleaning media low on remaining uses!" | mailx -s "$1: Warning: Cleaning media low on remaining uses!" -rNetworker@$1.

fi

appends=0

for i in $volumes

do

  appends=$((appends+$(mminfo -s $1 -q !full -r volume 2>/dev/null | grep $i | wc -l)))

#  echo $i   /* for debugging

done

#echo $appends   /* for debugging

if [[ $appends -le $3 ]]

then

  echo "$1: Warning: Less than $3 appendable tapes in the library!" | mailx -s "$1: Warning: Less than $3 appendable tapes in the library!" -rNetworker@$1.

fi

No Events found!

Top