Telegram Notifications

Started by alexkgr, November 04, 2023, 07:32:49 AM

Previous topic - Next topic
@halasizs
more feedback - more chances )
you can test it (https://forum.opnsense.org/index.php?topic=36805.msg184572#msg184572)
and share your opinion
I still don't know if it makes sense to make a PR for it

Well, now I'm not in the mood for opnsession. After refreshing /23.10_1-> 23.11/ the web interface does not load. https://192.168.0.1 . SSH disabled, I can't reach it. Luckily I have internet and it is not interrupted.
On restart 2x the situation was unchanged. The weekend programme is here.
I know I shouldn't be writing here, but I'm angry.  Sorry.

I was looking for this, and seems it works, at least the Test is working. I am not sure how to trigger some alarms manually over cli.

One thing maybe to consider, when entering the Token and Chat ID and pressing Test, without saving settings firstly, will trow an error message, not sure is this by design or it should say please save first then do test messages.

January 05, 2024, 08:00:47 PM #48 Last Edit: January 05, 2024, 08:48:21 PM by Fright
@vrabac
Thanks!
I'll take a look - may be its better to send test message with the form values and not from config values (so it's possible to test settings without saving to config)

@Fright
That would even be better, to use values from Form and not from config, as in initial setup there is no values in config, and I guess because of that there is that error then trying to test.

Do you know the way to trigger some test in CLI to see this in action. I changed all monit Services Test Settings  (11 by default) to Execute and that path, but would like to see this in real action :). I am also loking for some more monit Services Test.

edit(say 15%)\enable CPUUsageTest and run something cpu-consuming. like IDS rulesets update )

good example of shell quick test (via logs monitoring): https://mephiz.sh/2023/06/10/opnarp-telegram#monit-settings

Hi Fright, this is working for me. As i press apply on MONIT setting i get message regarding CPUUsage, but just once after apply. No other messages regarding CPUUsage are coming, even the load is more that 15%

@kozistan
Hi! any clue in monit log?
matches and actions should be visible in monit log with Info (and above) severity level selected

That is correct, log is full of reports. Please check the attached screenshot.

after the 'SYSTEM' cpu usage of **% matches resource limit ' message there should be messages like:
'SYSTEM' exec: '/usr/local/opnsense/scripts/OPNsense/Monit2T/monit2t.sh' (with Info severity) if action is set for the service test and then
'Telegram message sent' with Notice severity (if message is sent) or
'Telegram API endpoint returned error..' with Error severity if something goes wrong

screenshot from my config + message on telegram

ah. this is how Monit works.
exec (and Alert) action triggers once on state change (or 'repeat every XXX cycle(s)' should be used) .
so cpu usage should drop below threshold first, then exec will work on next match.
you can see in log that your cpu usage is above threshold on every poll

just checked the service monit status is not reseting after it reaches the limit. it's stuck somewhere

Also tried 3 CYCLES with no change.

try to set CpuLoad to 25% - i think you will see how it works

thanks @Fright. I did not even changed the value, i've just duplicated those default tests with execute option and everything is working. No issues and can tell you i was sleeping better before, soon I'm going to turn monit off :)

So yes, monit is working with telegram with no issues. At least for me