Forward all messages to telegram

Hi, everyone!

I setup simple netwatch script for sending me message in telegram if no ping on my pihole server and switching to another ip.

:local status "UP"
:local deviceName [/system identity get name]
:local deviceDate [/system clock get date]
:local deviceTime [/system clock get time]
:local PIHOLE "<pi_hole_server>"
:local Google "8.8.8.8"
:local TelegramBotToken "<bot_token>";
:local TelegramChatID "<chat_id>";
:local TGSendMessage do={
    :local tgUrl "https://api.telegram.org/bot$Token/sendMessage?chat_id=-$ChatID&text=$Text";
    /tool fetch http-method=get url=$tgUrl keep-result=no;
}

:local textSent "\F0\9F\9F\A2 $deviceName%0A$deviceDate $deviceTime : %0A$PIHOLE is $status %0ADNS = $PIHOLE %0A\E2\9C\85"

	/ip dns set servers=$PIHOLE
	/ip dns cache flush
	$TGSendMessage Token=$TelegramBotToken ChatID=$TelegramChatID Text=$textSent;

My question - is it possible to receive all messages which I usually getting from mikrotik by email, but in telegram? I setup logging for ‘account’, ‘critical’ and ‘error’ topics.
For example I have these messages in mail box :

  1. system,info,account user logged in from <myLocal_ip> via winbox
  2. system,critical,info cloud change time Dec/15/2022 11:45:46 => Dec/16/2022 17:45:02
  3. dhcp,error defconf: failed to give out IP address: pool is empty
    And extra question
  4. Is it possible to somehow write script that will notify me if router is turned on? Pretty actual now when electricity infrastructure was ruined by f2cking russians and I want to know if my home router is working again or still no electricity at home.
    And last question: where can I get all commands similar to [/system identity get name] ? For example I want to get cpu temp or cpu loading in current time.

You may want to check my script Forward log messages via notification. It does a lot of what you want, including the power up notification (by forwarding “router rebooted without proper shutdown…”)

Also have a look at all available scripts , for example I have some enhanced scripts for netwatch to notify and handle DNS.

Thank you! First impression - a lot of action needed before $ScriptInstallUpdate log-forward;

Yes, but it brings some extra features… And you are free to use all the other scripts, which use the same configuration and functions.