Re: [BackupPC-users] General questions about the background queue and link commands.

2011-02-03 Thread Jeffrey J. Kosowsky
Robin Lee Powell wrote at about 09:30:17 -0800 on Thursday, February 3, 2011:
 > On Thu, Feb 03, 2011 at 09:22:00AM -0800, Robin Lee Powell wrote:
 > > OK, so the question becomes, how do I monitor for general backup
 > > queue problems?  I've had situations where something gets stuck,
 > > like a nightly job, and the queue gets backed up, and I want to
 > > detect that.
 > > 
 > > I guess if I could get access to the backup age that's on the host
 > > summary, from a script, that would do.
 > 
 > Got it; short version below, remind me to post after the real script
 > is done:
 > 
 > for num in $(sudo -u backuppc BackupPC_serverMesg status hosts | sed 
 > 's/},[{"]/\n/g' | grep lastGoodBackupTime | sed 's/.*"lastGoodBackupTime" => 
 > "//' | sed 's/".*//' )
 > do
 >   if [ $[$(date +%s) - $num] -gt 77760 ]
 >   then
 > echo "needs backup"
 >   fi
 > done

OK I couldn't resist...
I tried your script and unfortunately it doesn't say *which* host
needs backup. Also, it uses 3 seds and a grep... there has to be a
better way...

So here is my "1-liner"
(set -- $(sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status 
hosts | sed -ne 's/.*("\([^"]*\)" => {[^}]*"lastGoodBackupTime" => 
"\([0-9]*\)".*/\1 \2/pg'); while [ "$1" ]; do if [ $[$(date +%s) - $2] -gt 
77760 ]; then echo "$1 needs backup"; fi; shift; shift; done)


Seems to work on my setup but I haven't tested it too much...

It will break if there are white spaces in the host name though I'm
not sure that actually happens in real life -- if it does you can
always use IFS tricks like:

(IFS=$'\n'; set -- $(sudo -u backuppc 
/usr/share/BackupPC/bin/BackupPC_serverMesgstatus hosts | sed -ne 
's/.*("\([^"]*\)" => {[^}]*"lastGoodBackupTime" => "\([0-9]*\)".*/\1\n\2/pg'); 
while [ "$1" ]; do if [ $[$(date +%s) - $2] -gt 77760 ]; then echo "$1 needs 
backup"; fi; shift; shift; done)

This will only fail if there is a newline in the hostname which I
imagine should never happen.

Hope that helps

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/


Re: [BackupPC-users] General questions about the background queue and link commands.

2011-02-03 Thread Robin Lee Powell
On Thu, Feb 03, 2011 at 09:22:00AM -0800, Robin Lee Powell wrote:
> OK, so the question becomes, how do I monitor for general backup
> queue problems?  I've had situations where something gets stuck,
> like a nightly job, and the queue gets backed up, and I want to
> detect that.
> 
> I guess if I could get access to the backup age that's on the host
> summary, from a script, that would do.

Got it; short version below, remind me to post after the real script
is done:

for num in $(sudo -u backuppc BackupPC_serverMesg status hosts | sed 
's/},[{"]/\n/g' | grep lastGoodBackupTime | sed 's/.*"lastGoodBackupTime" => 
"//' | sed 's/".*//' )
do
  if [ $[$(date +%s) - $num] -gt 77760 ]
  then
echo "needs backup"
  fi
done

-Robin

-- 
http://singinst.org/ :  Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei".   My personal page: http://www.digitalkingdom.org/rlp/

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/


Re: [BackupPC-users] General questions about the background queue and link commands.

2011-02-03 Thread Robin Lee Powell
On Thu, Feb 03, 2011 at 05:25:48PM +0100, Holger Parplies wrote:
> Hi,
> 
> Robin Lee Powell wrote on 2011-02-02 08:12:47 -0800
> [[BackupPC-users] General questions about the background queue and
> link commands.]:
> > Let me ask some more general questions:  What does the
> > background queue actually *mean*?
> 
> from the source (3.2.0beta0, but probably unchanged):
> 
> #- @BgQueue is a queue of automatically scheduled backup
> requests.
> 
> If my memory serves me correctly, BackupPC queues each host it
> knows about at each wakeup (presumably unless it's already on a
> queue ... see %BgQueueOn, %CmdQueueOn, %UserQueueOn). It then
> proceeds to process these "backup requests" in the order they're
> in the queue. Most of the time, that will simply mean deciding
> that it's not yet time for the next backup of this host. Now, if
> ...
> 
> > All but one host (!), 226 out of 227, is in the background
> > queue, which seems rather excessive since about half my hosts
> > have recent backups.
> 
> ... I would guess that the first host is currently doing its
> backup, you've got $Conf{MaxBackups} = 1, 

8 actually.

This isn't happening on most of my hosts; only 2 out of 6.

> and most of the queue will simply "disappear" once the running
> backup is finished, because BackupPC will decide for each host in
> turn whether its backup is recent enough.
> 
> Of course, if your situation is that one backup is always running
> (i.e. your BackupPC server is constantly backing up something),
> you'll see this situation most of the time - all of the time if
> backups take more time than the interval between wakeups.

Since it's every 15 minutes, yeah.  :)

> Well, you obviously won't really have that situation - the example
> is just for illustration. But you'll see this (for a possibly
> short period of time) whenever a backup takes longer than the
> wakeup interval, and whenever the first host to be scheduled is
> actually backed up (for the duration of that backup). That is not
> a problem. It is not an indication of "high load".
> 
> To sum it up, that a host is on @BgQueue does *not* necessarily
> mean that a backup will be done for this host, just that a check
> will be done whether a backup is needed. If so, the backup will
> also be done, else it's just the check.
> 
> Note that this also means that backups may start at any time, not
> just at the times listed in the WakeupSchedule (but you've
> probably already noticed that).

Got it.

OK, so the question becomes, how do I monitor for general backup
queue problems?  I've had situations where something gets stuck,
like a nightly job, and the queue gets backed up, and I want to
detect that.

I guess if I could get access to the backup age that's on the host
summary, from a script, that would do.

-Robin

-- 
http://singinst.org/ :  Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei".   My personal page: http://www.digitalkingdom.org/rlp/

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/


Re: [BackupPC-users] General questions about the background queue and link commands.

2011-02-03 Thread Holger Parplies
Hi,

Robin Lee Powell wrote on 2011-02-02 08:12:47 -0800 [[BackupPC-users] General 
questions about the background queue and link commands.]:
> Let me ask some more general questions:  What does the background queue
> actually *mean*?

from the source (3.2.0beta0, but probably unchanged):

#- @BgQueue is a queue of automatically scheduled backup requests.

If my memory serves me correctly, BackupPC queues each host it knows about at
each wakeup (presumably unless it's already on a queue ... see %BgQueueOn,
%CmdQueueOn, %UserQueueOn). It then proceeds to process these "backup requests"
in the order they're in the queue. Most of the time, that will simply mean
deciding that it's not yet time for the next backup of this host. Now, if ...

> All but one host (!), 226 out of 227, is in the background queue,
> which seems rather excessive since about half my hosts have recent
> backups.

... I would guess that the first host is currently doing its backup, you've
got $Conf{MaxBackups} = 1, and most of the queue will simply "disappear"
once the running backup is finished, because BackupPC will decide for each
host in turn whether its backup is recent enough.

Of course, if your situation is that one backup is always running (i.e. your
BackupPC server is constantly backing up something), you'll see this situation
most of the time - all of the time if backups take more time than the interval
between wakeups. Well, you obviously won't really have that situation - the
example is just for illustration. But you'll see this (for a possibly short
period of time) whenever a backup takes longer than the wakeup interval, and
whenever the first host to be scheduled is actually backed up (for the
duration of that backup). That is not a problem. It is not an indication of
"high load".

To sum it up, that a host is on @BgQueue does *not* necessarily mean that a
backup will be done for this host, just that a check will be done whether a
backup is needed. If so, the backup will also be done, else it's just the
check.

Note that this also means that backups may start at any time, not just at the
times listed in the WakeupSchedule (but you've probably already noticed that).

Regards,
Holger

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/