# shxrk-monitor — FiveM Push Resource

Drop-in FiveM server resource that pushes live metrics to your Uptriva
game-server monitor (player count, server FPS, map, hostname, and per-resource
states).

## Requirements

- A game-server monitor in the Uptriva dashboard with query method `push`
- The monitor's push key (shown once at creation — regenerate it in the monitor
  settings if lost)

## Install

1. Copy the `shxrk-monitor` folder into your server's `resources/` directory.
2. Add to your `server.cfg`:

   ```
   ensure shxrk-monitor
   set shxrk_push_key "YOUR_PUSH_KEY"
   ```

   Optional tuning:

   ```
   set shxrk_push_interval "60"
   set shxrk_push_endpoint "https://api.shxrk.systems/api/v1/uptime/game-server/push"
   ```

3. Restart the server (or `refresh` + `ensure shxrk-monitor` in the console).

The first push is sent ~15 seconds after start so `sv_maxclients`, `mapname`
and `sv_hostname` are fully loaded. The monitor flips to **up** on the first
successful push and to **down** when pushes stop.

## What gets sent

| Field | Source |
|---|---|
| `player_count` | `GetNumPlayerIndices()` |
| `max_players` | `sv_maxclients` |
| `fps` | average server tick duration |
| `map_name` | `mapname` convar |
| `server_name` | `sv_hostname` convar |
| `resources` | every resource name + `GetResourceState()` |

Resource states let you alert when critical resources (e.g. `es_extended`,
`ox_inventory`) leave the `started` state.

## Security

- Treat the push key like a password — it identifies your monitor. Anyone with
  it can push metrics to it.
- Keep `shxrk_push_key` out of publicly shared `server.cfg` copies and repos.
- Regenerate the key in the dashboard if it ever leaks.
- `shxrk_push_interval` below 15 seconds is clamped to 15s.
