Community discussions

MikroTik App

Search found 51 matches

by mike548141
Wed Feb 14, 2024 12:06 pm
Forum: Scripting
Topic: Test if array is associative, multi-dimensional, or simple list [SOLVED]
Replies: 15
Views: 1422

Re: Test if array is associative, multi-dimensional, or simple list [SOLVED]

there is a regex inside to know if strings need to be escaped in YAML that might be useful if your were going to add YAML to your script. ... So you can also check the array "subtype" in two-value foreach like: Thanks - those both look good! I actually mainly use my $YAML function to &quo...
by mike548141
Tue Feb 13, 2024 9:12 am
Forum: Scripting
Topic: Test if array is associative, multi-dimensional, or simple list [SOLVED]
Replies: 15
Views: 1422

Re: Test if array is associative, multi-dimensional, or simple list [SOLVED]

if ->0 is undefined ("nothing"), but the lenght is > 0, the array have only key pairs, if last ->n is defined (can also be "nil"), and is the same length (- 1) of the array, the array have only numeric values. Thanks for all the example code to test the array types, I will give ...
by mike548141
Tue Feb 13, 2024 9:10 am
Forum: Scripting
Topic: Test if array is associative, multi-dimensional, or simple list [SOLVED]
Replies: 15
Views: 1422

Re: Test if array is associative, multi-dimensional, or simple list [SOLVED]

You can iterate array and check its elements type to determine this or just use 1st element as reference, but how you will handle mix? Yeah that script already walks the array elements to convert RouterOS data types to JSON data types. If its a mix or a key/value then it will map to a JSON object o...
by mike548141
Tue Feb 13, 2024 9:03 am
Forum: Scripting
Topic: Test if array is associative, multi-dimensional, or simple list [SOLVED]
Replies: 15
Views: 1422

Re: Test if array is associative, multi-dimensional, or simple list [SOLVED]

FWIW, while no "pretty print"... v7.13 has JSON support as built-in function Yip I'm aware thanks, and I expect I will swap to that eventually as I've no interest in reinventing the wheel - I've been using that script [well an older version] for the last few years on 6.x and early 7.x thu...
by mike548141
Mon Feb 12, 2024 9:40 am
Forum: Scripting
Topic: Test if array is associative, multi-dimensional, or simple list [SOLVED]
Replies: 15
Views: 1422

Test if array is associative, multi-dimensional, or simple list [SOLVED]

