Skip to content

feat: ntfy alerts for monitor logs. Closes #664#667

Merged
regulartim merged 9 commits intointelowlproject:developfrom
HARSHVARANDANI:feature/ntfy-alert
Jan 4, 2026
Merged

feat: ntfy alerts for monitor logs. Closes #664#667
regulartim merged 9 commits intointelowlproject:developfrom
HARSHVARANDANI:feature/ntfy-alert

Conversation

@HARSHVARANDANI
Copy link
Copy Markdown
Contributor

Description

This feature extends the existing Slack-based alerting in MonitorLogs by also publishing notifications to a configured ntfy topic when errors are detected in monitored logs.

Related issues

Please add related issues.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality).

Checklist

  • [ x] I have read and understood the rules about how to Contribute to this project.
  • The pull request is for the branch develop.
  • I have added documentation of the new features.
  • Linters (Black, Flake, Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved. All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated (check CONTRIBUTE.md).
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.

Important Rules

  • If you miss to compile the Checklist properly, your PR won't be reviewed by the maintainers.
  • If your changes decrease the overall tests coverage (you will know after the Codecov CI job is done), you should add the required tests to fix the problem
  • Everytime you make changes to the PR and you think the work is done, you should explicitly ask for a review. After being reviewed and received a "change request", you should explicitly ask for a review again once you have made the requested changes.

Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@regulartim
Copy link
Copy Markdown
Collaborator

Also: do you think you can write a test for that?

@regulartim
Copy link
Copy Markdown
Collaborator

And another thing: would you add headers to the request, such that the alerts have a prettier format? Suggestion (feel free to improve):

headers={
        "Title": "GreedyBear error",
        "Tags": "warning"
    })

Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, I like it! 👍
Could you please add a set of test cases for send_ntfy_message?

@HARSHVARANDANI
Copy link
Copy Markdown
Contributor Author

Good job, I like it! 👍 Could you please add a set of test cases for send_ntfy_message?

Just to be sure, do you mean add a testing python script like the ones in the test folder?

@regulartim
Copy link
Copy Markdown
Collaborator

Just to be sure, do you mean add a testing python script like the ones in the test folder?

Yes, exactly. It should cover happy paths, failing paths, edge cases. Just take a look at a few existing tests to get an impression.

Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are getting close! :) Just a few minor things left. Also: please fix the formatting such that the CI is happy.

@regulartim
Copy link
Copy Markdown
Collaborator

@HARSHVARANDANI Fix the formatting such that the CI is happy, then we can merge.

@HARSHVARANDANI
Copy link
Copy Markdown
Contributor Author

Fix the formatting such that the CI is happy, then we can merge.

@regulartim I have already used pre-commit before every commit to check for the formatting Black, Flake and Isort, is there anything else there is supposed to be done for the formatting?

@regulartim
Copy link
Copy Markdown
Collaborator

Ok, that's strange. Maybe this is because of the ongoing migration to Ruff. I'll check and get back to you.

Comment on lines +13 to +15
class SendNtfyMessageTests(SimpleTestCase):

@override_settings(NTFY_URL="https://ntfy.sh/greedybear")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fond the issue, this is indeed because of the recent integration of ruff for linting. Please remove the empty line (14) here.

For future PRs, please use ruff as described in our contribution guidelines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do 👍

@regulartim
Copy link
Copy Markdown
Collaborator

Now ruff is unhappy with the import ordering and I don't know why. I cloned @HARSHVARANDANI 's repo and ran ruff using our .ruff.toml from the develop branch. It did not complain about anything. Can you please help @mlodic @opbot-xd ?

@mlodic
Copy link
Copy Markdown
Member

mlodic commented Jan 4, 2026

I tried it locally and I correctly replicate the error reported by the CI. Ruff is working fine in my env. How did you install pre-commit/ruff in your env?

So yes, the error must be fixed

@opbot-xd
Copy link
Copy Markdown
Contributor

opbot-xd commented Jan 4, 2026

image I ran the ruff check command it is showing me the same error and on applying fix command the diff is only the fix is to add a line after
from unittest.mock import MagicMock, patch

from django.test import SimpleTestCase, override_settings

from greedybear.ntfy import send_ntfy_message

TEST_LOGGING = {
image

after then on running the check again, all checks passed
so try this once
since i did not have the push access so was not able to push my code changes

@mlodic
Copy link
Copy Markdown
Member

mlodic commented Jan 4, 2026

ah you know what? It could be that you executed the ruff linter instead of the ruff formatter. Those are 2 different commands. @regulartim
To be sure to execute all of them, please run pre-commit run ruff --all-files -c .github/.pre-commit-config.yaml

@regulartim
Copy link
Copy Markdown
Collaborator

Sorry, my bad. I ran ruff format instead of ruff check. Thanks @mlodic @opbot-xd !

@regulartim
Copy link
Copy Markdown
Collaborator

Now the CI is happy! Thanks for your work @HARSHVARANDANI, I 'll merge now.

@regulartim regulartim merged commit 25b9706 into intelowlproject:develop Jan 4, 2026
5 checks passed
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

Successfully merging this pull request may close these issues.

4 participants