Reapply "Add aggregate Veeam jobs summary item"
This reverts commit c8b6f4d31b.
This commit is contained in:
@@ -506,6 +506,31 @@ function Format-VeeamJobDetailsTable {
|
||||
return ($lines -join [Environment]::NewLine)
|
||||
}
|
||||
|
||||
function Format-VeeamJobsSummary {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[object[]]$JobDetails
|
||||
)
|
||||
|
||||
if ($JobDetails.Count -eq 0) {
|
||||
return 'No Veeam jobs found'
|
||||
}
|
||||
|
||||
$lines = @('Job | Enabled | Last run | Next run | Result | Restore points')
|
||||
|
||||
foreach ($job in ($JobDetails | Sort-Object -Property name)) {
|
||||
$lines += ('{0} | {1} | {2} | {3} | {4} | {5}' -f
|
||||
$job.name,
|
||||
$job.enabled_text,
|
||||
$job.last_run,
|
||||
$job.next_run,
|
||||
$job.result,
|
||||
$job.restore_points_text)
|
||||
}
|
||||
|
||||
return ($lines -join [Environment]::NewLine)
|
||||
}
|
||||
|
||||
function Format-ZabbixSenderValue {
|
||||
param(
|
||||
[object]$Value
|
||||
@@ -644,6 +669,7 @@ function Get-VeeamJobMetrics {
|
||||
error_names = Format-ZabbixTextValue -Values @($errorJobs | ForEach-Object { Get-VeeamJobName -Job $_ })
|
||||
warning_names = Format-ZabbixTextValue -Values @($warningJobs | ForEach-Object { Get-VeeamJobName -Job $_ })
|
||||
jobs_table = Format-VeeamJobDetailsTable -JobDetails $jobDetails
|
||||
jobs_summary = Format-VeeamJobsSummary -JobDetails $jobDetails
|
||||
jobs_lld = [ordered]@{
|
||||
data = $jobsLld
|
||||
}
|
||||
@@ -711,6 +737,7 @@ function Send-ZabbixMetrics {
|
||||
"`"$ZabbixHost`" veeam.jobs.error.names $(Format-ZabbixSenderValue -Value $Metrics.error_names)"
|
||||
"`"$ZabbixHost`" veeam.jobs.warning.names $(Format-ZabbixSenderValue -Value $Metrics.warning_names)"
|
||||
"`"$ZabbixHost`" veeam.jobs.table $(Format-ZabbixSenderValue -Value $Metrics.jobs_table)"
|
||||
"`"$ZabbixHost`" veeam.jobs.summary $(Format-ZabbixSenderValue -Value $Metrics.jobs_summary)"
|
||||
) | Set-Content -Path $senderInput -Encoding ASCII
|
||||
|
||||
$failedEndpoints = @()
|
||||
|
||||
Reference in New Issue
Block a user