Stefan,
I don't have what you need, I do have something very specific
and fairly ugly.
We have a large ZFS pool, we have unique mount points for each
user directory and for samba shares. Maintaining a disklist for
this system would be administratively difficult.
We elected at one point to user globs, includes, for the user
home directories... ok, I decided by fiat, the idea what I'd
eventually have to read an amanda report that was 1000 lines
long just didn't seem realistic.
That left the Samba directories, I wanted to pull them out of
the zfs mount tables and add them to a base disklist file.
Eventually the zfs manager decided the zfs pool was too small and
created a second pool and started to migrate one zfs file system
to the other, so I ammended the script to pull from the second pool
as well as the first.
The output of the script is just the samba mounts from both pools,
formatted in disklist format.
I have some code on the amanda server that removes the DLEs from
that client, but only if samba related and appends the new daily
list.
the code I'm including here contains some dead wood as I realized
later on (when adding the second samba pool) there there was a
cleaner way to do some of what I was doing.
Good luck...
This file exists on the amanda client, amanda login directory.
[finsen]: /export/home/amanda > cat zfs-list
echo "Generating new disklist file"
# get rid of old working files.
rm tmp/*
#
# get the zfs list, remove snapshot entries.
/usr/sbin/zfs list | grep -v '@' > tmp/list.1
# get just the mount point names.
cat tmp/list.1 | awk '{print($5)}' > tmp/list.2
# the mount points include the pool name, eliminate that part and
# re-write the list.
#cat tmp/list.2 | awk -F'/' '{print("/" $2 "/" $3"/" $4)}' > tmp/list.3
#cat tmp/list.2 | awk -F'/' '{print($6)}' > tmp/list.3
cp tmp/list.2 tmp/list.3
# we want only samba entries
grep samba tmp/list.3 > tmp/list.3a
# remove the lines that are now meaningless, now showing as "///"
cat tmp/list.3a | grep -v "///" > tmp/list.4
# This will much more effectively remove trailing slashes.
cat tmp/list.4 | sed 's.\/*$..g' > tmp/list.5
# sort the list for sanity sake
# zfs seems to present it in alphabetical order already, but
# this is inexpensive and will help to preserve sanity later on.
sort tmp/list.5 > tmp/list.5a
# re-write in proper format for amanda disklist entries
cat tmp/list.5a | awk '{print("finsen\t" $1 "\tzfs-snapshot2" )}' > tmp/list.6
# remove doubled tabs
cat tmp/list.6 | sed 's.\I\I.\I.g' > tmp/finsen.disklist
# Get the current disklist file from Curie.
# grep -v "finsen.*zfs-snapshot" curie.disklist > curie.disklist-base
scp curie:/usr/local/etc/amanda/curie/disklist tmp/curie.disklist
# remove the "finsen" entries that are also "zfs-snapshot"
# providing us a clean basis-list that contains everything
# except the finsen entries we are in the process of generating
# with this script.
# * entries must also be "samba"
grep -v "finsen.*samba.*zfs-snapshot" tmp/curie.disklist >
tmp/curie.disklist-base
# append the disklist-base with the newly generated finsen zfs listing.
cat tmp/curie.disklist-base tmp/finsen.disklist > tmp/curie.disklist-test
# diff the combined list with the original list we fetched from curie.
diff tmp/curie.disklist-test tmp/curie.disklist > tmp/disklist.changes
cat zfs-list-warning tmp/disklist.changes > tmp/zfs-list-email
# display to stdout
cat tmp/disklist.changes
# mail the diff of the two lists to the amanda-adm list so that the
# amanda managers can reconcile and differences between the two files.
#mailx -s "Curie (Finsen) disklist diff" [email protected] <
tmp/zfs-list-email
#mailx -s "Curie (Finsen) disklist diff" [email protected] <
tmp/zfs-list-email
#
This crontab file is amanda's on the client system.
> crontab -l
1 12 * * 1-5 zfs-list | mailx -s "Curie/Finsen disklist diff"
[email protected]
These next two scripts live in the amanda directory on the
amanda server.
> cat get-finsen-updates
ssh finsen zfs-list
amanda_dir=/usr/local/etc/amanda/curie
scp finsen:tmp/curie.disklist-test $amanda_dir/disklist.new
diff $amanda_dir/disklist.new $amanda_dir/disklist
date=`date +%Y%m%d`
echo $date
> cat accept-finsen-updates
amanda_dir=/usr/local/etc/amanda/curie
date=`date +%Y%m%d`
echo $date
echo "copying disklist to disklist.$date"
cp $amanda_dir/disklist $amanda_dir/disklist.$date
cp $amanda_dir/disklist.new $amanda_dir/disklist
echo "finsen generated updates applied to disklist file"
Last file, this exists in the amanda client amanda login directory.
> more zfs-list-warning
The email you are now reading contains the entries in the
Curie disklist file (curie:/usr/local/etc/amanda/curie/disklist)
that this program thinks have changed.
We have removed the /export/home/<user> directories from consideration.
They are no long separate DLEs but globbed together in DLEs by first
letter of the username.
The /export/samba/<sharename> DLE entries will continue to change
from time to time and this program should detect any differences
between the current disklist and the disklist "as it should be".
"How it should be" requires human oversite.
To generate this information manually
# su - amanda on Curie and then invoke
# ~/get-finsen-updates.
If they make sense to you invoke # ~/accept-finsen-updates
Remember, it never hurts to run # amcheck curie after you finish
editing the disklist file.
This email is generated by cron for amanda on Finsen daily or
manually by running the script named above.
Suggested changes to the disklist file will follow the separator line.
-----------------------------------------------------------------
Needless to say the daily mail generated with changes to the
disklist is ignored by everyone but myself and I have to run
the get and accept scripts myself.
I should automate it but someone here is more paranoid than myself...
---
Brian R Cuttler [email protected]
Computer Systems Support (v) 518 486-1697
Wadsworth Center (f) 518 473-6384
NYS Department of Health Help Desk 518 473-0773
IMPORTANT NOTICE: This e-mail and any attachments may contain
confidential or sensitive information which is, or may be, legally
privileged or otherwise protected by law from further disclosure. It
is intended only for the addressee. If you received this in error or
from someone who was not authorized to send it to you, please do not
distribute, copy or use it or any attachments. Please notify the
sender immediately by reply e-mail and delete this from your
system. Thank you for your cooperation.