I have this script running every 30 seconds with scheduler. I repeatedly receive an email every 30 seconds. Can I ensure that I only receive one email if the router is too hot?
Otherwise I will be spammed with the same error.
Please advise
:log info ("$[/system health get temperature]")
:if ([/system health get temperature]>10) do={/tool e-mail send to="youremail@gmail.com" subject=[/system identity get name] body=("High temperature. Current temperature is: ".[/system health get temperature])}
Sorry but this does not help me.
I know there is a way to send an email once with the same error.
But I lost the code. This was given to me by Rextended.
Hi Plisken, I hope this idea will be helpful for you:
:global temperaturePrevious
:local temperatureCurrent [/system health get temperature]
:log info ("$temperatureCurrent")
:if (($temperatureCurrent>10) and ($temperaturePrevious<=10)) do {
/tool e-mail send to="youremail@gmail.com" subject=[/system identity get name] body=("High temperature. Current temperature is: ".$temperatureCurrent)
}
:set temperaturePrevious $temperatureCurrent
Before starting above script you will need startup script (schedule it to run at router startup) that builds the $temperaturePrevious variable. Create the script and run it once manually for the first time if you are adding it to the live system instead of rebooting the router:
:global temperaturePrevious [/system health get temperature]
If I understand correctly.
Once I have started that script, will the monitoring continue without a scheduler?
This once I start the script manually? Is that correct?
There is nothing wrong with your scripts but I don’t understand them.
I have little experience with scripts.
This is not your fault. I would like to know the background how this works.
I appreciate your help.
Hi Plisken, you have to schedule the main script to run in intervals you like and set the temperature numbers to match your needs, and global variable one to be scheduled to run at startup. You can manually run main script as many times as you like, but first you have to run once the “startup” script so everything is correct.
Eworm, I apologise if you have already written the solution somewhere on your website, I rarely open external links on public forums. I didn’t mean to disrespect anyone.
I have a collection of script, one of them does what plisken wants - and a lot more. But it is complex and depends on other scripts. If you want something that just works - use my scripts.
Looks like plisken wants a simple script he can maintain himself. That’s fine and I am glad you teach him.
(Still there’s not a lot of knowledge required to use my scripts. Everything is documented and you just have to follow the instructions in README. So everybody is invited to try it.)