Have I missed the point? :tobool ([:find ("|"."Managed by DuxAdmin SetID:443 RuleID:538") "Managed by DuxAdmin SetID:443"] > 0)] gives true and :tobool ([:find ("|"."Managed by DuxAdmin SetID:443 RuleID:538") "Managed by DuxAdmin SetID:444"] > 0)] gives false Which should act as a match conditional. Steve. -----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Mike Everest Sent: Thursday, 15 May 2014 08:40 To: 'MikroTik Australia Public List' Subject: Re: [MT-AU Public] API Wildcard search Hi Andrew! Thanks for your response :-) That is all fine, but our rule comments will actually look something like: "Managed by DuxAdmin SetID:443 RuleID:534" "Managed by DuxAdmin SetID:443 RuleID:535" "Managed by DuxAdmin SetID:443 RuleID:536" "Managed by DuxAdmin SetID:443 RuleID:537" "Managed by DuxAdmin SetID:441 RuleID:538" "Managed by DuxAdmin SetID:441 RuleID:539" "Managed by DuxAdmin SetID:441 RuleID:540" "Managed by DuxAdmin SetID:446 RuleID:541" So potentially we will want to search for either a specific RuleID OR a specific SetID (or perhaps both, if an explicit single item is searched) The problem for us right now is that there appears to be no way to match a partial string, i.e. [:find $rulecomment "Managed by DuxAdmin SetID:443*"] The '>' operator appears to work, but without understanding HOW that operator is actually evaluated, we can't be certain that it is generally correct ;) Cheers! Mike.
-----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Andrew Cox Sent: Wednesday, 14 May 2014 11:01 PM To: MikroTik Australia Public List Subject: Re: [MT-AU Public] API Wildcard search
Going from my head on this one, but the CLI way for this to work for this would be
:foreach counter in=[/ip firewall filter find] do={ :local rulecomment [/ip firewall filter get $counter comment] :if ([:find $rulecomment "Managed by DuxAdmin SetID:443"] != "") do={ *#code you want to run goes here, using $counter to pick the line you're editing* } }
- Andrew
On 14 May 2014 21:42, Paul Julian <paul@oxygennetworks.com.au> wrote:
Hey Mike, does this syntax actually work when doing the find in the CLI on the router itself ?
Regards Paul
-----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Mike Everest Sent: Wednesday, 14 May 2014 9:29 PM To: 'MikroTik Australia Public List' Subject: Re: [MT-AU Public] API Wildcard search
Hi folks!
Further to my original post (below) I have had some further correspondence with MT (Janis K) regarding these questions, but really getting nowhere useful yet ;-)
At least I have been able to confirm that there is no wildcard or regex feature in API query structure (apparently 'regex is not available via API in any form' ;-) and the suggested approach is to download the entire data to the client and parse client side, which is quite a PITA for the implementation that we are building here :(
I am yet to get any sensible description of how the operators '<' and '>' actually work on text at all (i.e. is it like strcmp kind of functionality, or something else?) but taking my usual tack when dealing with MT support and just repeating the question over and over until they offer an answer that addresses the actual question! :-D
When I get such a result, I will post again to this thread for prosperity of all!
Cheers, Mike.
-----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Mike Everest Sent: Sunday, 27 April 2014 10:37 AM To: public@talk.mikrotik.com.au Subject: [MT-AU Public] API Wildcard search
Hi folks,
Anyone have some experience using routerOS API?
I've been extending the configuration group functionality of our DuxTel Commander, and come up against a challenge in filtering API query (http://wiki.mikrotik.com/wiki/API#Queries)
The deal is that I use 'comment' field as a way to cross-reference router configuration entries with the configuration database items. For example, a firewall rule might look like:
ip firewall filter add chain=forward src-address-list=blocked action=drop comment='Managed by DuxAdmin SetID:443 ItemID:27'
So when I want to find all the firewall rules with SetID:443, I can do this:
/ip/firewall/filter/find ?>comment=Managed by DuxAdmin SetID:443
Which seems to work OK, but I can't work out how to return just those entries that include 'ItemID:27'
I'll put the question to MT support and post a solution (if there is one) if/when they respond, but if anyone has some suggestions, I'm 'all ears'! ;-)
Cheers, Mike.
_______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com. au
----- No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4570 / Virus Database: 3931/7437 - Release Date: 05/03/14 Internal Virus Database is out of date.
_______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com. au
_______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au
_______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au