I'm in need of a little scripting assistance. I'm trying to write a router
script that gets the current link speed of all the interfaces on a router and
compare that against the previous value that was received from that same script.
Below is the script that I have so far. Right now it loops through all of the
interfaces, checks to see if there is an active Ethernet link, then it gets the
current rate and compares it to the string "1Gbps", if it's not 1Gbps it then
puts a message in the log for for that interface. What I can't figure out is
how to store a variable as part of the variable name so that I can compare it
to the current value to see if the link changed, which is what I really want to
know. But I need that stored value in order to check against it, rather than
the string 1Gbps.
:global identity ([/system identity get name])
:foreach interface in=[/interface ethernet find] do={
/interface ethernet monitor numbers=$interface once do={
:if ("$status" = "link-ok") do {
:if ("$rate" != "1Gbps") do {
:log info message=($name . " is set to " . $rate)
}}}}
This will eventually send an email, I just have it logging right now to keep my
inbox from getting flooded. And before anyone says it. Yes, I know that the
built in logging can do this, but we have over 100 routers and figuring out
which one sent out a message is not an entirely non-time consuming task, and I
ultimately we would like a little more information in the email than what the
logging system provides.
Any assistance is greatly appreciated.
--
Christopher Tyler
MTCRE/MTCNA/MTCTCE/MTCWE
Total Highspeed Internet Services
417.851.1107
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik
Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS