Created
February 29, 2016 13:43
-
-
Save vMarkusK/713b2e4aa767257f84cc to your computer and use it in GitHub Desktop.
PRTG Advanced Custom Sensor for VEEAM v9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user = "yourUser" | |
$password = "yourPassword" | |
# POST - Authorization | |
$Auth = @{uri = "http://yourVEM.fqdn:9399/api/sessionMngr/?v=v1_2"; | |
Method = 'POST'; #(or POST, or whatever) | |
Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($user):$($password)")); | |
} #end headers hash table | |
} #end $params hash table | |
$AuthXML = Invoke-WebRequest @Auth | |
# GET - Session Statistics | |
$Sessions = @{uri = "http://yourVEM.fqdn:9399/api/reports/summary/job_statistics"; | |
Method = 'GET'; | |
Headers = @{'X-RestSvcSessionId' = $AuthXML.Headers['X-RestSvcSessionId']; | |
} #end headers hash table | |
} | |
[xml]$SessionsXML = invoke-restmethod @Sessions | |
$SuccessfulJobRuns = $SessionsXML.JobStatisticsReportFrame.SuccessfulJobRuns | |
$WarningsJobRuns = $SessionsXML.JobStatisticsReportFrame.WarningsJobRuns | |
$FailedJobRuns = $SessionsXML.JobStatisticsReportFrame.FailedJobRuns | |
# GET - VM Statistics | |
$VMs = @{uri = "http://yourVEM.fqdn:9399/api/reports/summary/vms_overview"; | |
Method = 'GET'; | |
Headers = @{'X-RestSvcSessionId' = $AuthXML.Headers['X-RestSvcSessionId']; | |
} #end headers hash table | |
} | |
[xml]$VMsXML = invoke-restmethod @VMs | |
$ProtectedVms = $VMsXML.VmsOverviewReportFrame.ProtectedVms | |
$SourceVmsSize = [Math]::round((($VMsXML.VmsOverviewReportFrame.SourceVmsSize) / 1073741824),0) | |
# XML Output for PRTG | |
Write-Host "<prtg>" | |
Write-Host "<result>" | |
"<channel>SuccessfulJobRuns</channel>" | |
"<value>$SuccessfulJobRuns</value>" | |
"<showChart>1</showChart>" | |
"<showTable>1</showTable>" | |
"</result>" | |
Write-Host "<result>" | |
"<channel>ProtectedVms</channel>" | |
"<value>$ProtectedVms</value>" | |
"<showChart>1</showChart>" | |
"<showTable>1</showTable>" | |
"</result>" | |
Write-Host "<result>" | |
"<channel>SourceVmsSize</channel>" | |
"<value>$SourceVmsSize</value>" | |
"<unit>Custom</unit>" | |
"<customUnit>GB</customUnit>" | |
"<showChart>1</showChart>" | |
"<showTable>1</showTable>" | |
"</result>" | |
Write-Host "<result>" | |
"<channel>WarningsJobRuns</channel>" | |
"<value>$WarningsJobRuns</value>" | |
"<showChart>1</showChart>" | |
"<showTable>1</showTable>" | |
"<LimitMaxWarning>1</LimitMaxWarning>" | |
"<LimitMode>1</LimitMode>" | |
"</result>" | |
Write-Host "<result>" | |
"<channel>FailedJobRuns</channel>" | |
"<value>$FailedJobRuns</value>" | |
"<showChart>1</showChart>" | |
"<showTable>1</showTable>" | |
"<LimitMaxError>1</LimitMaxError>" | |
"<LimitMode>1</LimitMode>" | |
"</result>" | |
Write-Host "</prtg>" | |
Are you still supporting this script? Is it compatible with the current Veeam Version?
Hello Fred,
I haven't maintained this script for a while but it should still work with
Veaam Backup and Replication 9.5 Update 4. Have you already tried it?
Have you also seen this script?
https://github.com/mycloudrevolution/Advanced-PRTG-Sensors/blob/master/Veeam/PRTG-VeeamBRStats.ps1
It is much more common in the community.
Best regards
Markus
Fred Hohenstein <[email protected]> schrieb am Do., 27. Juni 2019,
15:07:
… Are you still supporting this script? Is it compatible with the current
Veeam Version?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/713b2e4aa767257f84cc?email_source=notifications&email_token=AD7OWOR3JYJAVUVHMCBRJS3P4S3RVA5CNFSM4H33ZFJKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFUMTO#gistcomment-2955575>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD7OWOSBHX7UYQEOAVUMADDP4S3RVANCNFSM4H33ZFJA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there, thank you for sharing your script, it's quite useful. I did however include some changes (variables/parameters for the input like host/port and timeout) and included try/catch when doing the webrequests, otherwise the script doesn't really display any alerts in PRTG when the execution fails. Would you mind updating the code?
Here's the updated version: https://pastebin.com/qxWG6THh