# Uptime

### Overview

The **Uptime Component** periodically checks if a site is up or down. It sends a message when the site's availability status changes (i.e., the site goes from up to down or vice versa).

### Usage

#### Input Parameters

| Parameter | Type     | Description                                                                       |
| --------- | -------- | --------------------------------------------------------------------------------- |
| `target`  | `string` | The URL of the site to check for uptime. Must start with `http://` or `https://`. |

#### Output Ports

| Port   | Description                                                                                           |
| ------ | ----------------------------------------------------------------------------------------------------- |
| `up`   | Triggered when the site becomes available. Returns the target URL, status code, and downtime details. |
| `down` | Triggered when the site becomes unavailable. Returns the target URL and status code.                  |

### Instructions

1. **Set the Target URL**
   * Provide a valid URL in the `target` field.
2. **Monitoring Behavior**
   * The component periodically checks the status of the target site.
   * If the site is down, it triggers the `down` port.
   * When the site comes back up, it triggers the `up` port with downtime duration details.
3. **Ensure Proper Protocol**
   * Only URLs with `http://` or `https://` are allowed.

### Notes

* **Status Codes Handling:**
  * A `5xx` response is considered a **down** status.
  * Successful responses indicate the site is **up**.
* **State Persistence:**
  * The component remembers the last known state of the site to detect status changes.
* **Time Tracking:**
  * When a site goes down, the downtime duration is recorded and sent once it comes back up.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/http/uptime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
