# Self-check

URL: https://docs.vaultpanel.net/guides/servers/self-check

> Every five minutes the agent checks that the panel's features will work on its server, and shows the exact command that fixes a failure.

The self-check confirms that a server can do what the panel asks of it: the agent's root helper answers, its files are readable, the file manager starts, NGINX and Apache accept their configuration, certificates renew, the clock is right and no service has failed. It needs agent 0.39.0 or newer.

## Where to see it

The **Self-check** card on each server's **Overview** tab lists every check with its result, and a badge such as "6 of 7 passed". The agent runs the checks as root every 5 minutes and sends the report with its heartbeat; **Check now** runs them on demand.

Each check has one of four results:

| Result | Meaning |
| --- | --- |
| Error | Something the panel does fails now, or would fail at the next restart. The **Server self-check failed** alert fires. |
| Warning | Worth fixing; nothing fails yet. |
| OK | Nothing to do. |
| Info | Nothing to judge, for example no Let's Encrypt certificate yet. |

## The checks

| Check | How it is checked | When it fails | Fix |
| --- | --- | --- | --- |
| **Root helper** | Whether the agent's root helper answers | Error: no job, file request or terminal can run | `sudo systemctl restart vaultpanel-agent-helper` |
| **Agent privileges** | Which user the agent runs as | Warning: the agent runs as root, with the reason (for example `runAsRoot` is set) | See [How the agent runs](https://docs.vaultpanel.net/guides/servers/connecting-servers#how-the-agent-runs) |
| **Agent files** | `stat` of the agent's program (`/usr/local/bin/vaultpanel-agent`) and every folder above it, which everyone must be able to read and run | Error: some are for root only, so the agent's own user and the file manager, which runs the same program as each site's user, cannot start it | `sudo chmod -R u=rwX,go=rX /usr/local/bin/vaultpanel-agent` for the program, or `sudo chmod o+x` on the folder the card names, as shown on the card |
| **File manager** | Starts the file manager's worker as `nobody`, exactly as for a site, and asks it to answer | Error: the file manager fails for every website | The card shows the worker's own error message |
| **NGINX configuration** | `nginx -t` | Error: website changes cannot be applied, and NGINX would not start again after a restart | `sudo nginx -t` shows the failing line |
| **Apache configuration** | `apache2ctl -t`, when Apache is installed | Error, as for NGINX | `sudo apache2ctl -t` |
| **Certificate renewal** | Certbot's renewal timer and its last run, and the `vaultpanel-reload-nginx` deploy hook | Warning: the timer is missing, masked or stopped, its last run failed, or the hook is missing | `sudo systemctl enable --now certbot.timer`, or issue or renew a certificate from the panel |
| **Clock** | `timedatectl` reports whether the clock is synchronized | Warning: certificates, cron jobs and the agent's signed requests need the right time | `sudo timedatectl set-ntp true` |
| **Failed services** | `systemctl list-units --state=failed` | Warning: one or more systemd units failed (up to 20 named) | `systemctl --failed`, then `journalctl -u <unit>` for each |

> **Note:**
A missing or stopped Certbot timer is only a warning: the panel renews due certificates itself a day into their renewal window when Certbot does not. Issuing or renewing a certificate from the panel turns the timer back on and restores the reload hook.

## Alerts

The built-in **Server self-check failed** alert rule fires for each check that reports an error and stays failing for 10 minutes, longer than the 5 minutes between reports, so one bad read during a change does not alert anyone. Warnings never fire it. A report older than 30 minutes is not judged. Change the rule under **Monitoring > Alerts > Rules**; see [Monitoring and alerts](https://docs.vaultpanel.net/guides/servers/monitoring-and-alerts#alert-rules).

## Older agents

Agents before 0.39.0 do not send a self-check. The card then lists what newer agents check; update the agent from the server's **Overview** tab to see the results.