I'm hoping someone will tell me I'm missing something obvious. I'm trying to find a way for a RouterOS script to test if an array is a simple list of values, an associative array (key,value pairs), or a multi-dimensional array (a list of array's within a array). [Descriptions in brackets in case I'm...
by mike548141
Tue Jul 25, 2023 1:50 pm
Forum: Scripting
Topic: Built in function library
Replies: 142
Views: 138266

Re: Built in function library

Other ideas... if...else if...else It would be great to have the option to use elif (else if) within a if statement rather than nesting new if statements within a else. :if ($something = "abc") do={ :put "Thing 1"; } elif ($something = "def") do={ :put "Thing 2&quo...
by mike548141
Tue Jul 25, 2023 1:06 pm
Forum: Scripting
Topic: Built in function library
Replies: 142
Views: 138266

Re: Built in function library

Filesystem Some basic file and directory handling like mkdir, I work around that using /tool fetch but would prefer not to have too. There is now "/file/add name=" in the latest V7's. Directories kinda fake in RouterOS as they are constructed from the "/" in the name= .... so st...
by mike548141
Tue Jul 25, 2023 12:58 pm
Forum: Scripting
Topic: Built in function library
Replies: 142
Views: 138266

Re: Built in function library

@mike548141 When you have commands that could not work on every device then you can avoid errors by using do {} on-error={} :do { /system/hardware } on-error={ :error "error: script not executable on this device " } :do { /system/hardware } on-error={ :log "error: script X not execut...
by mike548141
Mon Jul 24, 2023 11:19 am
Forum: Scripting
Topic: Built in function library
Replies: 142
Views: 138266

Re: Built in function library

Some ideas Syntax checking A big one for me would not be a new function, but making scripting easier across everyting using the Mikrotik platform. RouterOS on a CHR virtual device does not have /system/routerboard/ in the CLI so a script will give a syntax error when it trys to load the script into ...
by mike548141
Sat Jun 11, 2022 12:14 pm
Forum: Scripting
Topic: /command/find count-only [SOLVED]
Replies: 2
Views: 1477

/command/find count-only [SOLVED]

I think it would be really useful if find had an equivalent control to prints count-only e.g.
/interface/bridge/find count-only where 
If you know of an equivalent command, or maybe have created a short script to do the same I would love to see it.

Thanks,

MC
by mike548141
Sun Mar 27, 2022 2:11 pm
Forum: General
Topic: Public-Mikrotik-Bandwidth-Test-Server(s)
Replies: 1011
Views: 1130752

Re: Public-Mikrotik-Bandwidth-Test-Server(s)

Thank you for operating this service, its really helpful. I only tested IPv4, my address 167.179.216.63 in Wellington, New Zealand. I'm on a UFB (fibre network in NZ) using Nova Energy as the ISP, on a 950 Mbps down / 450 Mbps up plan. Testing from my IGW which is a RB4011iGS+RM running ROS 7.1.1. I...
by mike548141
Sun Jan 30, 2022 12:18 pm
Forum: Wireless Networking
Topic: Is/Would be there support for client roaming (802.11k,802.11r,802.11v,802.11w) ...
Replies: 24
Views: 20945

Re: Is/Would be there support for client roaming (802.11k,802.11r,802.11v,802.11w) ...

Even the cheapest access points given as freebies with ISP contracts now support it. MikroTik is the last in the WiFi world to add these. When we are unlucky, they will put the support for this only in their wave2 driver which will run (almost) only on new devices. (due to the silly 16M flash used ...
by mike548141
Wed Jan 12, 2022 3:51 pm
Forum: RouterOS beta
Topic: Checking if these are bugs
Replies: 0
Views: 3417

Checking if these are bugs

Hi I'm not sure if these are expected, pecular to my setup, or bugs in v7 so I thought I would check here first. I'm seeing this on a range of RB models running v7.1. 1. NTP client NTP client is working as expected (command below) but the list of servers in WebFig are blank (see screen shots). /syst...
by mike548141
Tue Jan 11, 2022 2:21 am
Forum: General
Topic: Faulty wAP LR9 LoRaWAN [SOLVED]
Replies: 2
Views: 1421

Re: Faulty wAP LR9 LoRaWAN [SOLVED]

Ok I started trying older versions of RouterOS and NetInstall to see if that got the LR9 operational. First I tried 6.48.6 long term, NetInstall said that it successfully formatted the drive in the LR9 and installed the RouterOS package. At the end it says it completed the successfully, but the LR9 ...
by mike548141
Tue Jan 11, 2022 2:02 am
Forum: RouterBOARD hardware
Topic: New LR9 not booting [SOLVED]
Replies: 4
Views: 6349

Re: New LR9 not booting [SOLVED]

Found the fix - see this post viewtopic.php?p=903280
by mike548141
Sun Jan 09, 2022 8:15 am
Forum: Scripting
Topic: Built in hash function
Replies: 1
Views: 3372

Re: Built in hash function

I know this is 7 years later - but thought I would post the idea in case some one is Googling for a similar idea. My recommendation would be to use OTP to create a unique password, and then store that password in a file in the devices local storage. Not great security but neither is using the same p...
by mike548141
Thu Jan 06, 2022 6:10 am
Forum: General
Topic: Faulty wAP LR9 LoRaWAN [SOLVED]
Replies: 2
Views: 1421

Re: Faulty wAP LR9 LoRaWAN [SOLVED]

Some extra details RE NetInstall - NetInstall is v7.1.1 running on Windows 10 x64 English v1709 with VirtualBox Guest Additions v6.1.30. VirtualBox 6.1.30 is running on macOS 12.1 on a MacBook Pro (MBP). The VM has 2 virtual network interfaces, the first mapped to a ThunderBolt ethernet adapter that...
by mike548141
Thu Jan 06, 2022 3:12 am
Forum: General
Topic: Faulty wAP LR9 LoRaWAN [SOLVED]
Replies: 2
Views: 1421

Faulty wAP LR9 LoRaWAN [SOLVED]

Hi everyone, I think my wAP is faulty, looking for help on how to diagnose and repair it. Otherwise I will need to return it. I brought a Mikrotik wAP LR9 to test out creating a LoRaWAN network but I can't get it to show up as a new device on the network i.e. as a IP neighbour on the CRS328 switch. ...
by mike548141
Thu Jan 06, 2022 2:18 am
Forum: General
Topic: VAP to sniff Beacon's and Probe Requests
Replies: 4
Views: 1724

Re: VAP to sniff Beacon's and Probe Requests

You need secondary radio. In ROS it's not possible to run sniffer and AP at the same time... and then you would still be limited to just single channel. But if you only need to get nearby APs, you can use wifi scanner with "background scan" option, that works even when AP is running and s...
by mike548141
Tue Dec 07, 2021 1:10 pm
Forum: General
Topic: VAP to sniff Beacon's and Probe Requests
Replies: 4
Views: 1724

Re: VAP to sniff Beacon's and Probe Requests

You could be right - but then it must be able to listen to multiple channels to be able to listen for beacons & probes when the radio is in a monitor state. I don't know either way - was hoping someone here could give a definitve answer with some detail. The alternative is of course a separate p...
by mike548141
Tue Nov 16, 2021 11:12 am
Forum: General
Topic: VAP to sniff Beacon's and Probe Requests
Replies: 4
Views: 1724

VAP to sniff Beacon's and Probe Requests

Sniffing WiFi Beacon's , Probe Requests, and Probe Responses has been discussed in various previous posts and is possible on the Mikrotik WAP's. But /interface wireless sniffer sniff requires exclusive access to the radio e.g. it won't work when CAP is enabled. Could RouterOS be enhanced so that you...
by mike548141
Sun Nov 14, 2021 10:26 am
Forum: Scripting
Topic: Using where to see if value is in an array [SOLVED]
Replies: 3
Views: 4961

Re: Using where to see if value is in an array [SOLVED]

~ tries to do a regex match on the value as a string. Thanks for replying @sin3vil and @rextended. For some reason I had it in my head that ~ was a partial match (aka contains vs = or !=) but I went back to the docs after posting my question here and saw it was actually regex as you say. But ran ou...
by mike548141
Sat Nov 13, 2021 1:01 pm
Forum: General
Topic: High availability for RoutrOS services
Replies: 1
Views: 814

High availability for RoutrOS services

I'm running 2 CRS328 switches, one of which is providing a few services that I would love to make more resilient Does anyone have pointers that would allow these services to run on both services in a active/active or active/passive configuration for high availability should one service or switch fai...
by mike548141
Fri Nov 12, 2021 3:38 am
Forum: Scripting
Topic: Using where to see if value is in an array [SOLVED]
Replies: 3
Views: 4961

Using where to see if value is in an array [SOLVED]

How are people scripting the use of the where statement to find a value in an array? (see example below) In this example I am trying to see if a bridge VLAN contains an interface name in its array of untagged interfaces. The issue I have is terminating the value in the example below i.e. untagged~($...
by mike548141
Mon Nov 01, 2021 1:35 am
Forum: RouterBOARD hardware
Topic: New LR9 not booting [SOLVED]
Replies: 4
Views: 6349

Re: New LR9 [SOLVED]

What is an LR9?
@sup5 Its a Mikrotik wireless access point for LoRAWAN https://mikrotik.com/product/wap_lr9_kit
by mike548141
Sun Oct 31, 2021 2:25 am
Forum: RouterBOARD hardware
Topic: New LR9 not booting [SOLVED]
Replies: 4
Views: 6349

Re: New LR9 [SOLVED]

I should have said - I have factory reset it a few times as well to no affect (using the reset button at boot). I've not tried a netinstall yet

MC
by mike548141
Sat Oct 30, 2021 7:29 am
Forum: RouterBOARD hardware
Topic: New LR9 not booting [SOLVED]
Replies: 4
Views: 6349

New LR9 not booting [SOLVED]

Hi, Anyone experienced with the LR9 's? I brought one to play with, straight out of the box and plugged into a CRS328 and it is powering up via PoE, the LED's show ethernet activity, but it does not show up in the CRS328 IP neighbours. And its not accessible on the default IP. Does it not boot up wi...
by mike548141
Thu Jul 29, 2021 12:29 pm
Forum: RouterBOARD hardware
Topic: Hardware recommendation for Internet gateway [SOLVED]
Replies: 7
Views: 3127

Re: Hardware recommendation for Internet gateway [SOLVED]

Thanks for the advice, I think I will go with the RB4011

MC
by mike548141
Mon Jul 26, 2021 6:44 am
Forum: RouterBOARD hardware
Topic: Hardware recommendation for Internet gateway [SOLVED]
Replies: 7
Views: 3127

Hardware recommendation for Internet gateway [SOLVED]

Hi I am looking for your recommendations on a model of Mikrotik ethernet router to use as an Internet gateway at home. I am currently using a hEX PoE but I'm only getting about 400 Mbps through it using https://www.speedtest.net/ , that could be a config issue on my part so let me know if you would ...
by mike548141
Wed Jun 30, 2021 1:12 pm
Forum: Wireless Networking
Topic: Failed to join CAPsMAN (CAP lost connection, send timeout)
Replies: 9
Views: 10353

Re: Failed to join CAPsMAN (CAP lost connection, send timeout)

This is quite old but I had the same situation and finally found out what was wrong (in my case). My Cap was also set to certificate=request and after a while I found out that this was causing the issue. Looking at the detailed Caps Log on the CAPsMan it showed that the CAPsMan could not generate a...
by mike548141
Mon Jun 28, 2021 3:16 pm
Forum: RouterBOARD hardware
Topic: Add bluetooth radio to cAP ac or similar AP's
Replies: 1
Views: 1663

Add bluetooth radio to cAP ac or similar AP's

Hi First sorry if this is a duplicate post, I had a search but I wasn't sure what keywords people would use. If it is a duplicate please let me know and I can delete. I would love the WiFi access points (cAP ac, wAP ac etc) to have a bluetooth radio built in for a few reasons 1. Sniffing for bluetoo...
by mike548141
Mon Jun 28, 2021 2:38 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

error because is missing the $ at the start of variable First of all @rextended thank you for the detailed explanation(s) in your post. It helped me progress debugging this. I tested your example code and the $variablename certainly does remove the syntax error from the :set command, but the set co...
by mike548141
Wed Jun 23, 2021 3:07 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

Copy your code in system scripts and run print in the terminal, it will highlight all the syntax errors you have. @mrz thanks that certainly helped to narrow it down. I've reduced it down to the following few lines and I still have a syntax error. I assume that I am either using a reserved name or ...
by mike548141
Wed Jun 23, 2021 12:48 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

Copy your code in system scripts and run print in the terminal, it will highlight all the syntax errors you have.
Will do that thanks, better debug than the import verbose etc...
by mike548141
Wed Jun 23, 2021 12:43 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

(⊙_⊙) what great idea!!! On 15 years I never think that!!! Thanks... @rextended there seems to be a lot of attitude and passive aggression in your replies - I don't know what that is about, but unfortunately its not uncommon in some forums. Anyway if my replies annoyed you then that was not my inte...
by mike548141
Tue Jun 22, 2021 4:22 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

Post the complete script, not just the pieces. All variables are not initialized, anything could have been done before. On what device and on what version of routeros? I will need to redact some parts of it as it contains secrets etc... and I would prefer to not have my entire internal network conf...
by mike548141
Tue Jun 22, 2021 3:47 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

PS I use SFTP to transfer the script file onto the Mikrotik in case that is relevant. Is its possible I'm hitting some limit e.g. size of the script, number of lines in the script, line length in the script etc... I've also just tried deleting line 281 and a couple of lines either side of it and I s...
by mike548141
Tue Jun 22, 2021 3:44 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

Did you open file with text editor? What exactly is on line 281 column 10? If I run the /import with verbose this is the output it gives me. I've excluded the rest to focus just on the section its referencing. Line 281 where it reports a syntax error is "# Model specific config". [admin@M...
by mike548141
Tue Jun 22, 2021 3:34 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Re: Syntax error in script file due to encoding? [SOLVED]

I've tried using Notepad++ to re-encode the script file to ANSI, UTF-8, and UTF-8-BOM in addition to the us-ascii that I was already using. No luck, they all give the same syntax error except for UTF-8-BOM which gave the error expected command name (line 1 column 1) which I assume to mean it couldn'...
by mike548141
Tue Jun 22, 2021 12:41 pm
Forum: Scripting
Topic: Syntax error in script file due to encoding? [SOLVED]
Replies: 16
Views: 7142

Syntax error in script file due to encoding? [SOLVED]

I'm stumped. I have a script that I am using to configure a range of RouterOS devices from their default config out of the box and the script works perfectly if I paste it in via serial console or SSH. However if I try to use the same script as part of a system reset it fails with a syntax error. I ...
by mike548141
Tue Jun 22, 2021 8:12 am
Forum: General
Topic: Feature requests
Replies: 1744
Views: 639907

Re: Feature requests

The :log command should accept a variable for the log event severity e.g.
:log $severity message=$message;
by mike548141
Sun Jun 20, 2021 1:29 pm
Forum: Scripting
Topic: Calculate the difference between two dates
Replies: 7
Views: 9764

Re: Calculate the difference between two dates

Posting this code here just in case its useful for someone. Its shorter than the code above and returns a timestamp as an array. # This function returns the current date (YYYYMMDD) and time (HHMMSS) as an array :global timestamp do={ :local tsdate [ /system clock get date; ]; :local tstime [ /system...
by mike548141
Fri Jun 18, 2021 11:13 am
Forum: General
Topic: Feature requests
Replies: 1744
Views: 639907

Re: Feature requests

If an ethernet interface has been made a slave of a bonded interface (e.g. LACP) then it should have a value assigned on the physical interface that tells you (a) it is bonded and (b) the name of the bonded interface. This way when querying interfaces from a script we can see whats bonded by looking...
by mike548141
Wed Jun 16, 2021 2:41 am
Forum: Scripting
Topic: print count-only without printing to console [SOLVED]
Replies: 6
Views: 3330

Re: print count-only without printing to console [SOLVED]

Thanks for the feedback/answers @eworm & @rextended, I'm not surprised its not possible to make the count-only silent but I was hoping that someone had a way. Maybe its just me, but to me the print count-only is cleaner code to read, and requires fewer CPU cycles & memory than a :len to exec...
by mike548141
Tue Jun 15, 2021 5:37 am
Forum: Scripting
Topic: print count-only without printing to console [SOLVED]
Replies: 6
Views: 3330

print count-only without printing to console [SOLVED]

Hi I use "print count-only where" in scripts quite a bit (example below) as its cleaner than using :len. The down side is I get unwanted integers printed to the console which are the counts. Is there a way that I can use a count only without printing the result to console? The only way I c...
by mike548141
Thu May 20, 2021 2:21 am
Forum: General
Topic: Feature requests
Replies: 1744
Views: 639907

Re: Feature requests

With the default NTP client I can use DNS FQDN's to specify the NTP sources, but if I install the NTP server package I can only specify IP addresses as the NTP sources. Not ideal since the IP addresses change over time and are out of my control (and the same for most people using an Internet NTP sou...
by mike548141
Tue Aug 18, 2020 4:04 am
Forum: Scripting
Topic: Sharing my mkdir (make directory) method [SOLVED]
Replies: 4
Views: 2506

Re: Sharing my mkdir (make directory) method [SOLVED]

This functionality have been requested for years. Having to use above methods for something so trivial and basic is just sad.
I have to agree r00t, it really should not need these types of hacks for basic file system management
by mike548141
Tue Aug 18, 2020 4:03 am
Forum: Scripting
Topic: Sharing my mkdir (make directory) method [SOLVED]
Replies: 4
Views: 2506

Re: Sharing my mkdir (make directory) method [SOLVED]

Following is a RouterOS trick that I use to make a directory via CLI [Terminal]
Nice one thanks mozerd I like that better than my FTP method
by mike548141
Mon Aug 17, 2020 2:16 pm
Forum: Scripting
Topic: Sharing my mkdir (make directory) method [SOLVED]
Replies: 4
Views: 2506

Sharing my mkdir (make directory) method [SOLVED]

I was surprised that I could not create directorys on the local storage natively. I hate that it relies on FTP but it works. Sharing for others. # To reduce the security risk limit FTP to only connections from the device itself set ftp disabled=no address=127.0.0.1/32; # Create a user and group to g...
by mike548141
Sun Aug 16, 2020 5:20 am
Forum: Scripting
Topic: Built in function library
Replies: 142
Views: 138266

Re: Built in function library

To me the singularly most important addition would be opening this up to the community so that they could create and share functions safely and easily. So that you can leverage all the developers to contribute to a user extensible library.