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

# Monitoring

> Know that everything runs, and hear about it when it stops.

## The diagnostic command

```bash theme={null}
php artisan lekalao:diagnose
```

```
  OK   Scheduler: Running.
  OK   Queues: 12 jobs are waiting.
 WARN  Failed jobs: 3 jobs failed.
       Read them in Horizon, then `php artisan queue:retry all`.
  OK   Mailers: 2 ready.
  OK   Campaigns: Nothing stuck.

Subscribers: 48213
Campaign e-mails: 912440
…
```

| Check       | Fails when                                                        |
| ----------- | ----------------------------------------------------------------- |
| Scheduler   | It has never run, or not for more than 5 minutes.                 |
| Queues      | Redis cannot be reached. A warning when many jobs are waiting.    |
| Failed jobs | A warning as soon as there is one.                                |
| Mailers     | None is configured. A warning when some have not been tested.     |
| Campaigns   | A warning when a campaign has been sending for more than 6 hours. |

The command **exits with an error** (code 1) as soon as one check fails; warnings do not change the code. Wire it into your monitoring:

```cron theme={null}
*/5 * * * * cd /var/www/lekalao && php artisan lekalao:diagnose > /dev/null || curl -fsS https://hc-ping.com/<uuid>/fail
```

The same thing is visible in **Settings → Maintenance**.

## HTTP probes

| Address   | Answers                                                |
| --------- | ------------------------------------------------------ |
| `GET /up` | `200` when the application boots. For a load balancer. |

`/up` checks neither Horizon nor the cron line: pair it with `lekalao:diagnose`.

## Horizon

`/horizon` (platform administrators) shows the queues live, the throughput, the slow jobs and the failed ones. A failed job is retried from there, or with:

```bash theme={null}
php artisan queue:retry all
```

## Logs

Laravel writes to `storage/logs/laravel.log`. In production:

```dotenv .env theme={null}
LOG_CHANNEL=daily
LOG_LEVEL=warning
```

Worth watching in particular: rendering errors (MJML, templates), refusals from providers, and errors from the SMTP relay.

## What warns the teams

Lekalao tells the teams about what concerns them, with nothing for the administrator to do:

* a campaign **paused** by sending safety;
* the **summary of a campaign** after it went out;
* the **weekly summary** of every list that asks for one.

A domain whose DNS is no longer right, or a webhook endpoint switched off, show up in the interface, without an e-mail.
