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

# Uptime monitoring

> Give your window a Sentivel heartbeat and see whether your script is running, with no loop to write.

<a href="/rayfield-gen2/" className="rg2-banner">
  <span className="rg2-banner-mark" aria-hidden="true">
    <svg viewBox="0 0 322.75 322.75" fill="currentColor">
      <path d="M166.45,37.98l132.88,70.28,23.42,62.87-99.18-33.25c-14.38-4.82-25.82-15.89-31.12-30.11l-26-69.79Z" />

      <path d="M284.76,166.45l-70.28,132.88-62.87,23.42,33.25-99.18c4.82-14.38,15.89-25.82,30.11-31.12l69.79-26Z" />

      <path d="M156.3,284.76L23.42,214.48,0,151.61l99.18,33.25c14.38,4.82,25.82,15.89,31.12,30.11l26,69.79Z" />

      <path d="M37.99,156.3L108.27,23.42,171.14,0l-33.25,99.18c-4.82,14.38-15.89,25.82-30.11,31.12l-69.79,26Z" />
    </svg>
  </span>

  <span className="rg2-banner-copy">
    <span className="rg2-banner-title">
      Rayfield Gen2 is out
      <span className="rg2-banner-badge">New</span>
    </span>

    <span className="rg2-banner-sub">A ground-up rebuild — faster, undetectable by design, and actively developed. Use it for new scripts instead of Rayfield (2022).</span>
  </span>

  <span className="rg2-banner-cta">
    Read the Gen2 docs
    <span className="rg2-banner-arrow" aria-hidden="true">→</span>
  </span>
</a>

<a href="https://www.sentivel.com/?ref=sirius-docs" target="_blank" rel="noopener noreferrer" className="sv-banner">
  <span className="sv-banner-mark" aria-hidden="true">
    <svg viewBox="0 0 194.08 236.31" fill="currentColor">
      <path fillRule="evenodd" clipRule="evenodd" d="M181.21,89.15L137.69,99.7l21.82-14.53c15.69-10.45,26.19-27.08,28.88-45.73L194.08,0l0,0c-18.79,13.86-40.77,22.76-63.91,25.86L72.27,33.6c-23.32,3.12-44.43,16.31-56.32,36.62C6.1,87.06,2.64,107.65,7.91,128.02l1.04,4.01l48.67,5.2l0,0C30.7,143.2,10.28,165.2,6.34,192.49L0,236.31l0,0c28.49-17.35,60.53-28.03,93.73-31.26l25.54-2.48c29.96-2.91,56.12-22.72,65.53-51.32c4.42-13.44,5.16-28.26,1.36-42.96L181.21,89.15z M115.85,143l-23.2,6.02c-8.99,2.31-18.13-3.06-20.47-12.05l-5.99-23.2c-2.34-8.99,3.06-18.16,12.03-20.47l23.22-6.02c8.97-2.31,18.13,3.08,20.47,12.05l5.99,23.22C130.24,131.52,124.84,140.69,115.85,143z" />
    </svg>
  </span>

  <span className="sv-banner-copy">
    <span className="sv-banner-title">
      Sentivel
      <span className="sv-banner-badge">Endorsed by Rayfield</span>
    </span>

    <span className="sv-banner-sub">Status pages and uptime monitoring for whatever you ship. Free to start.</span>
  </span>

  <span className="sv-banner-cta">
    Take a look
    <span className="sv-banner-arrow" aria-hidden="true">→</span>
  </span>
</a>

Rayfield can report whether your script is running. Give your window a [Sentivel](https://www.sentivel.com/?ref=sirius-docs) heartbeat, and Rayfield pings it when the window opens and every five minutes while it stays open. While people are running your script, the monitor stays green. If a game update breaks the script or your loader goes down, the pings stop, Sentivel alerts you, and your status page can show it.

```lua theme={null}
local Window = Rayfield:CreateWindow({
   Name = "Example Hub",
   Heartbeat = "https://www.sentivel.com/api/heartbeat/<your token>",
})
```

That's all you need to add. Rayfield handles the timing, runs every ping in the background, and stops when Rayfield is destroyed. A failed ping never slows down or breaks your script.

## Set it up

<Steps>
  <Step title="Create a heartbeat monitor in Sentivel">
    Sign in to [Sentivel](https://www.sentivel.com/?ref=sirius-docs) (it's free to start), open **Monitors**, click **Add a monitor**, and choose **Heartbeat**.
  </Step>

  <Step title="Pick an interval">
    **Expected interval** is how often Sentivel expects a ping, and **Grace period** is the extra time it allows before counting the script as down. Rayfield pings every five minutes, so keep the defaults of **Every 5 minutes** and **1 minute**, or go longer. See [Quiet scripts](#quiet-scripts) before you settle on it.
  </Step>

  <Step title="Copy the ping URL">
    Sentivel gives the monitor a ping URL of the form `https://www.sentivel.com/api/heartbeat/<token>`. Copy the whole URL. Rayfield needs this link, not the monitor's ID.
  </Step>

  <Step title="Add it to your window">
    Pass the URL as `Heartbeat` in `CreateWindow`.

    ```lua theme={null}
    local Window = Rayfield:CreateWindow({
       Name = "Example Hub",
       Heartbeat = "https://www.sentivel.com/api/heartbeat/<your token>",
    })
    ```
  </Step>
</Steps>

<Tip>
  Add the monitor to a [Sentivel status page](https://docs.sentivel.com/guides/status-pages) and link it from your Discord. Players can check whether the script is working before they ask.
</Tip>

## Quiet scripts

A heartbeat can't tell the difference between a script that broke and a script that nobody has open. When no one is running your script, the pings stop just as they would after a failure.

Set the interval to match your traffic:

* **Someone almost always has it open:** **Every 5 minutes**. You find out about problems within minutes.
* **It has quiet stretches:** set the interval to the longest you would expect to go with nobody running it, such as **Every 6 hours** for a quiet night. You'll hear about a problem more slowly, but a quiet night won't show as an outage.

## What to expect

* **Pings last as long as Rayfield.** You get one ping when the window opens, after the key system if you use one, then one every five minutes. They stop when you call [`Rayfield:Destroy()`](/rayfield/windows#destroy-the-interface) or the script is run again.
* **Studio is skipped.** Playtests aren't real runs, so no ping is sent there. The link is still checked, so a typo shows up while you are building.
* **A bad link warns.** If the link isn't a Sentivel ping URL, Rayfield prints a warning saying what to paste instead and sends nothing. The full URL and the bare token both work, and stray spaces from a paste are fine.
* **An unknown heartbeat stops.** If Sentivel keeps saying the heartbeat doesn't exist, for example because you deleted the monitor or regenerated its URL, Rayfield prints a warning and stops pinging.
* **Only Sentivel.** `Heartbeat` refuses any other host, so it can't be used to make other requests.

<Note>
  [Secure mode](/rayfield/secure-mode) silences Rayfield's console output, including these warnings. Before you ship, run the script once without secure mode and check that the monitor's page says **First ping received**.
</Note>

<Accordion title="Can someone fake my pings?">
  The ping URL ships inside your script, so anyone who reads the script can use it. Treat the monitor as a signal that people are running your script, not as proof. If the URL is being misused, click **Regenerate** next to it on the monitor's page and ship the new one.
</Accordion>

## Reference

<ResponseField name="Heartbeat" type="string">
  A `CreateWindow` setting. The monitor's ping URL, or just its token. Optional.
</ResponseField>

<Card title="Sentivel monitors" icon="activity" href="https://docs.sentivel.com/guides/monitors">
  Monitor types, thresholds, and maintenance.
</Card>
