Hello everyone,
New user trying to migrate from pfsense (4 years setup with many tweaks)
I am used to have telegram notifications whatever happens to my networks.
New device, gw down etc.
Trying to find something at opnsense but all based to monit and custom setup and and and.
Is it so difficult to integrate to telegram plugin that pfsense has? Or something equivalent.
Thanks in advance.
There is a Telegram plugin for pf? Where?
Quote from: mimugmail on November 04, 2023, 09:49:27 AM
There is a Telegram plugin for pf? Where?
Embedded at the pf.
System - advanced - notifications
Sent from my SM-S918B using Tapatalk
Do you have a screenshot available please?
I was always thinking about a plugin to add predefined actions to monit
here it is
thanks and hope for something
And where do you define which messages should go to this group?
There is no option. Everything happens to fw, connectivity etc...you have a notification
Sent from my SM-S918B using Tapatalk
I would like to +1 this request. Recently migrated from pfSense to OPNsense and really like OPNsense a lot. But Monitoring is one of the features that works much easier and more intuitive in pfSense.
An easy way to setup e-mail and Telegram notifications would be very much appreciated. Monit seems extremely versatile, but it is difficult to understand as a new user. E.g. I would like to be notified if someone succesfully connects to Wireguard. Can't figure it out (yet).
Quote from: ajohn on November 11, 2023, 09:54:08 AM
I would like to +1 this request. Recently migrated from pfSense to OPNsense and really like OPNsense a lot. But Monitoring is one of the features that works much easier and more intuitive in pfSense.
An easy way to setup e-mail and Telegram notifications would be very much appreciated. Monit seems extremely versatile, but it is difficult to understand as a new user. E.g. I would like to be notified if someone succesfully connects to Wireguard. Can't figure it out (yet).
Totally agree with this....still using old install of pfsense due to notifications
Sent from my SM-S918B using Tapatalk
Another +1 for Telegram notifications.
People do not watch their email (unless sitting at a desk in their work environment) like the once did 15 years ago. I use Telegram nearly exclusively for my network and server notifications, be it those generated by OS itself, applications running on servers, or even in my self generated bash scripts. I use two different Telegram bots (one for system stuff, one for applications) that have different notification tones. This is much more useful, as I can immediately know which are notifying me even before I take my phone out of my pocket. With email, you get one ding, be it from your system or the third email about sales at Best Buy.
Wonder if this still works: https://github.com/matriphe/monit2telegram
Anyone tried it?
Quote from: gniting on November 12, 2023, 01:59:03 PM
Wonder if this still works: https://github.com/matriphe/monit2telegram
Anyone tried it?
There is nginx I think at opnsense. I have read somewhere that it is difficult to implement but it is working
Sent from my SM-S918B using Tapatalk
anything new about this?
Since yesterday? Likely not. ;)
Quote from: franco on November 13, 2023, 12:14:49 PM
Since yesterday? Likely not. ;)
In general i am saying. It's almost 10 days since i have proposed it.
I am not asking for implementing...just for discussion
Sent from my SM-S918B using Tapatalk
I'll have a look, but it takes some time.
+1
Thank you minugmail
Would be nice...
This works for OPNarp by the way:
https://mephiz.sh/2023/06/10/opnarp-telegram (https://mephiz.sh/2023/06/10/opnarp-telegram)
@franco @mimugmail
Hi!
so what's the plan? )
integrate in core? make it a plugin and call it with the exec action with the script path?
Or is this only for Michael's repo for now?
Request @ github
https://github.com/opnsense/core/issues/7080
Quote from: Fright on December 16, 2023, 07:57:18 PM
@franco @mimugmail
Hi!
so what's the plan? )
integrate in core? make it a plugin and call it with the exec action with the script path?
Or is this only for Michael's repo for now?
Best would start with a plugin, do you want to work on it? :)
only if you haven't started yet :)
a simple script seems to work. wanted to try it with the markdownv2 markup allowed. and add a bit of logging
I didnt, so, happy when you take care :)
got it, thanks )
skeleton is ready, some polishing needed
i didn't understand.
Someone has made a script that it is working?
do you want to test it?
script is not standalone. it uses params from gui\config.
Sure, i'll ask for testing when everything is ready, thanks
@alexkgr Hi
if you are ready to help with testing, take a look please
https://github.com/kulikov-a/opn-monit2t
pkg add https://github.com/kulikov-a/opn-monit2t/raw/main/work/pkg/os-monit2t-1.0.pkg
@Fright
i will check the next days and report.
thank you very much
Quote from: Fright on December 19, 2023, 06:25:36 PM
@alexkgr Hi
if you are ready to help with testing, take a look please
https://github.com/kulikov-a/opn-monit2t
pkg add https://github.com/kulikov-a/opn-monit2t/raw/main/work/pkg/os-monit2t-1.0.pkg
i am really new to opnsense.
can you help me how to setup it with monit and have notifications?
I have entered telegram token and chat id and i received the test message.
But i don't know what to with this "In order to use this plugin, "Execute" Action should be set for Service Test and "/usr/local/opnsense/scripts/OPNsense/Monit2T/monit2t.sh" as a path. "
for example, if you use example 3 from docs
https://docs.opnsense.org/manual/monit.html#example-3
it will look like in the picture attached
Quote from: Fright on December 20, 2023, 07:52:53 AM
for example, if you use example 3 from docs
https://docs.opnsense.org/manual/monit.html#example-3
it will look like in the picture attached
so we have to change all service tests settings?
only those that are used (in Service Settings) and notifications for which should be received in Telegram
i am trying to trigger an alert but it is not successful.
triggered alerts should be visible in monit log
i have an error at monit logs.
did you changed message template?
is the test message sent successfully?
Quote from: Fright on December 20, 2023, 08:42:32 AM
did you changed message template?
is the test message sent successfully?
haven't changed anything.
i am trying to trigger an alert with the opn-arp pkg
i am typing this at a console
" echo "<29>1 2022-08-29T20:16:44+03:00 router.home root 59285 - [meta sequenceId=1] New IPv4/MAC pair seen: (10.1.3.22)3a:d1:ee:bc:79:2f" >> /var/log/system/latest.log"
to have triggered an alert
got it, thanks. html tags should be encoded in MONIT_DESCRIPTION text then. will make a patch today
Quote from: Fright on December 20, 2023, 08:59:45 AM
got it, thanks. html tags should be encoded in MONIT_DESCRIPTION text then. will make a patch today
thanks!
pkg delete os-monit2t
pkg add https://github.com/kulikov-a/opn-monit2t/raw/main/work/pkg/os-monit2t-1.0.pkg
Quote from: Fright on December 20, 2023, 09:45:18 AM
pkg delete os-monit2t
pkg add https://github.com/kulikov-a/opn-monit2t/raw/main/work/pkg/os-monit2t-1.0.pkg
ok it is fixed!
thanks
thanks! please, test it.
maybe I missed something else or something can be added ;)
Any progress in the development? Just wondering! :)
Quote from: halasizs on January 04, 2024, 07:41:31 PM
Any progress in the development? Just wondering! :)
It is working
Sent from my SM-S916B using Tapatalk
Will it be included in the plugins?
@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.
@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
Quote from: kozistan on January 07, 2024, 08:28:51 PM
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%
I was able to configure like in example on link you provided and Notification are working as expected, great work indeed.
I am not sure if there is possibility somehow to setup monit to use Telegram and not SMTP, would save us work to setup everything to execute and your script, but I personal can live with that, I don't have that much Notifications.
@vrabac thanks!
Quoteif there is possibility somehow to setup monit to use Telegram and not SMTP
hmm, I'm not sure I understood correctly, but for telegram to work it is not necessary to configure "Alert settings",
and any (fake) smtp server address can be specified (just so the form validation would be happy)
I'm on v23.7.12 and would love to see the official integration. If I can help with testing, I will.
Hi,
I was trying to setup a notification to be sent when a host goes down.
It works, but in the message that I receive on Telegram I would like to see the IP that failed.
I'm attaching my configuration.
Thanks!
Hi
i think the quickest way to do this with the $SERVICE monit variable:
change "Service name" to something like "My_server_check" and
change Telegram message template ('Message' field with 'Advanced mode' enabled in Telegram settings) to something like:
<b>DATE:</b> {MONIT_DATE}
<b>HOST:</b> {MONIT_HOST}
<b>SERVICE:</b> {MONIT_SERVICE}
<b>DESCRIPTION:</b>
<pre>{MONIT_DESCRIPTION}</pre>
to include this variable to message