Based on File System Capacity

AMPS provides the following If module for taking action based on the file system capacity. AMPS loads this module by default:

Module NameDoes

amps-action-if-file-system-usage

Checks whether the specified path on the filesystem meets the specified usage level. If so, allows execution to continue. If not, stops the action.

ParameterDescription

Path (required)

Specifies the filesystem path to monitor.

The AMPS process must have sufficient permissions to check the disk usage for this path at the time the check runs.

There is no default for this parameter.

GreaterThan (required)

The threshold to check, specified as a percentage.

If the provided path has more space used than specified in this parameter, subsequent Do and If blocks will run. Otherwise, the action will complete with this step.

This module does not add any variables to the AMPS context.

For example, the following action will log a message in the AMPS log every minute when the file system becomes more than 90% full, and perform a full shutdown of AMPS if the file system is more than 98% full.

<Actions>
    <Action>
        <On>
            <Module>amps-action-on-schedule</Module>
            <Options>
                <Every>1m</Every>
            </Options>
        </On>
        <If>
            <Module>amps-action-if-file-system-usage</Module>
            <Options>
                <GreaterThan>90%</GreaterThan>
                <Path>/mnt/fastdrive/amps</Path>
            </Options>
        </If>
        <Do>
            <Module>amps-action-do-echo-message</Module>
            <Options>
                <Message>ALERT: You're getting low on space!</Message>
            </Options>
        </Do>
        <If>
            <Module>amps-action-if-file-system-usage</Module>
            <Options>
                <GreaterThan>98%</GreaterThan>
                <Path>/mnt/fastdrive/amps</Path>
            </Options>
        </If>
        <Do>
            <Module>amps-action-do-echo-message</Module>
            <Options>
                <Message>CRITICAL: Shutting down AMPS</Message>
            </Options>
        </Do>
        <Do>
            <Module>amps-action-do-shutdown</Module>
        </Do>
    </Action>
</Actions>

Last updated

Copyright 2013-2024 60East Technologies, Inc.