I am writing a script which will return the last sync code and the last successful sync date so that I can monitor my SCCM's server ability to keep itself up to date with Microsoft's update catalog.
Import-Module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1) $SiteCode = Get-PSDrive -PSProvider CMSITE Set-Location -Path "$($SiteCode.Name):\" $syncResult = get-cmsoftwareupdatesyncstatus $xmlOutput = '<?xml version="1.0" encoding="UTF-8" ?><prtg>' $xmlOutput = $xmlOutput + "<result> <channel>Sync Code</channel> <value>" + $syncResult.lastSyncErrorCode + "</value> <unit>Absolute</unit> <limitmode>1</limitmode> <LimitMaxError>0</LimitMaxError> <LimitErrorMsg>SCCM Error: Sync with Microsoft Update Catalog failed. Code: %value</LimitErrorMsg> </result> <result> <channel>Last Successful Sync Time</channel> <value>" + $syncResult.lastSuccessfulSyncTime + "</value> <unit>float</unit> </result>" $xmlOutput = $xmlOutput + "</prtg>" $xmlOutput
The idea is that if an error occurs, I can tell how long it has been a problem by having the last successful sync returned right next to it. How can I have PRTG display text in a channel? I keep getting Custom SNMP String questions with my current level of Google-fu.
Add comment