Is there a way to monitor UrBackup backups thru the Home Assistant?

Hi folks,

I have a UrBackup server performing backups from my home’s laptops but, sometimes I’m out traveling but would like to keep an eye on the backups run, but there is no way to access the UrBackup gui outside and I don’t like to have it exposed. So, I would like to integrate UrBackup server to Home Assistant in order to create a card to check running and latest completed backups.
Is there a way to do it?
Developer folks, is there a way to create an integration for that?
Thank you in advance.

I’m not a developer but the application appears to have a command line interface. You should be able to use the command line sensors and shell command to monitor and control it:

My UrBackup is running in another server and I didn’t find a way to perform queries on remote servers.

Tried to use scrape but the UrBackup present the backup status in a table. No luck on it.

I think you can make a docker with portainer addon?
https://hub.docker.com/r/uroni/urbackup-server
And somehow access it from the HASS itself?

Late reply but:
I’ve made a small script to get status from URBackup to HA. It’s still a work in progress.
This is how it looks ln lovelace with a html-template-card when a backup is running:
image

and this is how it looks when no backup is running:
image

Please let me know if thats interesting and I’ll share the details.

2 Likes

Hi, Shejken

Sure!! It’s awesome and I’m interested on it.
Please, share how to implement it.

Well it’s not a elegant solution but this is how it works:
On the Windows PCs that are running the urbackup client I trigger a powershell script at startup (by putting the script in shell:startup). This is the script:

$ServiceName = 'VSS'
$arrService = Get-Service -Name $ServiceName

while ($arrService.Status -ne 'Running')
{
    Start-Sleep -seconds 30
    $arrService.Refresh()
}

while ($arrService.Status -eq 'Running')
{
    .\urbackupstatus.cmd
    Start-Sleep -seconds 30
    $arrService.Refresh()
}

It just checks if the VSS Service is running and if it is the file urbackupstatus.cmd gets triggered every 30 secs.
The file urbackupstatus.cmd contains this:

cd c:\progra~1\urbackup\
urbackupclient_cmd.exe status > \\192.168.1.99\config\urbackupstatus\pchostname.json
exit

That command reads the clients urbackup status and creates a file on my HASS config\urbackupstatus folder.

I then have the folder watcher plugin looking at that folder and if change is detected this command is executed (command inputed in .config file):

  - platform: command_line
    name: hostpcname
    json_attributes:
      - finished_processes
      - last_backup_time
      - running_processes
      - internet_status
      - servers
    command: "cat /config/urbackupstatus/hostpcname.json"
    value_template: "{{ value_json.last_backup_time }}"

And then finaly I just use a template to put the attributes in order in lovelace with a HTML-templare card:

type: custom:html-template-card
title: hostpcname URBackup
ignore_line_breaks: true
content: >
  {%- if  (state_attr('sensor.hostpcnamelastbackup', 'running_processes'))-%}
  <p style="font-size:25px"><b> <p1 style="color:green">Backup running! </p></b>
  <p style="font-size:20px"> Status:</p1> </p> Done:
  {{state_attr('sensor.hostpcnamelastbackup','running_processes')[0].percent_done
  }} %<br>  Speed: {{
  ((state_attr('sensor.hostpcnamelastbackup','running_processes')[0].speed_bpms) 
  | int | round) / 100 }} Mb/s <br>  Type of backup:
  {{state_attr('sensor.hostpcnamelastbackup', 'running_processes')[0].action
  }} <br> ETA: {{ state_attr('sensor.hostpcnamelastbackup',
  'running_processes')[0].eta_ms  | int | timestamp_custom("%H:%M") }} <br>

  {%- else -%}  <p style="color:red"> No backup running for hostpcname </p>
  <br>Last backup was completed at <b> <p1 style="color:green">{{
  state_attr('sensor.hostpcnamelastbackup', 'last_backup_time')  | int |
  timestamp_custom("%d/%m-%Y %H:%M") }} </p1> </b> <br> <br> Client connection
  status: <b>{{ state_attr('sensor.hostpcnamelastbackup', 'internet_status')
  }} </b><br> Server:  <b> {{state_attr('sensor.hostpcnamelastbackup',
  'servers')[0].name }} </b> {%-endif -%} 


As I said it is not elegant but it works flawless and is being updated every 30 sec only while backups are running.
Let me know if you try to set it up and need any help.

1 Like