Registered users
Linkedin Twitter Facebook Google+
  This website uses its own cookies or from third parties Close
33HOPS, IT Consultants
33HOPS ::: Proveedores de Soluciones Informáticas :: Madrid :+34 91 663 6085Avda. Castilla la Mancha, 95 - local posterior - 28700 S.S. de los Reyes - MADRID33HOPS, Sistemas de Informacion y Redes, S.L.Info

<< Return to index

XSIBACKUP-PRO: fire events on backup completion

XSIBACKUP-PRO allows to fire two events upon backup completion:

--on-error:

This argument allows transmitting through the HTTP protocol the XSIBackup PID, the full argument list and the errors as a GET request. Thus you can make XSIBackup interact with an external program. This allows sending an SMS under certain circumstances, offer XSIBackup as SAAS or process the information in any way that you desire. You need to parse the full URL starting by http:// and the expected return value, both separated by a pipeline character. It also allows to fire a new backup job.

--on-success:

Same as --on-error, in this case the error list is not sent, but you can still access the variables asociated with the job: hostname, pid (acts as a backup UID), backed VMs, etc...

All data is sent as a base64 encoded key/value query string where the key/value separator is the pipeline "|" instead of the regular separator ampersand "&". So the first thing to do in the other HTTP end is to get the full querystring and decode it. Once decoded you will be able to see the key/value structure, where some values will be visible as plain text and will be directly accessible and some others will be double base64 encoded, so you will need to decode their contents again. You have a list of the available variables at the bottom of this page.

Let's see how we can put it to work in the real world...

For any of those two events to be fired, you only need to add a new argument to your backup job, let's ilustrate this with one axample:



In the above example we are sending the --on-error contextual data to the URL: http://foo.com/xsibackup_onerror.php, at this URL our script will decode the query string and access its values in order to process them. We can insert a record in a database called XSIBackup where we can add: the hostname, the IP, the backup PID, the time when the job finished, the errors received, etc..., then we can optionally fire an SMS to the Sysadmin or do whatever we want. If our PHP script does it's work well (try -> catch) we will return a simple OK in the HTTP response, so that XSIBACKUP-PRO knows the event was processed.

Please take on account that the second parameter "OK" is user settable, so if instead of "OK" you set "BBKING", you must set that as the response upon correct processing in the --on-error URL, so that XSIBackup process a match.

Optionally we can make XSIBACKUP-PRO fire another backup job stored in the xsibackup-cron file. We will generally do this with the --on-success event. The syntax to achieve this is the following:



The upper code, when added to your XSIBackup argument list will look for a job with backupId=04 in the xsibackup-cron file and will run it.

You can combine both events, so that, no matter what happens with the first backup, the second will be fired.



The upper code, will run the backup job with backupId=04 no matter what happens with the previous job.

List of available --on-error and --on-success variables in the parsed query string

Field Description Coding Event
PID XSIBackup PID that generated the HTTP request No coding, plain text Error/Success
t Time the backup process took in seconds No coding, plain text Error/Success
cmd Full argument list as parsed to XSIBackup Base64 Error/Success
err Full list of errors as shown in the e-mail report Base64 Error


If you need a full project, ask for a quote, we'll be glad to bring it out to life for you.

"If you can imagine it, we can do it".




Website Map
Consultancy
IT Manager
In Site
Resources & help
Index of Docs
33HOPS Forum

Fill in to download
The download link will be sent to your e-mail.
Name
Lastname
E-mail


            Read our Privacy Policy