FileWatcher Monitoring Extension

Use Case

An AppDynamics extension to be used with a stand-alone Java machine agent to provide metrics from file modification.

The extension can be configured with various comibinations of patterns to include/exclude files and directories.

Prerequisites

This extension requires a AppDynamics Java Machine Agent installed and running.

Installation

1. Unzip contents of AppDynamics-File-Watcher-Extension-.zip file and copy to /monitors directory.

2. Edit the config.yml file. An example config.yml file follows these installation instructions.

3. Restart the Machine Agent.

Metrics Provided

We provide following metric related to modification of a file.

- IsModified: 1 if file is modified in last minute and 0 if not.

- Size: A positive integer indicating the current size of the file.

-FileCount: Count of files in a directory.

-OldestFileAge: Time in seconds from current time to the oldest modified file of the directory

Configuration

Note-

Please make sure to not use tab (\t) while editing yaml files. You may want to validate the yaml file using a yaml validator http://yamllint.com/

 

1. Configure the file to be watched by editing the config.yaml file in `<MACHINE_AGENT_HOME>/monitors/AppDynamics-File-Watcher-Extension/`. Below is the format

 

Important - displayName has to be unique for the file or folder

 

# For most purposes, no need to change this
numberOfThreads: 5

#This will create it in specific Tier. Replace <TIER_ID>. Please make sure to have a trailing |
metricPrefix: "Server|Component:<TIER_ID>|Custom Metrics|FileWatcher|"


fileToProcess:
# List of file Paths
# Wildcards supported for field 'path' : "**" and "*".
# The following use cases are covered :

# 1. Match only files and no directories. Eg. : /foo/bar/A*.java | It will match all java files starting with capital A letter inside bar directory of root directory foo.

# 2. All files and all directories. Eg : /foo/bar/** | It will match all files and directories recursively(hunt down sub-directories) present inside bar directory of foo directory and add them all to monitoring.

# 3. All files and directories non recusrsively. Eg : /foo/bar/* | It will match all files and directories present inside bar. It will not drill down another level from there.
# 4. Only directories, no files inside them. Use isDirectoryDetailsRequired flag and set it to 'false'. This will make the monitor skip files for this path. Eg : /foo/bar/* , /foo/bar/**

# The above convention is very similar to ant-style conventions for defining directory tasks. For more info : http://ant.apache.org/manual/dirtasks.html#patterns

- displayName: "test1"
path: "/Users/deepak.kalra/Documents/appdynamics-docs/**"
ignoreHiddenFiles: false
isDirectoryDetailsRequired: true

#ignoreHiddenFiles : When true, this will cause all hidden files under this file path to be ignored from metric reporting
#isDirectoryDetailsRequired : When false, this will cause only directory details to be considered and files to be ignored from metric reporting
ignoreHiddenFiles: false
#Important - displayName has to be unique for the file/folder

- displayName: "test2"
path : "/Users/deepak.kalra/Documents/test/**"
ignoreHiddenFiles: false
isDirectoryDetailsRequired: true

- displayName: "test3"
path : "/Users/deepak.kalra/Desktop/https___www.myutiitsl.pdf"
ignoreHiddenFiles: false
isDirectoryDetailsRequired: true

#For windows based searching regexes the paths should be like :

- displayName: "test4"
path : "F:\\\\Users\\\\deepak.kalra\\\\Documents\\\\test\\\\**"
ignoreHiddenFiles: false
isDirectoryDetailsRequired: true

# This is the global isDirectoryDetailsRequired flag. When an individual fileToProcess path has this flag missing, this global one will be used.
# If false then all the files under the directory will be ignored and only the directory level metrics will be published
# for the directories specified above.
# For files given above it will have no effect
isDirectoryDetailsRequired: false
# If true then an extra metric will be shown that will give age of the oldest file (in seconds when the file was last
# modified and compared to current time) in the directory(ies) specified above.
# For files given above it will not display this metric
isOldestFileAgeMetricRequired: true
# If true then an extra metric will be shown that will give number of files in the directories specified above.
# For files given above it will not display this metric
isFileCountRequired: true
# This is the global ignoreHiddenFiles flag. When an individual fileToProcess path has this flag missing, this global one will be used.
# If true then all the hidden files will be ignored monitoring.
ignoreHiddenFiles: true

 

 FILEWATCHER METRIC BROWSER 

 1. File Watcher Snapshot For File Modified

IS_MODIFIED

 2. File Watcher Snapshot For Directory Size Change

Directory_Size_Change

 3. File Watcher Snapshot For Directory File Count Change

Count_Directory_Files

 4. File Watcher Snapshot For Directory Oldest File Age

Oldest_File_Age

Contributing

Always feel free to fork and contribute any changes directly via GitHub.

Support

For any support questions, please contact help@appdynamics.com.

Version:

2.0

Compatibility:

3.7+

Last Update:

05/03/2017