Please don’t cross-post, @mmdelhajj. I just deleted a duplicate of your post above in the linked thread. If you want this post merged into the other thread, you can ask and have the matter considered, but don’t open the same topic in multiple locations.
Also, in case you’re wondering how you ended up with a dedicated topic, it’s because you originally necroposted this question to a nearly-unrelated 2022 thread.
This is the temperature monitoring script I am using on some switches and it works with 7.15.2
:local DesiredTemp 70
:local MonitoredSensor "phy-temperature"
:local NotifyTo "notify@to.com"
:local NotifyFrom "RouterOS-Monitor<noreply@domain.com>"
:local DeviceName [/system identity get name];
:local CurrentTemp [/system/health get [find name=$MonitoredSensor] value]
:local LogMessage ""
:global IsNotifiedAbove;
:global IsNotifiedBelow;
{
:if ($CurrentTemp>$DesiredTemp) do={
:if ($IsNotifiedAbove !=1) do= {
:set LogMessage "Temperature for $MonitoredSensor is over the limit: $CurrentTemp Celsius"
:log warning $LogMessage;
/tool e-mail
set from="$NotifyFrom"
send to="$NotifyTo" \
subject="Temperature warning on $DeviceName" body="The current temperature for $MonitoredSensor of $CurrentTemp Celsius is over the set limit of $DesiredTemp Celsius" ;
:set IsNotifiedAbove 1;
:set IsNotifiedBelow 0;
}
}
:if ($CurrentTemp<$DesiredTemp) do={
:if ($IsNotifiedBelow !=1) do= {
:set LogMessage "Temperature for $MonitoredSensor is now back to normal: $CurrentTemp Celsius"
:log warning $LogMessage;
/tool e-mail
set from="$NotifyFrom"
send to="$NotifyTo" \
subject="Temperature warning on $DeviceName" body="The current temperature for $MonitoredSensor of $CurrentTemp Celsius is now under the set limit of $DesiredTemp Celsius" ;
:set IsNotifiedAbove 0;
:set IsNotifiedBelow 1;
}
}
}
Yep, but a decalogue roughly similar to the following should be made sticky:
DO NOT EVEN THINK OF UPGRADING
to a later, more recent RoS version than the one you are currently running, UNLESS:
you have reviewed line by line EACH and EVERY change listed in EACH and EVERY ROS release published after your current one and up to the one you wish to upgrade to
you have BOTH:
2.a. a backup of the current configuration
2.b. an export of the current configuration
you are already familiar with both the reset and the netinstall procedures and can use Winbox and SSH
you are sure, double sure and triple sure that the release you want to upgrade to:
4.a. has an added feature that you really-really need
4.b. has NOT reported bugs that may affect your configuration
you have physical access to the device (NO remote upgrade)
you are prepared to the common need to correct/rewrite/modify your scripts (if any) to make them work with the new version (syntax often changes, in some cases in very subtle ways)
you have the possibility and time to troubleshoot possible issues created by either your old configuration (that is working by sheer luck on the older version, due to this or that quirk of the ROS) or by (documented or undocumented) possible changes in the way the new ROS version interprets your settings
you really know what you are doing or you were suggested to upgrade by an expert member of the forum (providing a valid reason why the upgrade is advised)
you have something that is currently not working as it should in your device and you are reasonably convinced that the new version may solve the problem
you have faith in your abilities and experience with the tools and procedures mentioned and with ROS
If you miss even one of the points in the above decalogue, wait before upgrading and ask for advice.