Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Default Notification support #25

Closed
undaunt opened this issue Apr 12, 2024 · 12 comments
Closed

Default Notification support #25

undaunt opened this issue Apr 12, 2024 · 12 comments

Comments

@undaunt
Copy link

undaunt commented Apr 12, 2024

I'm doing some testing and it seems that containers created by Autokuma are not given default 'on' notifications even if my provider (in this case ntfy) is set to 'default enabled' as in the below screenshot.

image

image

@BigBoot
Copy link
Owner

BigBoot commented Apr 13, 2024

Hi, yes this is handled using special client side logic by the uptime kuma webui (the same is btw true for proxies) which I don't plan to replicate, however you can achieve basically the same using autokumas default_settings config:

    environment:
      AUTOKUMA__DEFAULT_SETTINGS: |- 
         *.notification_id_list: { "1": true }

@BigBoot BigBoot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2024
@undaunt
Copy link
Author

undaunt commented Apr 13, 2024

Thanks for that!

For anyone else who stumbles upon this, louislam/uptime-kuma#4411 has been merged but Uptime Kuma 2.0 (as of this writing) isn't released yet, so you'll likely note errors and no notification fired for docker containers and groups as a URL is currently expected but not included when monitoring those types of monitors.

Example log:

2024-04-13T05:09:49.060409423Z 2024-04-12T22:09:49-07:00 [MONITOR] WARN: Monitor #39 'Dozzle Web': Failing: Request failed with status code 404 | Interval: 60 seconds | Type: http | Down Count: 0 | Resend Interval: 0
2024-04-13T05:09:49.773562660Z 2024-04-12T22:09:49-07:00 [MONITOR] ERROR: Cannot send notification to Ntfy
2024-04-13T05:09:49.775668020Z Error: Error: AxiosError: Request failed with status code 400 {"code":40018,"http":400,"error":"invalid request: actions invalid; parameter 'url' is required for action 'view'","link":"https://ntfy.sh/docs/publish/#action-buttons"}
2024-04-13T05:09:49.775687100Z     at Ntfy.throwGeneralAxiosError (/app/server/notification-providers/notification-provider.js:38:15)
2024-04-13T05:09:49.775689558Z     at Ntfy.send (/app/server/notification-providers/ntfy.js:72:18)
2024-04-13T05:09:49.775691305Z     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-04-13T05:09:49.775692975Z     at async Monitor.sendNotification (/app/server/model/monitor.js:1421:21)
2024-04-13T05:09:49.775694606Z     at async beat (/app/server/model/monitor.js:958:21)
2024-04-13T05:09:49.775696280Z     at async Timeout.safeBeat [as _onTimeout] (/app/server/model/monitor.js:1026:17)
2024-04-13T05:09:49.776387315Z 2024-04-12T22:09:49-07:00 [MONITOR] WARN: Monitor #41 'Dozzle': Failing: Child inaccessible | Interval: 60 seconds | Type: group | Down Count: 0 | Resend Interval: 0

@johntdyer
Copy link

@BigBoot this doesnt seem to work for me, is there any logging that can give me some hints as to why my default notifier is not checked?

@undaunt
Copy link
Author

undaunt commented Apr 15, 2024

@johntdyer You will likely need to run a jq query to check that your default notifier is in fact ID of 1, similar to #2 (comment). My default notifier (before blowing away my old config folder) was actually 2.

@johntdyer
Copy link

@undaunt mine is actually number 1

[
  {
    "id": 1,
    "name": "Uptime",
    "active": true,
    "userId": 1,
    "isDefault": true,
    "config": {
      "applyExisting": true,
      "discordWebhookUrl": "https://discord.com/api/webhooks/xxxxxx/xxxxxx",
      "isDefault": true,
      "name": "Uptime",
      "type": "discord"
    }
  },```

@johntdyer
Copy link

any thoughts ?

@BigBoot
Copy link
Owner

BigBoot commented Apr 26, 2024

The AUTOKUMA__DEFAULT_SETTINGS works, I've looked at your logs in #11 and autokuma seems to have problems connecting to your uptime kuma instance, which is probably also the reason for the excessive connection count.

@BigBoot
Copy link
Owner

BigBoot commented Apr 26, 2024

Actually I just noticed you seem to be using static monitors, these are completely static and don't go through any processing right now (i.e. no default settings), if that is what you're trying to do.

@johntdyer
Copy link

yes, I am using a mix of static and label derived ... trying to codify my entire config.... I was able to get the notification workingby doing an int rather then a string for the label derived

      AUTOKUMA__DEFAULT_SETTINGS: |-
         *.max_retries: 3
-         *.notification_id_list: { "1": true }
+         *.notification_id_list: { 1: true }

@BigBoot
Copy link
Owner

BigBoot commented Apr 26, 2024

That can't be true, the correct syntax is with a string as key

@johntdyer
Copy link

I'm an idiot , I must have fat fingered something or forgot to save... you're correct string is what works... look over there... something shiny ;-P

@johntdyer
Copy link

Created #33 re: the static monitors

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

No branches or pull requests

3 participants