AleixoLucas42 / duplicati-prometheus-exporter

A simple prometheus exporter for Duplicati backup
6 stars 1 forks source link

Backup Size Source and Backup #3

Open thbemme opened 1 week ago

thbemme commented 1 week ago

Are there metrics to display real size of data and size of backup like Duplicati is displaying already as Source and Backup?

image

If not, would it be possible to add them?

AleixoLucas42 commented 3 days ago

Are there metrics to display real size of data and size of backup like Duplicati is displaying already as Source and Backup?

image

If not, would it be possible to add them?

The metrics are based on the http post that duplicati makes to the exporter, in this post comes the following json:

{
   "Data":{
      "DeletedFiles":0,
      "DeletedFolders":0,
      "ModifiedFiles":0,
      "ExaminedFiles":1,
      "OpenedFiles":0,
      "AddedFiles":0,
      "SizeOfModifiedFiles":0,
      "SizeOfAddedFiles":0,
      "SizeOfExaminedFiles":32821,
      "SizeOfOpened
Files":0,
      "NotProcessedFiles":0,
      "AddedFolders":0,
      "TooLargeFiles":0,
      "FilesWithError":0,
      "ModifiedFolders":0,
      "ModifiedSymlinks":0,
      "AddedSymlinks":0,
      "DeletedSymlinks":0,
      "PartialBackup":false,
      "Dryrun":false,
      "MainOperation":"Backup",
      "
CompactResults":"None",
      "VacuumResults":"None",
      "DeleteResults":{
         "DeletedSetsActualLength":0,
         "DeletedSets":[

         ],
         "Dryrun":false,
         "MainOperation":"Delete",
         "CompactResults":"None",
         "ParsedResult":"Success",
         "Interrupted":false,
         "Version":"2.0.8.1 (
2.0.8.1_beta_2024-05-07)",
         "EndTime":"2024-10-19T18:51:33.839796Z",
         "BeginTime":"2024-10-19T18:51:33.838885Z",
         "Duration":"00:00:00.0009110",
         "MessagesActualLength":0,
         "WarningsActualLength":0,
         "ErrorsActualLength":0,
         "BackendStatistics":{
            "Remo
teCalls":5,
            "BytesUploaded":0,
            "BytesDownloaded":13753,
            "FilesUploaded":0,
            "FilesDownloaded":3,
            "FilesDeleted":0,
            "FoldersCreated":0,
            "RetryAttempts":0,
            "UnknownFileSize":0,
            "UnknownFileCount":0,
            "KnownFileCount":3,
            "KnownFileSize":13753,
            "LastBackupDate":"2024-09-23T19:12:28-03:00",
            "BackupListCount":1,
            "TotalQuotaSpace":214748364800,
            "FreeQuotaSpace":211762509621,
            "AssignedQuotaSpace":-1,
            "ReportedQuotaError":false,
            "ReportedQuotaWarning":false,
            "MainOperation":"Backup",
            "Par
sedResult":"Success",
            "Interrupted":false,
            "Version":"2.0.8.1 (2.0.8.1_beta_2024-05-07)",
            "EndTime":"0001-01-01T00:00:00",
            "BeginTime":"2024-10-19T18:51:32.135108Z",
            "Duration":"00:00:00",
            "MessagesActualLength":0,
            "WarningsActualLength":0,
            "E
rrorsActualLength":0
         }
      },
      "RepairResults":"None",
      "TestResults":{
         "MainOperation":"Test",
         "VerificationsActualLength":3,
         "Verifications":[
            {
               "Key":"duplicati-zzzzzzzzzzzzzzzzzzzzzzzz.dlist.zip",
               "Value":[

               ]
            },
            {
               "Key":"duplicati-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.dindex.zip",
               "Value":[

               ]
            },
            {
               "Key":"duplicati-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.dblock.zip",
               "Value":[

               ]
            }
         ],
         "ParsedResult":"Success",
         "Interrupted":false,
         "Version":"2.0.8.1 (2.0.8.1_beta_2024-05-07)",
         "EndTime":"2024-10-19T18:51:39.456296Z",
         "
BeginTime":"2024-10-19T18:51:35.340085Z",
         "Duration":"00:00:04.1162110",
         "MessagesActualLength":0,
         "WarningsActualLength":0,
         "ErrorsActualLength":0,
         "BackendStatistics":{
            "RemoteCalls":5,
            "BytesUploaded":0,
            "BytesDownloaded":13753,
            "FilesUploa
ded":0,
            "FilesDownloaded":3,
            "FilesDeleted":0,
            "FoldersCreated":0,
            "RetryAttempts":0,
            "UnknownFileSize":0,
            "UnknownFileCount":0,
            "KnownFileCount":3,
            "KnownFileSize":13753,
            "LastBackupDate":"2024-09-23T19:12:28-03:00",
            "BackupListCount":1,
            "
TotalQuotaSpace":214748364800,
            "FreeQuotaSpace":211762509621,
            "AssignedQuotaSpace":-1,
            "ReportedQuotaError":false,
            "ReportedQuotaWarning":false,
            "MainOperation":"Backup",
            "ParsedResult":"Success",
            "Interrupted":false,
            "Version":"2.0.8.1 (2.0.
8.1_beta_2024-05-07)",
            "EndTime":"0001-01-01T00:00:00",
            "BeginTime":"2024-10-19T18:51:32.135108Z",
            "Duration":"00:00:00",
            "MessagesActualLength":0,
            "WarningsActualLength":0,
            "ErrorsActualLength":0
         }
      },
      "ParsedResult":"Success",
      "Interrupted":"Fal
se",
      "Version":"2.0.8.1 (2.0.8.1_beta_2024-05-07)",
      "EndTime":"2024-10-19T18:51:39.462634Z",
      "BeginTime":"2024-10-19T18:51:32.135105Z",
      "Duration":"00:00:07.3275290",
      "MessagesActualLength":13,
      "WarningsActualLength":0,
      "ErrorsActualLength":0,
      "
BackendStatistics":{
         "RemoteCalls":5,
         "BytesUploaded":0,
         "BytesDownloaded":13753,
         "FilesUploaded":0,
         "FilesDownloaded":3,
         "FilesDeleted":0,
         "FoldersCreated":0,
         "RetryAttempts":0,
         "UnknownFileSize":0,
         "UnknownFileCount":0,
         "KnownFileCount":3,
         "KnownFileSize":13753,
         "LastBackupDate":"2024-09-23T19:12:28-03:00",
         "BackupListCount":1,
         "TotalQuotaSpace":214748364800,
         "FreeQuotaSpace":211762509621,
         "AssignedQuotaSpace":-1,
         "ReportedQuotaError":false,
         "ReportedQuotaWarning":false,
         "Main
Operation":"Backup",
         "ParsedResult":"Success",
         "Interrupted":false,
         "Version":"2.0.8.1 (2.0.8.1_beta_2024-05-07)",
         "EndTime":"0001-01-01T00:00:00",
         "BeginTime":"2024-10-19T18:51:32.135108Z",
         "Duration":"00:00:00",
         "MessagesActualLength":0,
         "Wa
rningsActualLength":0,
         "ErrorsActualLength":0
      }
   },
   "Extra":{
      "OperationName":"Backup",
      "backup-name":"test"
   },
   "LogLines":[

   ],
   "Exception":"None"
}

The metrics that I can add are SizeOfExamined Files and KnownFileSize but I don't know if it would help you. In conclusion, basically since duplicati doesn't send us this information, we have to put together some pieces from different places to be able to have a specific metric.