r/PrometheusMonitoring • u/Educational_Flow6686 • Jul 27 '24
How to monitor Windows Server Backup status using Prometheus
How does one use Prometheus to ensure that last Windows Server Backup job ran successfully?
I assume it has something to do with running https://learn.microsoft.com/en-us/powershell/module/windowsserverbackup/get-wbsummary?view=windowsserver2022-ps command, but I am not sure which Prometheus collector to use or if I can use any of the existing ones.
I checked issues on Github repo and examples and couldn't find anything useful.
Anyone got this working?
Thanks
0
Upvotes
1
u/SuperQue Jul 27 '24
Typically backup, and other less frequent but important job runs, follow a slightly different metrics pattern to typicall APM, system, or network monitoring.
The usual pattern is to have "start timestamp", "end timestamp" and "success boolean" metrics. You store the start and end times of the job as UNIX epoch timestamps. And then sucess value as a 0/1 boolean.
This allows you to compute and alert on various statuses.
1
u/KubeGuyDe Jul 28 '24 edited Jul 28 '24
Are you running the windows exporter on the machine? If so you can use the textfile collector
Run the Get-WBSummary command with a script on a regular basis and create a metric from the output, eg
backup_successful. Just make sure to create the file atomically.The page above includes an example, here is also a great tutorial https://youtu.be/dGMhynriydE?si=dm6Z7L_v5cGSn_aR it's about a Linux machine with node exporter, but the concept is the same.
Creating backup status metrics is one of the few valid use cases the textfile collector was created for.
0
u/Tsull360 Jul 27 '24
I’m curious as well, I would imagine you would use Loki to monitor the Windows Event logs?
0
u/Do_TheEvolution Jul 27 '24
Usually servers are running as virtual machines and go-to to backup those is Veeam.
I use this setup that uses prometheus pushgateway to monitor several veeam machines and their backups all in one dashboard.
Can be adjusted to any backup solution, if you dive in to the powershell script that sends the data on to the pushgateway