Policies used for monitoring AFM and AFM DR
You can monitor AFM and AFM DR using some policies and commands.
Following are the policies used for monitoring:
- The following file attributes are available through the policy engine:
Table 1. Attributes with their description Attribute Description P The file is managed by AFM and AFM DR. u The file is managed by AFM and AFM DR, and the file is fully cached. When a file originates at the home, it indicates that the entire file is copied from the home cluster. v A file or a soft link is newly created, but not copied to the home cluster. w The file has outstanding data updates. x A hard link is newly created, but not copied to the home cluster. y A file metadata was changed and the change not copied to the home cluster. z A file is local to the cache and is not queued at the home cluster. j A file is appended, but not copied to the home cluster. This attribute also indicates complete directories. k All files and directories that are not orphan and are repaired. - A list of dirty files in the cache cluster:This is an example of a LIST policy that generates a list of files in the cache with pending changes that have not been copied to the home cluster.
If there are no outstanding updates, an output file is not created.RULE 'listall' list 'all-files' SHOW( varchar(kb_allocated) || ' ' || varchar(file_size) || ' ' || varchar(misc_attributes) || ' ' || fileset_name) WHERE REGEX(misc_attributes,'[P]') AND REGEX(misc_attributes,'[w|v|x|y|j]')
- A list of partially cached files:The following example is that of a LIST policy that generates a list of partially-cached files. If the file is in progress, partial caching is enabled or the home cluster becomes unavailable before the file is completely copied.
This list does not include files that are not cached. If partially-cached files do not exist, an output file is not createdRULE 'listall' list 'all-files' SHOW(varchar(kb_allocated) || ' ' || varchar(file_size) || ' ' || varchar(misc_attributes) || ' ' || fileset_name ) WHERE REGEX(misc_attributes,'[P]') AND NOT REGEX(misc_attributes,'[u]') AND kb_allocated > 0
- The custom eviction policy:The steps to use policies for AFM file eviction are - generate a list of files and run the eviction. This policy lists all the files that are managed by AFM are not accessed in the last seven days.
To limit the scope of the policy or to use it on different filesets run mmapplypolicy by using a directory path instead of a file system name. /usr/lpp/mmfs/bin/mmapplypolicy $path -f $localworkdir -s $localworkdir -P $sharedworkdir/${policy} -I deferRULE 'prefetch-list' LIST 'toevict' WHERE CURRENT_TIMESTAMP - ACCESS_TIME > INTERVAL '7' DAYS AND REGEX(misc_attributes,'[P]') /* only list AFM managed files */
Use mmafmctl to evict the files: mmafmctl datafs evict --list-file $localworkdir/list.evict
- A policy of uncached files:
- The following example is of a LIST policy that generates a list of uncached files in the cache directory:
RULE EXTERNAL LIST 'u_list' RULE 'u_Rule' LIST 'u_list' DIRECTORIES_PLUS FOR FILESET ('sw1') WHERE NOT REGEX(misc_attributes,'[u]')
- An example of a LIST policy that generates a list of files with size and attributes belonging to the cache fileset is as under - (cacheFset1 is the name of the cache fileset in the example.)
RULE 'all' LIST 'allfiles' FOR FILESET ('cacheFset1') SHOW( '/' || VARCHAR(kb_allocated) || '/' || varchar(file_size) || '/' || VARCHAR(BLOCKSIZE) || '/' || VARCHAR(MISC_ATTRIBUTES) )