Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Monitor is being created indefinitely if configured notification_id does not exist #113

Open
AurimasNav opened this issue Jan 7, 2025 · 3 comments

Comments

@AurimasNav
Copy link

AurimasNav commented Jan 7, 2025

error:

WARN [autokuma::sync] Encountered error during sync: Server responded with an error: insert into monitor_notification (monitor_id, notification_id) values (97, '1') - SQLITE_CONSTRAINT: FOREIGN KEY constraint failed

In reality monitor is created in uptime kuma, but autokuma keeps on recreating it in indefinite loop.

monitor example:

{
    "name": "domain.internal",
    "type": "http",
    "url": "https://domain.internal",
    "timeout": "10",
    "interval": "60",
    "retryInterval": "20",
    "accepted_statuscodes": ["200-299"],
    "notificationIDList": {
        "1": true
    },
    "ignoreTls": true,
    "parent_name": "prod"
}

Scenario in which this happens - I try to redeploy uptime kuma + autokuma from code, since not all objects can be defined in code (in this case notifications) some objects are missing initially and this causes the creation loop.

@BigBoot
Copy link
Owner

BigBoot commented Jan 7, 2025

I've already mentioned this in some other issue but this is a uptime kuma bug. There's basically nothing I can do about this, uptime kuma does not report the id of the newly created monitor in this failure case so there's no way for autokuma to know about the new monitor and frankly uptime kuma should probably clean up any half created monitors anyway.

Btw. since you're already on master, you can create notifications (and tags and docker_hosts) using autokuma, see #81

@AurimasNav
Copy link
Author

Could autokuma check if the notification_id is present in uptime-kuma and refuse to create monitor if it does not exist?

@AurimasNav
Copy link
Author

AurimasNav commented Jan 7, 2025

I've already mentioned this in some other issue but this is a uptime kuma bug. There's basically nothing I can do about this, uptime kuma does not report the id of the newly created monitor in this failure case so there's no way for autokuma to know about the new monitor and frankly uptime kuma should probably clean up any half created monitors anyway.

Btw. since you're already on master, you can create notifications (and tags and docker_hosts) using autokuma, see #81

how do I create a tag? I don't see it on the entity types list - https://github.com/BigBoot/AutoKuma/blob/master/ENTITY_TYPES.md

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants