Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ In SWAG docker arguments, set an environment variable `DOCKER_MODS=linuxserver/m

Add additional environment variables to the SWAG docker image:

| Name | Required | Example | Description |
| ---------------------- | -------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UPTIME_KUMA_URL` | Yes | `http://uptime-kuma:3001/` | The URL to the Uptime Kuma instance. Please note this cannot be the domain that it configured by SWAG as during initialization phase of the container those domains are not yet available. Instead use the docker container name. |
| `UPTIME_KUMA_USERNAME` | Yes | `admin` | Your Uptime Kuma username |
| `UPTIME_KUMA_PASSWORD` | Yes | `password` | Your Uptime Kuma password |
| Name | Required | Default | Example | Description |
| ------------------------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UPTIME_KUMA_URL` | Yes | | `http://uptime-kuma:3001/` | The URL to the Uptime Kuma instance. Please note this cannot be the domain that it configured by SWAG as during initialization phase of the container those domains are not yet available. Instead use the docker container name. |
| `UPTIME_KUMA_USERNAME` | Yes | | `admin` | Your Uptime Kuma username |
| `UPTIME_KUMA_PASSWORD` | Yes | | `password` | Your Uptime Kuma password |
| `UPTIME_KUMA_API_VERSION` | No | `1` | `2` | Set to `2` if using Uptime Kuma v2.x. Defaults to `1` for backwards compatibility with Uptime Kuma v1.x. |

Unfortunately Uptime Kuma does not provide API keys for it's Socket.io API at the moment and Username/Password have to be used.

Expand All @@ -28,7 +29,7 @@ Finally, add `swag.uptime-kuma.enabled=true` label at minimum to each of your co

## Labels

This mod is utilizing the wonderful [Uptime Kuma API](https://github.com/lucasheld/uptime-kuma-api) library. It allows you configure nearly every property of the Monitors by defining Docker Labels. For detailed documentation of each of these properties please refer to the `add_monitor` endpoint in the [official documentation](https://uptime-kuma-api.readthedocs.io/en/latest/api.html#uptime_kuma_api.UptimeKumaApi.add_monitor).
This mod utilizes the [Uptime Kuma API](https://github.com/lucasheld/uptime-kuma-api) library (v1) or [Uptime Kuma API v2](https://github.com/exaland/uptime-kuma-api-v2) library (v2) depending on your `UPTIME_KUMA_API_VERSION` setting. It allows you to configure nearly every property of the Monitors by defining Docker Labels. For detailed documentation of each of these properties please refer to the `add_monitor` endpoint in the [API documentation](https://uptime-kuma-api.readthedocs.io/en/latest/api.html#uptime_kuma_api.UptimeKumaApi.add_monitor).

| Label | Default Value | Example Value | Description |
| -------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,28 @@

echo "[mod-auto-uptime-kuma] Installing SWAG auto-uptime-kuma packages"

if ! pip list 2>&1 | grep -q "uptime-kuma-api\|docker"; then
# Default to v1 for backwards compatibility
UPTIME_KUMA_API_VERSION="${UPTIME_KUMA_API_VERSION:-1}"

# Validate version and warn on invalid values
if [[ "$UPTIME_KUMA_API_VERSION" != "1" && "$UPTIME_KUMA_API_VERSION" != "2" ]]; then
echo "[mod-auto-uptime-kuma] Warning: Invalid UPTIME_KUMA_API_VERSION '$UPTIME_KUMA_API_VERSION', defaulting to v1"
UPTIME_KUMA_API_VERSION="1"
fi

if [[ "$UPTIME_KUMA_API_VERSION" == "2" ]]; then
KUMA_PACKAGE="uptime-kuma-api-v2"
echo "[mod-auto-uptime-kuma] Using Uptime Kuma API v2 (for Uptime Kuma 2.x)"
else
KUMA_PACKAGE="uptime-kuma-api"
echo "[mod-auto-uptime-kuma] Using Uptime Kuma API v1 (for Uptime Kuma 1.x)"
fi

if ! pip list 2>&1 | grep -q "^${KUMA_PACKAGE} " || ! pip list 2>&1 | grep -q "^docker "; then
echo "\
docker \
uptime-kuma-api" >> /mod-pip-packages-to-install.list
echo "[mod-auto-uptime-kuma] Successfuly installed packages"
${KUMA_PACKAGE}" >> /mod-pip-packages-to-install.list
echo "[mod-auto-uptime-kuma] Packages added to install list"
else
echo "[mod-auto-uptime-kuma] Packages already installed, skipping..."
fi