petersem / monocker

161 stars 9 forks source link

Support for additional notifications types? #10

Closed Deanosim closed 3 months ago

Deanosim commented 2 years ago

Would it be possible to get support for notifications with gotify? Gotify is a self hosted alternative to things like pushover. https://gotify.net

Also the ability to send notifications with normal webhooks, Since discord webhooks are not compatible with other software usually.

petersem commented 2 years ago

Will look at notify. I though discord was already there?

Nairou commented 1 year ago

Came here to check for support for ntfy, similar to gotify.

BadCo-NZ commented 1 year ago

Will look at notify. I though discord was already there?

@petersem Might be worth it to look into supporting Apprise

https://github.com/caronc/apprise

GinjNTonic commented 1 year ago

Politely boosting this request. :)
Gotify/Apprise would be extremely appreciated by self-hosters.

Proximus888 commented 11 months ago

Jep, would love ntfy.sh integration. Best is apprise!

portalzine commented 7 months ago

Just found this and apprise notification support would be amazing. ntfy would be a nice start and simple to integrate; ) Cheers

petersem commented 4 months ago

Will investigate

petersem commented 4 months ago

@Proximus888 @Nairou NTFY is in the latest build. I still plan to add appraise, however I just havent had a chance to do so yet.

Proximus888 commented 4 months ago

@Proximus888 @Nairou NTFY is in the latest build. I still plan to add appraise, however I just havent had a chance to do so yet.

Thanks, works.

But NTFY_USER and NTFY_PASS doesn't work for me, I get a 401 error. Authentication error.

My work around was to pass the user and password on through the url. So this worked for me: CUSTOM_NTFY_SERVER: 'https://user:password@ntfy.domain.tld'

Will continue to check if I can get NTFY_USER and NTFY_PASS to work.

petersem commented 4 months ago

@Proximus888 ah bummer. I'll have a look later tonight. Should be a simple fix.

Although, in hindsight, including user_psw in server string does clean up the number of compose parameters. Hmm.. anyway, will look at it

petersem commented 4 months ago

Appraise will be next, then gotify

petersem commented 4 months ago

@Proximus888 @Nairou NTFY is in the latest build. I still plan to add appraise, however I just havent had a chance to do so yet.

Thanks, works.

But NTFY_USER and NTFY_PASS doesn't work for me, I get a 401 error. Authentication error.

My work around was to pass the user and password on through the url. So this worked for me: CUSTOM_NTFY_SERVER: 'https://user:password@ntfy.domain.tld'

Will continue to check if I can get NTFY_USER and NTFY_PASS to work.

I have tried a few times, however I cannot replicate the 401 error with the current code. Are you running a self-hosted NTFY server?

Proximus888 commented 4 months ago

@Proximus888 @Nairou NTFY is in the latest build. I still plan to add appraise, however I just havent had a chance to do so yet.

Thanks, works.

But NTFY_USER and NTFY_PASS doesn't work for me, I get a 401 error. Authentication error.

My work around was to pass the user and password on through the url. So this worked for me: CUSTOM_NTFY_SERVER: 'https://user:password@ntfy.domain.tld'

Will continue to check if I can get NTFY_USER and NTFY_PASS to work.

I have tried a few times, however I cannot replicate the 401 error with the current code. Are you running a self-hosted NTFY server?

Yes, I am running a selfhosted NTFY server on a VPS. With on local network running DNS and NGINX reverse proxy.

Local server can revolve and ping custom domain ntfy.domain.tld. Other services work with user and pass (tautulli).

petersem commented 4 months ago

@Proximus888 What does your compose look like?

This works for me:

  monocker:
    container_name: monocker
    image: petersem/monocker
    environment:
      SERVER_LABEL: 'Dev'
      SERVER_AVATAR: 'https://content.invisioncic.com/u329766/monthly_2024_05/monocker.png.ba5ffdb390b627097d2a53645cf87350.png'
      MESSAGE_PLATFORM: 'ntfy@testing'
      LABEL_ENABLE: 'false'
      ONLY_OFFLINE_STATES: 'false'
      EXCLUDE_EXITED: 'false'      
      PERIOD: 30
      DISABLE_STARTUP_MSG: 'false'

      ## ADVANCED NTFY SETTINGS
      CUSTOM_NTFY_SERVER: 'https://ntfy.mydomain.net' 
      NTFY_USER: 'my_user_id' 
      NTFY_PASS: 'my_password' 
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped
Proximus888 commented 4 months ago

@Proximus888 What does your compose look like?

This works for me:

  monocker:
    container_name: monocker
    image: petersem/monocker
    environment:
      SERVER_LABEL: 'Dev'
      SERVER_AVATAR: 'https://content.invisioncic.com/u329766/monthly_2024_05/monocker.png.ba5ffdb390b627097d2a53645cf87350.png'
      MESSAGE_PLATFORM: 'ntfy@testing'
      LABEL_ENABLE: 'false'
      ONLY_OFFLINE_STATES: 'false'
      EXCLUDE_EXITED: 'false'      
      PERIOD: 30
      DISABLE_STARTUP_MSG: 'false'

      ## ADVANCED NTFY SETTINGS
      CUSTOM_NTFY_SERVER: 'https://ntfy.mydomain.net' 
      NTFY_USER: 'my_user_id' 
      NTFY_PASS: 'my_password' 
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped

