Applications Systems
Directory Size Monitor Timed Out
Directory Size Monitor is timing out. This monitor has been known to time out when the directory is empty. The application debug logging can be enabled to show the full error stack. Once enabled, the error below will be found if this is the case.
First published date
Last published date
Overview
System.Management.ManagementException: Timed out. Connection timeout. Directory Size template is not working. Not returning size value. Directory is empty, directory is zero bytes.
ERROR SolarWinds.APM.Probes.WMIDirectoryProbeBase`1 - Unhandled exception. System.Management.ManagementException: Timed out at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() at SolarWinds.APM.Probes.DirectorySizeProbe.GetStatistics(ManagementScopeContext scope, String query, TimeSpan timeout) at SolarWinds.APM.Probes.WMIDirectoryProbeBase`1.ProbeInternal(ProbeInformation probeInfo, PortMonitorNumericResult result)
Product section
Cause
Resolution
Troubleshooting the Issue
If the target directory is empty, the WMI query used to check the size is not optimized to handle this. You can verify that this is the cause by running the WMI query in the WBEMTEST tool.
- Navigate to the assigned server, and open WBEMTEST from the start menu search.
- Connect hit 'Connect' and then click 'Connect' again. There is no need to specify credentials for local access.
- Click 'Query'
- Type the following query
SELECT FileSize FROM CIM_DataFile WHERE Path LIKE '\\ProgramData\\SolarWinds\\Logs\\Agent\\%' AND Drive = 'C:'
- Execute the query and wait for the results.
(Screenshots property of © 2021 Microsoft Corporation. All rights reserved.)
**The query is not complete until the "operation in progress..." switches to read "Done."
Workarounds Available
The directory size monitor is dependent upon the WMI query to scan the directory. This leverages WMI queries to obtain the results. If this query takes a long time to return the result, you will need to increase the timeout on the application monitor. It is suggested to make this change at the template level.
- Settings > All Settings > SAM Settings > Manage Templates.
- Search for "Directory Size" and click 'Search'
- Select and Edit the Template.
- Increase the "Polling Frequency:" value near the top of the page (600 seconds is recommended).
- You may need to increase the timeout value depending on the length of time the WMI query takes to return values.
- Save changes to the template.
If increasing the timeout is not an option for your monitoring requirements, it is suggested to develop a custom WMI query to scan directory size. Alternatively, you can generate a script, or a PowerShell script, to query the directory size.
Example PowerShell script
#Scripts are not supported under any SolarWinds support program or service.
#Scripts are provided AS IS without warranty of any kind. SolarWinds further
#disclaims all warranties including, without limitation, any implied warranties
#of merchantability or of fitness for a particular purpose. The risk arising
#out of the use or performance of the scripts and documentation stays with you.
#In no event shall SolarWinds or anyone else involved in the creation,
#production, or delivery of the scripts be liable for any damages whatsoever
#(including, without limitation, damages for loss of business profits, business
#interruption, loss of business information, or other pecuniary loss) arising
#out of the use of or inability to use the scripts or documentation.
$userpath = "C:\file\path"
function Get-Size
{
param([string]$pth)
"{0:n2}" -f ((gci -path $pth -recurse | measure-object -property length -sum).sum)
}
[int]$answer = Get-Size $userpath
Write-Host Statistic: $answer
Write-Host Message: "The size of the folder is" $answer "bytes"
exit 0;