CrushMFT Documentation

Prometheus metrics#

Metrics are numbers about the server, published at an address where a monitoring system fetches them every few seconds: how many sessions, how many logins and failures, how much memory, how long the queues. The monitoring system keeps them, draws them over time, and raises an alarm on them.

CrushMFT 27 publishes them in the format of Prometheus, which most monitoring systems read: Prometheus itself, Grafana Agent, Datadog, Zabbix, VictoriaMetrics, the OpenTelemetry collector.

Metrics need an Enterprise licence. They are switched on in Preferences, Logging, Metrics.

Switching them on#

Setting Is Unless you change it
Publish Prometheus metrics the switch off
Path where they are read, on every HTTP and HTTPS port of the server /metrics
Bearer token a secret the reader must send. Generate makes one. empty
Allowed IPs the addresses that may read, with commas, * for any part empty

One of the last two must be set. With neither, the address refuses everybody: "Set a token or allowed IPs for metrics in Preferences, Logging, Metrics." Metrics are never open by accident. With both set, a reader must pass both.

The metrics are answered before any login: the reader needs no user of the server.

Reading them#

curl -H "Authorization: Bearer <token>" https://files.example.com/metrics

On a test server with its own address allowed, the answer was 189 lines in 57 families, beginning:

# HELP crushmft_build_info Server version and runtime; the value is always 1.
# TYPE crushmft_build_info gauge
crushmft_build_info{app="crushftp",version="27.0.0_0",java_version="27",os="Mac OS X"} 1
…
crushmft_sessions_active 4
crushmft_server_logins_successful_total 106
crushmft_server_logins_failed_total 25
crushmft_threads_busy 8
crushmft_memory_used_bytes 59464584
crushmft_health_ok{check="overall"} 1
crushmft_health_ok{check="job_engine"} 1
crushmft_listener_up{type="SFTP",ip="127.0.0.1",port="12222",name=""} 1

For Prometheus, a job in its configuration:

scrape_configs:
  - job_name: crushftp
    scheme: https
    metrics_path: /metrics
    authorization:
      credentials: <token>
    static_configs:
      - targets: ["files.example.com:443"]

A reader that cannot send a bearer token can send the token as the password of HTTP Basic sign-in, with any user name.

Answer Means
200 the metrics
401 "A valid metrics token is required." no token, or a wrong one
403 "Not allowed from this IP." the reader's address is not on the list
403 "Set a token or allowed IPs …" neither is set
403 "Prometheus metrics need an Enterprise license."
401 "Unauthorized", from the server's ordinary login handling metrics are off, or the path is another

What there is#

About Metrics, all beginning crushftp_
the server itself build_info, start_time_seconds, enterprise_license, dmz_mode, logins_allowed
who is connected sessions_active, connected_unique_ips, listener_connections per port
logins logins_total by protocol and outcome, logouts_total, server_logins_successful_total, server_logins_failed_total
transfers transfers_in_progress, transfer_speed_kilobytes_per_second, file operations and bytes by protocol, server_sent_bytes_total, server_received_bytes_total, server_uploaded_files_total, server_downloaded_files_total
security bans by reason, kicks, alerts by type, SNMP traps sent, admin changes, password changes
the listeners listener_up per port: 1 when it runs; listener_connections_total
health health_ok per check: overall, job_engine, replication, serverbeat. A check that is not in use is left out.
resources threads_busy, threads_max, memory_used_bytes, memory_max_bytes, memory_pending_bytes, open_files, open_files_max, server_cpu_percent, os_cpu_percent, cpu_cores, disk_free_bytes
jobs tasks_running, event_threads_running, job_engine_memory_used_bytes, job_engine_memory_max_bytes, job_engine_cpu_percent
logging log_lines_queued; per log target log_target_records_total (sent or dropped), log_target_queued, log_target_error
a cluster replication_peers, replication_pending, replication_queue
the Java runtime jvm_memory_…, jvm_gc_collection_seconds, jvm_threads_…, jvm_classes_currently_loaded, process_cpu_seconds_total, process_open_fds, process_max_fds

Each family comes with a line of explanation (# HELP), so the answer documents itself. The whole list: Metrics.

crushmft_disk_free_bytes reports the disk of the log folder and every drive that a Disk Space alert watches.

What to put an alarm on#

Alarm when Means
the address does not answer the server is down, or cut off
crushmft_health_ok{check="overall"} == 0 a part of the server is impaired
crushmft_listener_up == 0 a port is down
crushmft_threads_busy near crushmft_threads_max the server is running out of workers
crushmft_memory_used_bytes staying near crushmft_memory_max_bytes too little memory for the load
crushmft_open_files near crushmft_open_files_max the system's limit of open files is too low
crushmft_disk_free_bytes low
the rate of crushmft_server_logins_failed_total jumping an attack, or a partner with an old password
crushmft_log_target_error == 1, or dropped records rising your SIEM is not getting its events
crushmft_job_engine_memory_used_bytes near its maximum jobs need more room: see How an engine stays healthy
crushmft_logins_allowed == 0 for long somebody stopped logins and forgot

Things to know#

  • A counter appears once it has counted something. A server on which nobody was banned since metrics were switched on has no line for bans yet.
  • Counters count from when metrics were switched on, and start at zero again with each start of the server. The few that are "kept across restarts" say so in their explanation. Prometheus handles a counter that starts again; use rate() on counters, not their raw value.
  • No names in labels. Metrics are labelled by protocol, outcome, port and the like. There are no user names, file paths or client addresses in them, on purpose: metrics are numbers about the server, and who did what is in the log and the reports.
  • Every server of a cluster publishes its own. Fetch each server directly, not through the load balancer, or you get a different server each time.
  • Behind a reverse proxy, decide whether the path should be reachable from outside at all. Usually not: block /metrics at the proxy and let the monitoring fetch from inside.
  • The token is stored encrypted. Change it with Generate and Save; the old one stops working at once.
  • The same text for an admin: an administrator's session can read the metrics through the admin interface without the token, to look at them.
  • Without Prometheus: a variable watcher alerts on single values from inside the server, and the Reports app's Server health report shows a minute-by-minute history of the main ones.