/** * Marks the given node as offline if free disk space is below the configured threshold. * * @param c the node * @return the free space * @since 1.521 */ @Restricted(NoExternalUse.class) public DiskSpace markNodeOfflineIfDiskspaceIsTooLow(Computer c) { DiskSpace size = (DiskSpace) super.data(c); if (size != null && size.size < getThresholdBytes()) { size.setTriggered(this.getClass(), true); if (getDescriptor().markOffline(c, size)) { LOGGER.warning(Messages.DiskSpaceMonitor_MarkedOffline(c.getName())); } } return size; }
public long getThresholdBytes() { if (freeSpaceThreshold == null) return DEFAULT_THRESHOLD; // backward compatibility with the data format that didn't have // 'freeSpaceThreshold' try { return DiskSpace.parse(freeSpaceThreshold).size; } catch (ParseException e) { return DEFAULT_THRESHOLD; } }
@DataBoundConstructor public AbstractDiskSpaceMonitor(String threshold) throws ParseException { this.freeSpaceThreshold = threshold; DiskSpace.parse(threshold); // make sure it parses }