OPNsense Forum
Archive => 23.1 Legacy Series => Topic started by: bcookatpcsd on April 23, 2023, 07:29:43 pm
-
Searching brings up old posts regarding this..
Is there a way that I could get notifications about my system status? reboots, update results, etc.?
Reporting section of the manual seems to be about system services.. but I would like the system to reach out and let me know an event happened..
Is there a plugin that possibly I missed that already does this?
Or is the suggestion to setup postfix and relay to my smtp2telegram instance?
Thanks in advance
-
I've just tried https://github.com/matriphe/monit2telegram (https://github.com/matriphe/monit2telegram) for telegram notifications and it works in opnsense with some minor changes like placing the files in /usr/local/{bin,etc} and editing their contents to use these new paths and the correct shell path in Opnsense: /usr/local/bin/bash. bash might also need installing, I don't remember if it comes preinstalled.
-
Hopefully this thread isn't too old, but I have managed to get this working, sort of. I've gotten all the way to the last part, adding the 2 lines to the config file.
"check file nginx.pid with path /var/run/nginx.pid
if changed pid then exec "/usr/local/bin/monit2telegram"
The first problem is, nginx.pid doesn't exist. There is a monit.pid file, and if I enter that instead, I still get an error in the monit log "syntax error 'pid' " for line 2.
Also, the monit2telegram file has a line
"/usr/local/bin/sendtelegram -c /etc/telegramrc -m "Monit $MONIT_SERVICE - $MONIT_EVENT at $MONIT_DATE on $MONIT_HOST: $MONIT_ACTION $MONIT_DESCRIPTION.""
If i manually trigger monit2telegram, the message I get is "Monit - at on :" so obviously those $MONIT commands or whatever either are wrong, or are different in Opnsense. I'm not really clear where that data is actually supposed to be pulled from. Any help would be greatly appreciated! Thanks in advance!
-
Any news? i'm stuck as Justin...
Thank you
-
I am not using Monit so only from a generic point of view. The last part referenced here seems just an example, and is expecting the user to set a check in Monit, in this case, Monit is running on OPN.
In Justin case it told Monit to test for the presence of nginx.pid file in that path and would only exist if that service was running at the time. Probably he doesn't have nginx running so the test would fail.
-
https://hub.docker.com/r/kostyaesmukov/smtp_to_telegram
Seems to be maintained..
root@void-d51d87 ~# docker ps -a | grep telegram
2a9a2fb173a0 kostyaesmukov/smtp_to_telegram:latest "/smtp_to_telegram" 2 weeks ago Up 2 weeks smtp_to_telegram
docker run \
--name smtp_to_telegram \
--restart unless-stopped \
-e TZ=America/New_York \
-e ST_TELEGRAM_CHAT_IDS=xyz123abc456 \
-e ST_TELEGRAM_BOT_TOKEN=8< SNIP >8 \
-e ST_TELEGRAM_MESSAGE_TEMPLATE="Subject: {subject}\\n\\n{body}" \
-d \
--network host \
kostyaesmukov/smtp_to_telegram
https://github.com/KostyaEsmukov/smtp_to_telegram
Looks to be a go program.. possibly could be made into a plugin
-
Agreed:
Request
https://github.com/opnsense/core/issues/7080