The sftp_file_check.cs script performs connection to an FTP server, logging in, monitoring of specified file and generates alerts if preset requirements are not met.

Custom Script File Arguments Arguments Example
sftp_file_check.cs

“<FTP URL>” <list of file parameters to monitor>

Generates alerts if any files with timestamps older than 15 minutes are detected:

“sftp://localuser:password1@webclient.compass-analytics.com/doc/accounting/Export3a.csv” “size_max:4096” “age:15”

FTP URL corresponds to the specification of URL formats, RFC 1738

ftp://user:password@host:port/path

Some or all of the parts user:password@:password:port and /path may be omitted.

To monitor a particular file, specify a full path to the file and use the following parameters:

  • “size_min:<long>” – minimum file size in byte.
  • “size_max:<long>” – maximum file size in byte.
  • “download_file:<bool> – boolean value, case sensitive. If set to true, the script will attempt to download a file. The ErrorCodes.Validation.FileSizeExceeds error will be returned if the file size exceeds the limit of 2097152 bytes.
  • “age:<long> – age threshold in minutes. If a file is older than specified in the parameter, an alert is generated.
  • “timezone_bias:<long>” – the time offset between monitoring agent and an FTP server in hours, can be negative. Use to calculate the “age” parameter correctly.

If the specified file is not found, an error alert is generated.