File Metrics
File.Content(path)
First line of file content (max 255 characters). Requires master server session.
Data Type |
String |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.LineCount(path)
Number of lines in file.
Data Type |
Unsigned Integer 64 |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Size(path)
File size in bytes.
When path is a directory, returns the total size of matching files in it; recursion into subdirectories is controlled by the recursive argument (see File Count and Size Filtering).
Data Type |
Unsigned Integer 64 |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path (or directory path when used with filters, see File Count and Size Filtering) |
File.Type(path)
File type identifier.
Data Type |
Unsigned Integer |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
| Value | Description |
|---|---|
0 |
Does not exist |
1 |
Directory |
2 |
Device |
3 |
Regular file |
4 |
Other |
File.Count(path, pattern, recursive, size, age)
Number of files matching criteria. See File Count and Size Filtering for argument details.
Data Type |
Unsigned Integer |
Platforms |
All |
File.FolderCount(path, pattern, recursive, size, age)
Number of subdirectories matching criteria. See File Count and Size Filtering for argument details.
Data Type |
Unsigned Integer |
Platforms |
All |
File.Time.Access(path)
Last access time (seconds since epoch).
Data Type |
Unsigned Integer 64 |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Time.Change(path)
Last metadata change time (seconds since epoch).
Data Type |
Unsigned Integer 64 |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Time.Modify(path)
Last modification time (seconds since epoch).
Data Type |
Unsigned Integer 64 |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Hash.CRC32(path)
CRC32 checksum.
Data Type |
Unsigned Integer |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Hash.MD5(path)
MD5 hash digest.
Data Type |
String |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Hash.SHA1(path)
SHA-1 hash digest.
Data Type |
String |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File.Hash.SHA256(path)
SHA-256 hash digest.
Data Type |
String |
Platforms |
All |
| Argument | Type | Description |
|---|---|---|
path |
String |
File path |
File Count and Size Filtering
The File.Count, File.Size, and File.FolderCount metrics share the same 5-argument signature for filtering files:
File.Count(path, pattern, recursive, size, age)
| Argument | Description |
|---|---|
|
Directory path to search (required) |
|
File name glob pattern (e.g., |
|
Search subdirectories: |
|
Size filter in bytes. Positive value: only files larger than this size. Negative value: only files smaller than abs(value). |
|
Age filter in seconds. Positive value: only files older than this many seconds. Negative value: only files newer than abs(value) seconds. |
The age parameter uses sign convention: positive = "older than N seconds" (modified before now - N), negative = "newer than N seconds" (modified within the last N seconds). For example, -1800 means files modified within the last 30 minutes.
|
Path Macro Support
The following macros are supported in path and pattern arguments for all File.* parameters:
-
Environment variables as
{ENV_VAR_NAME} -
strftime(3C) macros for date/time substitution
-
Text inside backtick (`) characters is executed as a command and the first line of output is used (requires the requesting server to be listed in
MasterServersin agent configuration)
File.Count(/var/spool/myapp) File.Count(/data/incoming,*.xml,0,1048576) File.Count(/var/spool/queue,*,0,0,3600) File.Count(/var/spool/queue,*,1,0,-1800) File.Count(/var/log,!*.log,0) File.Size(/var/log/app.log)