Thanks Bill. I'll give that a go. Bash will be fine for what I need to do. I'd have preferred to get the volume bytes directly from the storage rather than one step removed but this should do the trick.
-Chris- On Wed, 10 Jan 2024, 16:41 Bill Arlofski via Bacula-users, < bacula-users@lists.sourceforge.net> wrote: > Hello Chris, > > I am replying back to the list to keep thread continuity. :) > > > > On 1/10/24 08:31, Chris Wilkinson wrote: > > Thanks Bill > > > > What i was trying to do was write a script to determine the disk space > used by each pool = sum of all volumes. Looks like i > > would have to trace out the path from pool->storage->device from the > conf files. More complicated than i imagined. > > > > Perhaps a better option would be to use bconsole 'query 11' to get the > volume sizes. > > > The easiest way to do this is to echo commands to bconsole and > grep/sed/awk what you need: > > It's not pretty, and you could do so much more (and easier) with Python, > but: > ----8<---- > #!/bin/bash > > # Get the pools to iterate through > pools=$(echo -e "list pools\nquit\n" | bconsole | grep "^| \+[0-9]" | awk > '{print $4}') > > # For each pool, we can just add the bytes. > for pool in ${pools}; do > echo -n "Pool: ${pool} - Bytes: " > echo -e "gui on\nlist media pool=${pool}\nquit\n" | bconsole | grep "^| > \+[0-9]" | awk '{sum+=$10} END {print sum}' > done > ----8<---- > > If you have more specific needs, or would like to see more info, formatted > better, let me know, and maybe I can do something > better in Python. :) > > > Best regards, > Bill > > > -- > Bill Arlofski > w...@protonmail.com > > _______________________________________________ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users >
_______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users