This repo contains three scripts using the AMP API wrapper:
This toolset is intended for cluster-style game server fleets where one server is the template source and a marked group of destination servers should stay aligned with it.
sync_game_settings.pysyncs game settings from template to destination group servers.sync_game_schedules.pysyncs schedules/triggers/tasks from template to destination group servers.backup_retention.pylists backups on template and destination group servers.
- Name template with group marker:
... -TEMPLATE <GROUP>-- Example:
ARK Island -TEMPLATE ARK-
- Name destination servers with:
... -<GROUP>-- Example:
ARK Lost Colony -ARK-
- Purpose:
sync_game_settings.py: replicate game settings from template to destination group serverssync_game_schedules.py: replicate schedules/triggers/tasks from template to destination group servers
- Intended for ARK SA cluster setups; may work elsewhere, but verify manually.
- Run game settings sync:
./run-game-settings.sh --dry-run./run-game-settings.sh
- Run game schedule sync:
./run-game-schedules.sh --dry-run./run-game-schedules.sh
- Run backup retention cleanup:
./run-backup-retention.sh
Choose one:
- Copy files manually from this folder
- Copy these files to your target API folder:
sync_game_settings.pysync_game_schedules.pybackup_retention.pyrun-game-settings.shrun-game-schedules.shrun-backup-retention.shREADME.md
- Copy these files to your target API folder:
- Clone the repo directly
git clone <repo-url>cd <repo-folder>
sync_game_settings.pysync_game_schedules.pybackup_retention.py
Launchers:
./run-game-settings.sh./run-game-schedules.sh./run-backup-retention.sh./run-clear-old-backups-keep-latest.sh./run-zabbix-amp-status.sh
Template discovery and destination targeting are based on friendly name markers:
- Template must match:
-TEMPLATE <GROUP>- - Destinations must include:
-<GROUP>-
Example:
- Template:
Main Server -TEMPLATE PVE- - Destinations:
... -PVE-
Script: sync_game_settings.py
Run:
./run-game-settings.sh --dry-run
./run-game-settings.shWhat it does:
- Finds template from
-TEMPLATE <GROUP>- - Finds destination instances from
-<GROUP>- - Compares template settings group (
arksa:stadiacontroller) to each destination - Also includes detected backup-related settings groups for local/cloud backup configuration when present
- Prints per-server aligned vs changed settings
- Apply mode: applies diffs, then restarts only servers with game-setting changes
Safety checks:
- Halts if template app type and destination app type do not match
- Uses
display_image_source(fallback:module)
- Uses
Not copied intentionally:
Meta.GenericModule.SessionNameMeta.GenericModule.MapMeta.GenericModule.CustomMap
Forced value:
GenericModule.App.UseRandomAdminPassword = false
Backup settings notes:
- Backup-related settings are auto-detected from the template setting spec using group/key metadata
- Intended to catch backup configuration exposed in AMP local/cloud tabs
- Dry-run/apply output prints which backup settings groups were included
- Backup-only changes do not trigger a server restart
Script: sync_game_schedules.py
Run:
./run-game-schedules.sh --dry-run
./run-game-schedules.shWhat it does:
- Uses same template/group marker logic
- Deletes existing populated triggers on each destination
- Recreates template triggers and tasks in order
- Copies full task parameter mappings (messages, waits, backup options, conditions, etc.)
- Keeps event trigger name as AMP-defined (not renameable by API)
- Adds replication stamp to interval trigger descriptions:
... | replicated from <template_instance> <UTC timestamp>
- Distributes backup trigger minutes across destination servers
- Avoids collision with the template backup minute
Notes:
- No app stop/start is done by schedule sync
--dry-runprints planned operations only
Detailed behavior:
- Template source:
- Reads template schedule with raw API data (
format_data=False) so task parameters are not lost.
- Reads template schedule with raw API data (
- Trigger types:
- Interval triggers are created via
Core/AddIntervalTrigger. - Event triggers are created via
AddEventTrigger.
- Interval triggers are created via
- Event trigger tasks:
- Existing tasks on newly created event triggers are cleared first (prevents task duplication on repeated runs).
- Task parameter keys:
- Parameter keys are remapped to method-consume names where required so AMP stores values correctly.
- Example mappings handled:
value_to_check,seconds,dirty_only, etc.
Backup scheduling logic:
- Trigger is treated as backup-related if any task method contains
backup. - For backup interval triggers:
- Minute is spread across destination servers evenly over the hour.
- Template backup minute is excluded from possible destination minutes.
- This reduces concurrent backup load spikes.
Recommended run flow:
- Run dry-run first:
./run-game-schedules.sh --dry-run
- Validate:
- Destination list
- Trigger delete/create plan
- Backup minute plan lines
- Apply:
./run-game-schedules.sh
- Verify in AMP UI:
- Interval trigger descriptions include replication stamp
- Event trigger task count matches template
- Backup trigger minute differs across destination servers
Known limitations:
- Event trigger description/name cannot be changed through current AMP API endpoints.
- Therefore, the event trigger
An update is available via SteamCMDremains AMP-default text.
Script: backup_retention.py
Run:
./run-backup-retention.sh # default: cleanup dry-run
./run-backup-retention.sh cleanup --daily-days 7 --weekly-months 3
./run-backup-retention.sh cleanup --daily-days 7 --weekly-months 3 --applyWhat it does:
- Uses same template/group marker logic
- Includes template plus destination servers in that group
- Calls
LocalFileBackupPlugin/GetBackupson each included instance listmode prints sticky backups by default (--all-backupsto include non-sticky)cleanupmode (dry-run by default) applies sticky-only retention:- Keep one sticky backup per day for recent days (
--daily-days, default7) - Then keep one sticky backup per ISO week for older backups (
--weekly-months, default3)
- Keep one sticky backup per day for recent days (
- Older sticky backups outside retention are deleted only with
--apply
Script: clear_old_backups_keep_latest.py
Run:
./run-clear-old-backups-keep-latest.sh
./run-clear-old-backups-keep-latest.sh --applyWhat it does:
- Uses same template/group marker logic
- Includes the template plus destination servers in that group
- Loads backups from each included instance
- Keeps the newest backup on each instance
- Deletes all older backups only with
--apply
Notes:
- Default mode is dry-run
- If a backup exists both locally and remotely, the script deletes both copies
Create amp_config.json:
{
"url": "http://127.0.0.1:8080",
"username": "admin",
"password": "yourpassword"
}Optional env overrides:
AMP_URLAMP_USERAMP_PASS
Install deps in venv:
python3 -m venv .venv
./.venv/bin/python -m pip install --upgrade pip setuptools wheel
./.venv/bin/pip install cc-ampapiScript: zabbix_amp_status.py
Launcher:
./run-zabbix-amp-status.sh discovery
./run-zabbix-amp-status.sh controller-json
./run-zabbix-amp-status.sh instance-json --instance-id <AMP_INSTANCE_ID>What it does:
- Connects to AMP directly with the same
amp_config.jsonorAMP_URL/AMP_USER/AMP_PASS - Returns low-level discovery JSON for ARK non-ADS instances only
- Returns a per-instance JSON payload suitable for Zabbix master item + dependent items
Per-instance JSON fields:
instance_runninginstance_stateapp_runningapp_stateinstance_stuckactive_userscpu_percentmemory_percentuptimeapp_status_error
Recommended Zabbix design:
- Put
run-zabbix-amp-status.shon the Zabbix server/proxy as an external script, or expose it throughUserParameteron the AMP host. - Create an LLD rule using:
run-zabbix-amp-status.sh discovery
- For each discovered instance, create one master item:
run-zabbix-amp-status.sh instance-json --instance-id {#AMP.INSTANCE_ID}
- Create dependent items from the master item with JSONPath:
$.instance_running$.app_running$.instance_stuck$.active_users$.cpu_percent$.memory_percent$.app_state$.uptime
- Add triggers such as:
- Instance stopped:
last(/<template>/amp.instance_running[{#AMP.INSTANCE_ID}])=0 - App stopped while instance is up:
last(/<template>/amp.instance_stuck[{#AMP.INSTANCE_ID}])=1 - App status query error:
length(last(/<template>/amp.app_status_error[{#AMP.INSTANCE_ID}]))>0
- Instance stopped:
Notes:
- Using direct AMP API calls is the right approach here.
- The preferred setup is one master JSON item per instance with dependent items, instead of many separate API calls.
- Current discovery is intentionally limited to ARK instances only.
- You can change this in
zabbix_amp_status.pyby settingARK_ONLY_DISCOVERY = False. - If Zabbix cannot reach AMP over the network, run the script on the AMP host and have the Zabbix agent execute it locally.