Class DiskMonitor

java.lang.Object
org.craftercms.studio.impl.v2.monitor.DiskMonitor
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class DiskMonitor extends Object implements org.springframework.beans.factory.InitializingBean
Job for monitoring disk usage.
  • Field Details

    • diskStatus

      protected volatile DiskStatus diskStatus
  • Constructor Details

  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • checkDiskUsage

      public void checkDiskUsage()
    • getServerName

      protected String getServerName() throws UnknownHostException
      Throws:
      UnknownHostException
    • sendAlarm

      protected void sendAlarm()
    • calculateDiskStatus

      protected void calculateDiskStatus()
      Calculates the current disk status based on the disk usage.
    • noPreviousAlarmStatus

      protected DiskStatus noPreviousAlarmStatus(org.craftercms.commons.monitoring.DiskInfo newDiskInfo, int lowWaterMark, int highWaterMark)
      Handles the case where there was no previous alarm status. Checks the current disk usage and if above the high watermark, it triggers the git gc on all repositories.
      Parameters:
      newDiskInfo - the new disk information
      lowWaterMark - the low watermark percentage
      highWaterMark - the high watermark percentage
      Returns:
      a new DiskStatus object with the updated disk information and alarm state
    • getDiskInfo

      protected org.craftercms.commons.monitoring.DiskInfo getDiskInfo()
      Gets the current disk information based on the configured repository base path.
      Returns:
      a DiskInfo object containing the disk usage information
    • previousAlarmStatus

      protected DiskStatus previousAlarmStatus(org.craftercms.commons.monitoring.DiskInfo newDiskInfo, DiskStatus previousStatus, int lowWaterMark, int highWaterMark)
      Handles the case where the previous disk status was an alarm. Checks the current disk usage and if still above the low watermark, it keeps the alarm state.
      Parameters:
      newDiskInfo - the new disk information
      previousStatus - the previous disk status
      lowWaterMark - the low watermark percentage
      highWaterMark - the high watermark percentage
      Returns:
      a new DiskStatus object with the updated disk information and alarm state
    • getDiskStatus

      public DiskStatus getDiskStatus()