> ## Documentation Index
> Fetch the complete documentation index at: https://docs.termique.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring

> Track CPU, RAM, and disk usage on your hosts, and get alerted when a threshold is crossed.

Termique can install a lightweight agent on your Linux server to report CPU, RAM, and disk usage back to your account. Metrics update every 30 seconds. You can set alert rules to get notified when usage crosses a threshold, or when a server stops reporting entirely.

## Install the agent

1. Open a host's detail view and find the **Monitoring** section.
2. Click **Generate token**.
3. Review what the agent collects, then click **Agree & continue**. Termique generates a one-time install command.
4. Run the command on your server:
   * Click **Run on `<host>`** to execute it automatically over an open SSH session, or
   * Copy the command and run it manually over your own connection.

<Note>
  The agent token is shown once. Expand **Manual setup** to show the token before closing the dialog if you need it, or generate a new one later.
</Note>

The agent connects within about 30 seconds. Once it checks in, the Monitoring section confirms the agent is connected and shows live CPU, RAM, and disk tiles for that host.

## What the agent collects

* CPU, RAM, and disk usage, every 30 seconds.
* Nothing else: no file contents, command output, or credentials.
* The agent only sends data outward. It never accepts inbound connections.

The install script writes a config file holding an opaque token at `~/.config/termique-agent/config.toml` (`chmod 600`) and registers a systemd service.

## Config file

Most settings are covered elsewhere in this page and set through the app. To edit `config.toml` directly, for example on a server you manage over a plain SSH session:

| Field                            | Default                        | Description                                                                                |
| -------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------ |
| `token`                          | -                              | Set automatically by the install command. Don't edit by hand.                              |
| `server_id`                      | -                              | Set automatically by the install command. Don't edit by hand.                              |
| `api_url`                        | `https://monitor.termique.app` | Where the agent reports. Change this only if you're self-hosting the Termique API backend. |
| `interval`                       | `30`                           | Seconds between metric reports.                                                            |
| `debug`                          | `false`                        | Verbose logging, for troubleshooting.                                                      |
| `auto_update`                    | `true`                         | See [Automatic updates](#automatic-updates).                                               |
| `security_events_enabled`        | `false`                        | See [Security events](#security-events).                                                   |
| `reverse_proxy_log_path`         | -                              | See [Security events](#security-events).                                                   |
| `security_events_flush_interval` | `120`                          | Seconds between security-event batch sends.                                                |
| `security_events_max_batch`      | `200`                          | Maximum events sent per batch. Extra events in the same window are dropped, not queued.    |

After editing, restart the agent to apply changes:

```bash theme={null}
sudo systemctl restart termique-agent
```

<Warning>
  Reinstalling generates a fresh `config.toml` and overwrites any manual edits. Use **Automatic updates** (below) for routine version updates, not a fresh reinstall.
</Warning>

## Security events

Optional, off by default. When enabled, the agent watches for a fixed set of security-relevant patterns and reports them as structured events, never raw log contents:

* Failed and successful SSH logins.
* `fail2ban` bans and unbans, if `fail2ban` is installed.
* HTTP error-rate spikes: many 4xx/5xx responses from one IP within a minute.
* HTTP path-targeted brute force: many requests to the same URL from one IP within a minute, regardless of response status. This catches login-form brute force, which usually returns `200` for every attempt rather than an error.

Security events power [Incident investigation](/incident-investigation). They are not shown as a standalone log in the app.

### Enable it

Turn on **Enable security event capture** when generating the install command. To also detect HTTP brute force, set **Reverse-proxy log path** to your web server's access log, for example `/var/log/nginx/access.log`.

On an agent that's already installed, add the fields directly to `config.toml` instead: see [Config file](#config-file) above.

### Retention

Captured events are batched and sent every 2 minutes. Events are kept for 14 days on Free, 90 days on Pro.

## View metrics

* **Host detail**: the Monitoring section on a host shows live CPU/RAM/disk tiles, color-coded (green under 70%, amber 70–89%, red 90%+).
* **Monitoring page**: lists every paired server, online servers first, each with a one-hour trend sparkline per metric. Click a server to see its full metrics history.

A server counts as online if it has reported within the last 2 minutes.

<Frame>
  <img src="https://mintcdn.com/termique/YQ5DIIiD1qCX4qrg/images/monitoring.png?fit=max&auto=format&n=YQ5DIIiD1qCX4qrg&q=85&s=10748bebdae091fd66715ccaaffc810d" alt="Monitoring page listing paired servers with live CPU, RAM, and disk sparklines" width="3136" height="2080" data-path="images/monitoring.png" />
</Frame>

Click a server to see its full history, live values, and system details (IP, OS, memory, disk, uptime):

<Frame>
  <img src="https://mintcdn.com/termique/YQ5DIIiD1qCX4qrg/images/monitoring-detail.png?fit=max&auto=format&n=YQ5DIIiD1qCX4qrg&q=85&s=050133540db354df30c6efdf0f40b5ad" alt="Server monitoring detail page showing CPU history chart and live CPU, RAM, disk gauges" width="3136" height="2080" data-path="images/monitoring-detail.png" />
</Frame>

## Alert rules

Add an alert rule to get notified when a server crosses a threshold:

| Field     | Options                                                                       |
| --------- | ----------------------------------------------------------------------------- |
| Metric    | CPU, RAM, Disk, or Offline                                                    |
| Threshold | 1–99% (not applicable to Offline, which fires after 2 minutes with no report) |
| Cooldown  | 5 min – 24 h: minimum time between repeat alerts for the same rule            |
| Enabled   | On/off toggle                                                                 |

Each server can have up to 20 alert rules. Manage rules from the host's Monitoring section on desktop, or from a paired server's **Alerts** screen on mobile.

## Notifications

Desktop shows alerts only while Termique is running. The mobile app receives push notifications for alerts even when the desktop app is closed. Tapping one opens the alert rules screen for that server.

<Note>
  Background push notifications (alerts delivered while the desktop app is closed) require a Pro subscription.
</Note>

## Automatic updates

The agent checks for a new version once a day and updates only if one is available. If it's already on the latest version, nothing happens: no reinstall, no restart.

If an update fails to start correctly, the agent restores the previous version and restarts automatically. No manual recovery is needed.

To skip automatic updates:

* At install time, set `TERMIQUE_AUTO_UPDATE=false` before running the install command.
* On an agent that's already installed, add `auto_update = false` to `~/.config/termique-agent/config.toml`. This takes effect on the next daily check, no restart required.

<Note>
  Opting out means the agent stays on its currently installed version until you update it yourself by reinstalling.
</Note>

## Revoke or reinstall

* **Revoke**: stops the agent from reporting within 30 seconds. The agent keeps running on the server until you remove it. Uninstall with:

  ```bash theme={null}
  curl -fsSL https://get.termique.app/uninstall | sh
  ```

* **Reinstall**: revokes the current token and generates a new one, skipping the terms review since you've already agreed once.

## Data retention

Raw metrics are kept for 24 hours. Rolled-up history (5-minute, hourly, and daily aggregates) is kept longer on Pro accounts than on Free.

## Shared servers

If a host was shared with you and the owner installed the monitoring agent, you can view its metrics but not manage its alert rules or revoke its token. See [Sharing](/sharing).
