The purpose of this tutorial is to provide users with a step-by-step guide explaining how to create custom storage
utilization analysis commands allowing one to detect user-specific storage utilization patterns and send e-mail notifications.
As an example, we will create a user-defined storage utilization command capable of detecting directories containing
large amounts of old, unused document files and sending notifications for each directory matching these criteria.
This tutorial uses advanced storage utilization analysis capabilities, which are available in FlexTk Ultimate v2.8.x or newer only.
First of all, in order to be able to send e-mail notifications, we need to configure an e-mail account. Start FlexTk's
main GUI application, select the menu 'Tools - FlexTk Options' and select the 'E-Mail' tab on the FlexTk options dialog.
Check the 'Enable E-Mail Notifications' checkbox and enter all the required e-mail account details. After finishing entering
e-mail account details, press the 'Verify E-Mail Account' button to check the specified e-mail account.
Now, let's create a new storage utilization analysis command. Select a user-defined commands tool pane, press the right
mouse button and select 'Add - Storage Analysis Command' menu item. On the command name dialog enter a unique command name.
On the command inputs dialog add all directories and files that should be analyzed and press the next button. On the storage
utilization analysis command dialog select the 'Rules' tab and add the following two file matching rules:
'Files Categorized as Documents' and 'Files Accessed More Than 6 Months Ago'. For more information about how to define custom
file matching rules for your own specific needs refer to the file search tutorial.
The specified file matching rules will limit the storage utilization analysis process to files matching the specified criteria.
Files not matching the specified criteria will be excluded from the analysis process, not evaluated by user-specified conditions
and not displayed in the results. Once you have finished adding file matching rules, select the 'Actions' tab. The 'Actions' tab
allows one to specify one or more conditions and define actions that should be executed when a condition is met. In order to add
a new conditional action, press the 'Add' button located on the 'Actions' tab.
The conditional action dialog consists of the following three selectors: the directories selector, the condition selector and
the action selector. The directories selector provides the user with the ability to specify an explicit directory to check or
an implicit range of directories that should be checked. In the simplest case, you can manually specify the directory that should
be checked. In order to do that set the directory selector to 'Directory' and enter the full path to the directory that should
be checked.
In practice, a typical PC or a storage server may contain many thousands of directories making manual directory selection almost
unusable. In order to simplify the directory selection process, FlexTk provides two implicit directory selection rules. The first
one, named 'For Each Input Directory' will apply the specified condition to all directories that were specified as inputs for the
storage utilization analysis command and execute the user-defined action for each input directory matching the user-specified
condition.
The second directory selection rule, named 'For Each Top-Most Directory Under', will apply the specified condition to all top-most
directories in the entered file system location and execute the user-defined action for each directory matching the user-specified
condition. For example, if you have a large number of users' home directories in 'K:\home', you can select this rule and enter
'K:\home' in the location entry to evaluate the specified condition for all home directories and execute the user-defined action
for each home directory matching the specifying condition.
The condition selector provides the ability to check the total amount of data, the total number of files, the absolute amount of
free space and the amount of free space in percents. For our specific example command, set the condition selector to
- 'Having More Than 1 GBytes of Data'. Due to the fact that we have defined file matching rules limiting the analysis
command to documents only, the condition will evaluate the total size of all document files in all input directories including
all subdirectories.
The action selector provides the user with the ability to send HTML notifications, send text notifications, execute FlexTk's
user-defined commands, execute custom user commands and save storage analysis reports. For our example storage utilization
analysis command, set the action selector to 'Send HTML Notification To', enter a destination e-mail address, press the 'Ok'
button and save the newly created storage utilization analysis command. That's all. You have finished creating a custom storage
analysis command, which will detect directories containing more than 1 GB of 6-months-old documents and send e-mail notifications
to the specified e-mail address.
By default, FlexTk sets the storage utilization analysis actions mode to the 'Preview' mode. In the 'Preview' mode, FlexTk will
evaluate all the specified conditions and inform the user about all the triggered user-defined actions allowing one to review
actions that will be executed and verify proper operation of the storage utilization analysis command. So, let's test our newly
created command and see if our custom command properly evaluates the specified condition and executes the user-defined action.
In order to start the newly created command, just click on the command item in the user-defined commands tool pane. After finishing
scanning all the specified input directories, FlexTk will display the storage analysis results dialog showing all the directories
and files sorted by the amount of used storage space. If there are triggered user-defined actions, the main status label will
show the number of triggered actions and the 'Actions' button will be enabled. Press the 'Actions' button to see the actions
preview dialog.
The actions preview dialog shows all triggered user-defined actions. Depending on the directory selection mode, each conditional
action may be triggered multiple times, once for each directory matching the specified condition. In order to execute one or more
actions, select all the required actions and press the 'Execute' button. The preview mode is very useful for testing purposes,
but for automatic and fully unattended operation one needs something else.
In order to enable automatic execution of actions, select the command in the user-defined commands tool pane, press the right mouse
button and select the 'Edit Command' menu item. Select the 'Actions' tab and set the actions mode to 'Execute'. In the 'Execute'
mode FlexTk will scan all the selected input directories, evaluate all the specified conditions and execute all the required actions
fully automatically without showing any storage analysis results.
There are three ways to execute the newly created storage utilization command: using FlexTk's main GUI application, using FlexTk's
desktop shortcuts or using FlexTk's command line tool. In order to execute the command in the main GUI application, just click on
the command item in the user-defined commands tool pane. Frequently used commands may be added to the desktop as direct shortcuts.
In order to create a shortcut for a user-defined command, select the command in the user-defined commands tool pane, press
the right mouse button and select the 'Create Desktop Shortcut' menu item. Just click on the created shortcut to execute the
command directly from your desktop.
The final way to execute the newly created user-defined command is to use FlexTk's command line tool. The command line tool is
located in the '\bin' directory.
Open a terminal window, enter the directory and type the following command:
flextk -execute "Command Name"
When used in the command line mode, FlexTk quietly executes all the required actions without showing any windows or dialogs
thus allowing one to setup fully unattended, periodically scheduled storage utilization analysis operations.
For detailed information about FlexTk's user-defined commands refer to the
User-Defined Commands page.