I currently have a rule that runs the script [ /interface monitor-traffic ether5-slave-local file=keep ] when Tx on ether 5 goes above 10mbps. I want the file to include the system time. I am a newbie and have no idea how to make this happen. I would appreciate any help!
“To include” … what do you mean ?
Inside file or as filename ?
System date includes “/” as separator so it is bad idea to use it in the filename.
System time includes “:” so it is also “not good” character inside name.
:do {
:local sysname
:local time
:local date
:set sysname [/system identity get name]
:set time [/system clock get time]
:set date [/system clock get date]
:put "<$sysname><$time><$date>";
}
when I say include I essentially want [ /interface monitor-traffic ether5-slave-local file=keep(system time) ] the file name would contain the time it was created. I need a changing variable in the file name so it doesn’t just keep writing to the same file. If it is not good to use the system time or date in the file name what you recommend to use.
Use transformed version of time, not the original one.
:do {
:local sysname
:local time
:local time2
:set sysname [/system identity get name]
:set time [/system clock get time]
:set time2 ("$[:pick $time 0 2]$[:pick $time 3 5]$[:pick $time 6 8]")
:put "$sysname_$time_$time2";
}
It is just sample … remeber to avoid special characters.
struggling with getting script to append time to file name of threshup
/interface monitor-traffic ether5-slave file=Threshup
:do {
:local sysname
:local time
:local time2
:set sysname [/system identity get name]
:set time [/system clock get time]
:set time2 (“$[:pick $time 0 2]$[:pick $time 3 5]$[:pick $time 6 8]”)
:put “$sysname_$time_$time2”;
}