DiskHealthIndicator

The DiskHealthIndicator contains checks which are related to the disk storage of the current running machine

  
class DiskHealthIndicator extends HealthIndicator {
  checkStorage(key: string, options: (Without<DiskOptionsWithThreshold, DiskOptionsWithThresholdPercent> & DiskOptionsBase & DiskOptionsThresholdPercent) | (Without<...> & ... 1 more ... & DiskOptionsThreshold)): Promise<HealthIndicatorResult>

  // inherited from terminus/lib/HealthIndicator
  protected getStatus(key: string, isHealthy: boolean, data?: { [key: string]: any; }): HealthIndicatorResult
}

Methods

checkStorage()

Checks if the size of the given size has exceeded the given threshold


checkStorage(key: string, options: (Without<DiskOptionsWithThreshold, DiskOptionsWithThresholdPercent> & DiskOptionsBase & DiskOptionsThresholdPercent) | (Without<...> & ... 1 more ... & DiskOptionsThreshold)): Promise<HealthIndicatorResult>

Parameters

Option Type Description
key string

The key which will be used for the result object

options (Without & DiskOptionsBase & DiskOptionsThresholdPercent) | (Without<...> & ... 1 more ... & DiskOptionsThreshold)

Examples

    
// The used disk storage should not exceed 250 GB
diskHealthIndicator.checkStorage('storage', { threshold: 250 * 1024 * 1024 * 1024, path: '/' });
    
// The used disk storage should not exceed 50% of the full disk size
diskHealthIndicator.checkStorage('storage', { thresholdPercent: 0.5, path: 'C:\\' });

Returns

Promise<HealthIndicatorResult> The result of the health indicator check

Throws

HealthCheckError In case the health indicator failed

StorageExceededError In case the disk storage has exceeded the given threshold