Re: amadmin extension
>... Would this be a handy feature to have in "amadmin" maybe >something like: "amadmin CONFIG chgtapes" or "amadmin CONFIG changer tapes", >to allow for other changer commands from amadmin ? ... Someone beat you to it :-). As of 2.4.5 you can add "--days NNN" after "tape" to get multiple days of data. Note that the output format is somewhat different: $ amadmin RCAC0 tape The next Amanda run should go onto tape P02003/RCAC0 or a new tape. tape P02004/RCAC0 or a new tape. $ amadmin RCAC0 tape --days 3 The next Amanda run should go onto tape P02003/RCAC0 or a new tape. tape P02004/RCAC0 or a new tape. The next Amanda run should go onto tape P02005/RCAC0 or a new tape. tape P02006/RCAC0 or a new tape. The next Amanda run should go onto tape P02007/RCAC0 or a new tape. tape P02008/RCAC0 or a new tape. >Scott... John R. Jackson, Senior Systems Analyst, Engineering Solutions, Inc
RE: amadmin extension
Interesting. I had not used that feature of amadmin before (ie. marking tapes to not be re-used). I guess it would also have to exclude those. I suppose if this was in amadmin then setting up a script to email the output would be easy enough. Scott.. Scott R. Burns NETCON Technologies Incorporated Suite 135 - 4474 Blakie Road London, Ontario, Canada N6L 1G7 Voice: +1.519.652.0401 Fax: +1.519.652.9275 Web: www.netcontech.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jamie Wilkinson Sent: Monday, September 26, 2005 11:00 PM To: Scott R. Burns Cc: amanda-users@amanda.org Subject: Re: amadmin extension On Mon, 2005-09-26 at 22:04 -0400, Scott R. Burns wrote: > Using amadmin I can easily find out which tapes are required for tonights > backup. I have runtapes set to 2, so the next two oldest tapes are listed. > This works fine if I check things each day and load up the changer (HP > DAT24x6) with the 2 tapes required. I have the changer setup with slots 0-4 > available for backup tapes (5 tapes) and slot 5 holds the cleaning tape. > > Since our backup uses at most 2 tapes, and usually only 1, I can "tail -5 > tapelist" to find out the labels of the 5 oldest tapes, and load up the > changer fully. Would this be a handy feature to have in "amadmin" maybe > something like: "amadmin CONFIG chgtapes" or "amadmin CONFIG changer tapes", > to allow for other changer commands from amadmin ? This would easily let my > backup admin find out what tapes she can load up the changer with, and then > not have to worry about it for a day or two. > > For now I have a "tail -5" script for her but I thought for those with > changers it would be a nice extension to amadmin. This works unless you have some tapes set to no-reuse, in which case you want to grep them out first. You've reminded me of something we have, a little more complex than that: attached is the python script I wrote for our backup server that mails us (via the amanda user, so set up an alias) if we need to change tapes from the changer, offering potential tape labels and suggesting which slots they should be loaded into. (Note that this script also doesn't cater to no-reuse tapes :) Tested on Red Hat, running on an EL4 server, but should be compatible with python 1.5.2. -- Jamie Wilkinson Senior Systems Administrator Anchor Systems Hosting, Colocation, and Managed Servers
Re: amadmin extension
On Mon, 2005-09-26 at 22:04 -0400, Scott R. Burns wrote: > Using amadmin I can easily find out which tapes are required for tonights > backup. I have runtapes set to 2, so the next two oldest tapes are listed. > This works fine if I check things each day and load up the changer (HP > DAT24x6) with the 2 tapes required. I have the changer setup with slots 0-4 > available for backup tapes (5 tapes) and slot 5 holds the cleaning tape. > > Since our backup uses at most 2 tapes, and usually only 1, I can "tail -5 > tapelist" to find out the labels of the 5 oldest tapes, and load up the > changer fully. Would this be a handy feature to have in "amadmin" maybe > something like: "amadmin CONFIG chgtapes" or "amadmin CONFIG changer tapes", > to allow for other changer commands from amadmin ? This would easily let my > backup admin find out what tapes she can load up the changer with, and then > not have to worry about it for a day or two. > > For now I have a "tail -5" script for her but I thought for those with > changers it would be a nice extension to amadmin. This works unless you have some tapes set to no-reuse, in which case you want to grep them out first. You've reminded me of something we have, a little more complex than that: attached is the python script I wrote for our backup server that mails us (via the amanda user, so set up an alias) if we need to change tapes from the changer, offering potential tape labels and suggesting which slots they should be loaded into. (Note that this script also doesn't cater to no-reuse tapes :) Tested on Red Hat, running on an EL4 server, but should be compatible with python 1.5.2. -- Jamie Wilkinson Senior Systems Administrator Anchor Systems Hosting, Colocation, and Managed Servers #!/usr/bin/python """looks at the amanda database, and the currently loaded set of tapes, and decides which tape slots need to come out and what to replace them with. """ import sys, os, re, string from email.MIMEText import MIMEText debug = 0 def usage(): print "usage: %s config" % sys.argv[0] def dprint(s): if debug: print s # get the config from the commmand line try: config = sys.argv[1] except IndexError: usage() print "please specify the config to print next tapes for" sys.exit(1) # the list of tapes in the loader, from amtape $config show current_tapes = [None] * 10 # retardo magic number current_re = re.compile('^slot (\d+): date (\d+) label (.*)$') for line in os.popen4("/usr/sbin/amtape %s show" % config)[1].readlines(): stuff = current_re.match(line) if stuff: tape = stuff.group(3) slot = int(stuff.group(1)) dprint("tape %s in slot %s" % (tape, slot)) current_tapes[slot] = tape dprint("current tapes: %s" % current_tapes) # the latest tapes, required to do a complete restore of every DLE latest_tapes = [] stats_re = re.compile('^stats:') for line in os.popen4("/usr/sbin/amadmin %s export" % config)[1].readlines(): if stats_re.match(line): tape = line.split(' ')[7][:-1] #print tape if tape not in latest_tapes: latest_tapes.append(tape) dprint("latest tapes: %s" % latest_tapes) # the available tapes, which amanda expects tobe able to write to in the next # $runtapes days available_tapes = [] for line in open("/var/lib/amanda/%s/tapelist" % config, 'r').readlines(): tape = line.split(' ')[1] available_tapes.append(tape) # this file is in reverse order, i.e. the LRU tape is at the bottom available_tapes.reverse() dprint("available_tapes = %s" % available_tapes) # the next tapes, that amanda expects to use next_tapes = [] next_re = re.compile("^The next Amanda run should go onto tape ([^ ]+) or a new tape.$") for line in os.popen4("/usr/sbin/amadmin %s tape" % config)[1].readlines(): tape = next_re.match(line) next_tapes.append(tape.group(1)) dprint("next tapes: %s" % next_tapes) # work out which tapes need to come out remove_tapes = [] for tape in current_tapes: if tape in latest_tapes and tape not in next_tapes: remove_tapes.append(tape) if len(remove_tapes) > 0: dprint("these tapes need to come out: %s" % remove_tapes) slots = [str(current_tapes.index(tape)) for tape in remove_tapes] dprint("slots: %s" % slots) # work out which tapes to replace them with replace_tapes = [] for tape in available_tapes: if tape not in current_tapes: replace_tapes.append(tape) if len(replace_tapes) == len(remove_tapes): break dprint("these tapes need to go in: %s" % replace_tapes) msg = """Hello! Tape time! Please remove the tapes in the following slots: %(slots)s and replace them with the following tapes: %(tapes)s Thanks! """ filler = {'tapes': string.join(replace_tapes, ', '), 'slots': string.join(slots, ', '), } mail = MIMEText(msg % filler) mail['Subject'] = "amanda tape helper for %s" % config mail['To'] = "root" mail['From'] = "amanda" dprint(mail.as_string()) s = os.popen("/usr/sbin/sendmail -t", 'w') s.write(mail.as_string()) s.close()
Re: amadmin extension
On Monday 26 September 2005 22:04, Scott R. Burns wrote: >Using amadmin I can easily find out which tapes are required for > tonights backup. I have runtapes set to 2, so the next two oldest tapes > are listed. This works fine if I check things each day and load up the > changer (HP DAT24x6) with the 2 tapes required. I have the changer > setup with slots 0-4 available for backup tapes (5 tapes) and slot 5 > holds the cleaning tape. > >Since our backup uses at most 2 tapes, and usually only 1, I can "tail > -5 tapelist" to find out the labels of the 5 oldest tapes, and load up > the changer fully. Would this be a handy feature to have in "amadmin" > maybe something like: "amadmin CONFIG chgtapes" or "amadmin CONFIG > changer tapes", to allow for other changer commands from amadmin ? This > would easily let my backup admin find out what tapes she can load up > the changer with, and then not have to worry about it for a day or two. > >For now I have a "tail -5" script for her but I thought for those with >changers it would be a nice extension to amadmin. > >Any thoughts ? > >Scott... Even though I'm now using vtapes so its moot, I'd vote yes on this one. Good idea Scott. >Scott R. Burns >NETCON Technologies Incorporated >Suite 135 - 4474 Blakie Road >London, Ontario, Canada >N6L 1G7 >Voice: +1.519.652.0401 >Fax: +1.519.652.9275 >Web: www.netcontech.com -- Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) 99.35% setiathome rank, not too shabby for a WV hillbilly Yahoo.com and AOL/TW attorneys please note, additions to the above message by Gene Heskett are: Copyright 2005 by Maurice Eugene Heskett, all rights reserved.