This post is more than 5 years old
9 Posts
0
999
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
StuartWhitby
45 Posts
0
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
ble1
2 Intern
2 Intern
•
14.3K Posts
0
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:
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):
KRUEGU
9 Posts
0
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