Ghislain,
This looks like a bug. It seems that $Conf{DumpPostUserCmd} is run before
the backups file is re-written with the new backup information. Before that
there is just a placeholder for the new backup.
You could see if you can fix it by moving the $Conf{UserCmdCheckStatus} run
in bin/BackupPC_dump (here
<https://github.com/backuppc/backuppc/blob/master/bin/BackupPC_dump#L1295>)
to after the BackupSave() (here
<https://github.com/backuppc/backuppc/blob/master/bin/BackupPC_dump#L1348>).
You'll also need to repeat that code inside the if statement for the case
the backup fails (here
<https://github.com/backuppc/backuppc/blob/master/bin/BackupPC_dump#L1308>).
Craig
On Fri, Oct 23, 2020 at 1:52 AM Ghislain Adnet <[email protected]> wrote:
> hi,
>
> I hope all the community is well :)
>
> I got a little issue and as the docs and my try do not seems to find
> the solution i am asking here :)
>
> After a backup i use to report on the backup and do a perl script that
> do reporting to my zabbix server, the start is
>
> my($dateactuelle) = int(time);
>
> my @backups = $bpc->BackupInfoRead($host) ;
> # take the last one
> my $lastbackupID = @backups-1;
>
>
>
> # 86400 + delais de backup = 24h + 10h
> if( ( $dateactuelle -
> int($backups[$lastbackupID]{endTime}) ) > 122400 ){
> print STDERR "$host - impossible we just did it
> !\n";
> next;
> }
>
> but it seems that the very same backup that called the script
> $Conf{DumpPostUserCmd} is not recognised by the api as the @backups-1 .
>
> I do not see in the doc when exactly the xxxCmd are called, seems the
> name suggest this is done after the backup but it seems not and be called a
> little before it.
>
>
> With backuppc3 i do it and it seems to work but not anymore in 4+, i
> use the postusercmd to repport things like this:
>
> print ZABBIX "$host filebackup_type
> ".$backups[$lastbackupID]{type}."\n";
> print ZABBIX "$host filebackup_start
> ".$backups[$lastbackupID]{startTime}."\n";
> print ZABBIX "$host filebackup_end
> ".$backups[$lastbackupID]{endTime}."\n";
>
> print ZABBIX "$host filebackup_serveur <%= @fqdn
> %>\n";
>
> print ZABBIX "$host
> filebackup_size_newfichier_".$backups[$lastbackupID]{type}."
> ".$backups[$lastbackupID]{sizeNew}."\n";
> print ZABBIX "$host
> filebackup_size_fichier_".$backups[$lastbackupID]{type}."
> ".$backups[$lastbackupID]{size}."\n";
> print ZABBIX "$host
> filebackup_nb_newfichier_".$backups[$lastbackupID]{type}."
> ".$backups[$lastbackupID]{nFilesNew}."\n";
> print ZABBIX "$host
> filebackup_nb_fichier_".$backups[$lastbackupID]{type}."
> ".$backups[$lastbackupID]{nFiles}."\n";
> print ZABBIX "$host
> filebackup_duree_".$backups[$lastbackupID]{type}."
> ".int($backups[$lastbackupID]{endTime}-$backups[$lastbackupID]{startTime})."\n";
>
> How can i call a script when the backup is completed to send
> information about it to a monitoring system ?
>
> --
> cordialement,
> Ghislain ADNET.
> AQUEOS.
>
>
> _______________________________________________
> BackupPC-users mailing list
> [email protected]
> List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
> Wiki: https://github.com/backuppc/backuppc/wiki
> Project: https://backuppc.github.io/backuppc/
>
_______________________________________________
BackupPC-users mailing list
[email protected]
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: https://github.com/backuppc/backuppc/wiki
Project: https://backuppc.github.io/backuppc/