ctmonfs command
Purpose
Monitors a file system for a specific condition.
Syntax
ctmonfs -a -n condition_name -f <fsname> -c <condition_type[,attr=value,...]> [-b <action_name> ]
[-k <action_type[,attr=value,...]> [-i <interval>] [-m 0|1] [-e 0|1]
To
change attributes of a file system condition, use the following
syntax:ctmonfs -u -n condition_name [-f <fsname>] [-c <attr=value,...>] [-b|-B <action_name> ]
[-k <attr=value,...>] [-i <interval>] [-m 0|1] [-e 0|1]
To
remove a file system condition, use the following
syntax:ctmonfs -r -F | -n condition_name
To
list a specific file system condition or to list all file system conditions, use the following
syntax:ctmonfs -l [-n condition_name]
Description
The ctmonfs command is used to monitor a file system for a specific condition. Conditions define the criteria against which a file system must be monitored. Actions define the commands that must be run when the condition occurs. You do not need to specify any action or you can specify actions that must be run according to the priority of action. If the priority of the actions is not specified, the actions are run in the order that you specified the actions. If you do not specify any action, the condition is logged in trace file without running any action. Each condition or action consists of attributes that define the additional data of the condition or action.
The following condition type is supported:
fsspace
- Monitors free space of the file system. The
fsspace
condition type contains the following attributes:- method
- Specifies how the file system space is monitored. Valid values are as follows:
- free_percent
- Monitors file system by percentage of total remaining space.
- free_space
- Monitors file system by units of remaining space in MB.
- threshold_free_percent
- Specifies a threshold percentage value for a condition of free or remaining space in a file
system. That is, the condition becomes true if percentage of free space is equal to or lesser than
this value.Note: This attribute is valid only when the method attribute is set to
free_percent
. - threshold_free_space
- Specifies a threshold value in MB for a free space condition in a file system. That is, the
condition becomes true if the free space is equal to or lesser than this value. Note: This attribute is valid only when the method attribute is set to
free_space
. - rearm_value
- Stops evaluating the threshold_free_percent or
threshold_free_space values when the condition becomes true and starts
evaluating the rearm_value attribute value. The rearm condition becomes true if
the
free_percent
orfree_space
value becomes equal to or greater than this value.Note: The rearm_value attribute is optional. In addition, the rearm_value and rearm_waittime attributes are mutually exclusive. If the rearm_value attribute is specified, the rearm_waitime attribute must not be specified. - rearm_waittime
- Stops evaluating the threshold_free_percent or
threshold_free_space values when the condition becomes true and resumes the
file system monitoring after the time that is specified in the rearm_waittime
attribute. That is, file system monitoring is suspended for the duration that is specified in the
rearm_waittime attribute.Note: The rearm_waittime attribute is optional. In addition, the rearm_value and rearm_waittime attributes are mutually exclusive. If the rearm_waittime attribute is specified, the rearm_value attribute must not be specified.
The following action type is supported:
- useraction
- Starts the user script or an executable file. The
useraction
action type contains the following attributes:- path
- Specifies the name of the executable file.
- priority
- Specifies the priority of the action. Valid values are positive integers. A lesser number indicates more priority. A value of 0 means no priority.
The configuration settings that are specified in the ctmonfs command are
stored in the /var/ct/cfg/fsmon.cfg file. By default, the
/var file system is monitored for the fsspace
condition with
an associated useraction
type. When the fsspace
condition becomes
true, a default script is called to clean unnecessary files in the /var/ct
directory.
Flags
- -a
- Creates a file system condition to monitor the file system.
- -u
- Modifies an existing file system condition.
- -r
- Removes a file system condition. If the -F flag is specified, all the file system conditions are removed.
- -l
- Lists all file system conditions. If you specify the -n flag, only a specific file system condition is listed.
- -n condition_name
- Specifies a unique name for a file system condition. The name can be used to list, modify, or remove the file system condition.
- -f fsname
- Specifies the name of the file system that you want to monitor.
- -c condition_type
- Specifies the condition type that must be monitored. The condition_type parameter consists of a condition type followed by comma-delimited attributes. To modify attribute values, use the -u option and specify the attributes that must be changed.
- -b action_name
- Specifies a unique name for an action. The action name can be used to modify or to remove the action.
- -B action_name
- Removes the specified action.
- -k action_type
- Specifies the action that must be performed when the condition becomes true. The
action_type parameter consists of the action type followed by comma-delimited
attributes. To modify attributes of the action type, use the -u option and
specify the attributes that must be changed.Note: You can define only one action when a new file system condition is created. Use the -u flag to add more actions to the condition. If no action is configured for a condition, the event is logged in trace files when the condition becomes true.
- -i interval
- Specifies the interval, in seconds, at which the condition is evaluated.
- -m [0|1]
- Enables or disables monitoring of the file system. The following values are valid:
- 1
- Enables monitoring of the file system.
- 0
- Disables monitoring of the file system.
- -e [0|1]
- Enables or disables error logging. The following values are valid:
- 1
- An error log entry is created when the condition becomes true.
- 0
- Error logging is disabled when the condition becomes true.
Exit status
- 0
- The command completed successfully.
- 1
- An error occurred.
Examples
- To list all monitoring conditions for file system, enter the following
command:
ctmonfs -l
- To monitor the file system space (
fsspace
) and to run the /tmp/mycleanup command when the free space percentage is less than 10%, enter the following command:ctmonfs -a -n "var mon" -f "/var" -c "fsspace,method=free_percent,threshold_free_percent=10" -b "run cleanup" -k "useraction,path=/tmp/mycleanup" -i 1800 -m 1 -e 1
- To modify the interval at which the condition is evaluated, enter the following
command:
ctmonfs -u -n "var mon" -i 900
- To modify the path attribute value of an existing action (
run cleanup
), enter the following command:ctmonfs -u -n "var mon" -b "run cleanup" -k "path=/tmp/varcleanup"
- To remove an action, enter the following
command:
ctmonfs -u -n "var mon" -B "run cleanup"
- To remove a file system condition, enter the following
command:
ctmonfs -r -n "var mon"
- To set or modify the priority of an existing action (
run cleanup
), enter the following command:ctmonfs -u -n "var mon" -b "run cleanup" -k "priority=1"
Location
- /opt/rsct/bin/ctmonfs
- Contains the ctmonfs command.
Files
- /var/ct/cfg/fsmon.cfg
- Contains the configuration settings for monitoring a file system.