Git Product home page Git Product logo

synology_backup_exporter's Introduction

Synology Backup Exporter

Install

Docker

docker-image available Docker Hub

Synology Docker

  1. create config.json in /volume1/docker/synology_backup_exporter (or elsewhere)
  2. Search for "synology_backup_exporter" in Docker Registry
  3. select tag "dsm7"
  4. wait for image download to finish
  5. launch image
  6. set config.json as filevolume to /app/config.json
  7. add port settings (The default exporter-port is 9771)
  8. ???
  9. scrape metrics :)

Configure

Configure with just a config file

Copy config.json.dist to config.json then change the settings in config.json to your needs

Configure with just Environment Variables

Look in the config.json.dist file, then simply uppercase the keys and provide the values, for example:

  • DSMAddress becomes DSMADDRESS
  • Cert_Verify becomes CERT_VERIFY
  • etc

Configure with both the config file and Environment Variables

Copy config.json.dist to config.json then change the settings in config.json to your needs. Remove any lines that are not wanted in the config file, for example if having a password in the config file is not desired, remove that line, then provide the environment variable PASSWORD. If a value is provided in the config file and as an environment variable, the config file will take precedence. Note: JSON files should not have a , on the last configuration line, if the last line has a comma this exporter will not work

Metrics

Active Backup for Business

Active Backup for Business metrics have these labels: hostname,vmname,vmos,vmuuid

metrics:

synology_active_backup_lastbackup_timestamp
synology_active_backup_lastbackup_duration
synology_active_backup_lastbackup_transfered_bytes
synology_active_backup_lastbackup_result

Hyper Backup

Hyper Backup metrics have these labels: task_id,task_name,target_type

synology_hyper_backup_lastbackup_successful_timestamp
synology_hyper_backup_lastbackup_timestamp
synology_hyper_backup_lastbackup_duration

Note: For the first time a Hyper Backup is run, the exporter will report the backup job as being successful with a duration of 0 seconds, and completion timestamps of whenever the exporter scraped the Synology.

Hyper Backup Vault

Hyper Backup Vault metrics have these labels: target_name,target_id,target_status

synology_hyper_backup_vault_last_backup_duration_seconds
synology_hyper_backup_vault_last_backup_start_timestamp
synology_hyper_backup_vault_target_used_size_bytes

Alert rules:

Last Backup not successful:

Active Backup
name: Synology Active Backup Last Backup not successful
expr: synology_active_backup_lastbackup_result != 2
for: 1m
Hyper Backup
name: Synology Hyper Backup Last Backup not successful
expr: synology_hyper_backup_lastbackup_timestamp != synology_hyper_backup_lastbackup_successful_timestamp
for: 1m

Last Backup older than 72 hours:

Active Backup
name: Synology Active Backup Last Backup older than 72 hours
expr: ((synology_active_backup_lastbackup_timestamp - time()) / 3600) < -72
for: 1m
Hyper Backup
name: Synology Hyper Backup Last Backup older than 72 hours
expr: ((synology_hyper_backup_lastbackup_successful_timestamp - time()) / 3600) < -72
for: 1m

License

MIT // 2021 - Raphael Pertl

Special thanks to synology-api

synology_backup_exporter's People

Contributors

raph2i avatar zxjinn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

synology_backup_exporter's Issues

[Permissions] Use exporter with Synology non-admin user

Hello,

I have tried to setup a DSM Synology user with delegated access for Hyper Backup only - rather than giving full Administrator group access. I specify the user + password as ENV variables to the exporter container.

The issue is: with a DSM non-admin user the Exporter won't start. The Synology DSM account itself works - if I login I can see only Hyper Backup and access all its jobs.

The delegation how-to is described here:
https://community.synology.com/enu/forum/8/post/147857

Is it possible to get this to work?

Exporter very high %CPU

Hello,

I have ~20 containers running on my 8core physical host (misc applications, Prometheus exporters etc), including the Synology Backup Exporter, latest image.

The issue I have is this application / exporter is using 10x the CPU compared to all the rest. I think it's a bit odd. I have visualized it with Grafana here:

image

And with Linux Cockpit here:

image

Is there anything that can be done about the heavy utilization, or is it expected behavior?

Exporter "lastbackup" timestamp unit for visualization

Hi @raph2i ,

Thanks for the excellent exporter. I'm visualizing the metrics in Grafana, and wonder if you know what unit (in the Grafana Dashboard options - Standard options - Unit) to use for those two metrics?

synology_hyper_backup_lastbackup_successful_timestamp
synology_hyper_backup_lastbackup_timestamp

Datetime doesn't seem to be correct ones. It shows 1970-01-20 on all metrics.

Take configuration from environment variables

Hey @raph2i this is a wonderful tool, thank you for writing it.

I wanted to extend it a little bit, but would like your opinion on how you would like it extended first. I am planning on running this in a container (but not on the synology itself), and would rather configure the script with environment variables instead of the config.json file.

There are three basic paths forward that I see:

  • If the config.json doesn't exist, start reading in the values from an environment variable. This is an all or nothing, either use the config file or use env vars.
  • Detect what values are missing from the config.json and then reach to an env var to fill that value
  • Detect what env vars are missing, and reach to the config.json to fill that value

Which of these three do you prefer? or something else perhaps.

The last question is, should the script fail and exit if one of the config values doesn't exist, or should it be filled with some kind of default value (like you have in the config.json.dist file)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.