This one doesn't work for me:

  monocker:
    container_name: monocker
    image: petersem/monocker
    environment:
      SERVER_LABEL: 'NUC1'
      MESSAGE_PLATFORM: 'ntfy@monocker'
      CUSTOM_NTFY_SERVER: 'https://ntfy.domain.tld'
      NTFY_USER: 'sensitive'
      NTFY_PASS: 'sensitive'
      LABEL_ENABLE: 'false'
      ONLY_OFFLINE_STATES: 'false'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - utility
    restart: unless-stopped

Then I get:

-------------------------------------------------------
 Monocker - MONitor dOCKER container states
 Developed by Matt Petersen - Brisbane Australia

 Version: 2.10.1
-------------------------------------------------------

Monitoring started 
     - Version: 2.10.1
     - Messaging platform: ntfy
     - Polling period: 10 seconds 
     - Only offline state monitoring: false
     - Only include labelled containers: false 
     - Do not monitor 'Exited': false
     - Disable Startup Messages: false
     - Display SHA ID: false

     - Currently monitoring 27 (running) containers
Request failed with status code 401
Request failed with status code 401
    - monocker: running (healthy)
*****monocker: running (healthy)
Request failed with status code 401

But this one works for me:

  monocker:
    container_name: monocker
    image: petersem/monocker
    environment:
      SERVER_LABEL: 'NUC1'
      MESSAGE_PLATFORM: 'ntfy@monocker'
      CUSTOM_NTFY_SERVER: 'https://user:password@ntfy.domain.tld'
      LABEL_ENABLE: 'false'
      ONLY_OFFLINE_STATES: 'false'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - utility
    restart: unless-stopped

My ntfy user password contains symbols, I don't know if that is throwing something off.

petersem commented 4 months ago

@Proximus888 weird. I will test tomorrow. 1:24AM here, so need some sleep.

Proximus888 commented 4 months ago

@Proximus888 weird. I will test tomorrow. 1:24AM here, so need some sleep.

No worries, my work around works.

And thanks for your work, was keeping pushover around for this kind of notifications. Now I can fully switch to NTFY.

Thanks again.

petersem commented 4 months ago

@Proximus888 Does your psw happen to have a single or double quote in it? Perhaps try setting the NTFY_PASS without the single quotes around it. Failing this, we may have to setup a user on your NTFY install so that I can try connecting to it.

if you have special characters in your password, you can escape them (to some degree). For example, if i had a password of password', then i would escape it as follows: NTFY_PASS = 'password\''

But ultimately it is tricker with anything containing a \ ' ". So perhaps check you password and omit any of those characters, if there. Unfortunately it is a bit basic with what we can pass through when it comes to these characters. :(

petersem commented 4 months ago

@GinjNTonic @BadCo-NZ I've been looking into Apprise, and have Apprise setup on my app server. (My God, the doco is rough) 😂 What I'd like to know from you is how you see Appraise integration working.

I'm also assuming you would have Apprise already installed and configured on your networks? Or are you thinking I should package the Apprise install with the existing docker compose?

I'm also thinking that Apprise could be too much for some people to configure. (Too many moving parts)Maybe I'm just a bit paranoid. 😂

I really want to keep Monocker as simple to use as possible, so I'm trying to work out how Apprise fits/doesn't fit with that ethos.

petersem commented 4 months ago

@Deanosim @Nairou @GinjNTonic Coming in next release image

petersem commented 3 months ago

Gotify, ntfy, matrix, and slack, have been added to the current release. I havent done apprise as yet, as I want to consider how this will affect the usability of monocker for everyone. (not everyone has an local apprise server). That said, I may just add apprise as another option, amongst the others. I need to think about it. For now, i hope you have pretty much everything needed, so im closing this incident. please open a new one if there is something specific needed

BadCo-NZ commented 3 months ago

The idea of Apprise is that you (the developer) instead of supporting Gotify, ntfy, matrix and slack, you integrate apprise and apprise sends to the notifications the the users chosen notification system.

Apprise is mostly invisible to the end user, they just choose the notification system they have and away they go.

Basically you are offloading the support of multiple notification systems to Apprise.

Well, I'm no developer, but that is my interpretation anyway.

petersem commented 3 months ago

The idea of Apprise is that you (the developer) instead of supporting Gotify, ntfy, matrix and slack, you integrate apprise and apprise sends to the notifications the the users chosen notification system.

Apprise is mostly invisible to the end user, they just choose the notification system they have and away they go.

Basically you are offloading the support of multiple notification systems to Apprise.

Well, I'm no developer, but that is my interpretation anyway.

Yep, that seems to be how it works. I created a local Apprise server and tried it out. But not everyone is capable of creating and configuring an Apprise server. The doco for it is not great. So if I move to Apprise. Then everyone that wants to use monocker will have to create their own Apprise server. I think that would severely limit the audience for monocker.

petersem commented 3 months ago

The idea of Apprise is that you (the developer) instead of supporting Gotify, ntfy, matrix and slack, you integrate apprise and apprise sends to the notifications the the users chosen notification system.

Apprise is mostly invisible to the end user, they just choose the notification system they have and away they go.

Basically you are offloading the support of multiple notification systems to Apprise.

Well, I'm no developer, but that is my interpretation anyway.

OK, a little more investigation and I have decided to add apprise as additional message platform. Next version will have it. Reopening this.

image

BadCo-NZ commented 3 months ago

I wrote this between your posts bit it seems it didn't send.

Your users dont need apprisem only your service does.

For example, uptime kuma uses apprise.

https://github.com/louislam/uptime-kuma/wiki/Notification-Methods

petersem commented 3 months ago

Apprise support implemented in latest version