irule editor
133 TopicsBIG-IP LTM VE: Transfer your iRules in style with the iRule Editor
The new LTM VE has opened up the possibilities for writing, testing and deploying iRules in a big way. It’s easier than ever to get a test environment set up in which you can break things develop to your heart’s content. This is fantastic news for us iRulers that want to be doing the newest, coolest stuff without having to worry about breaking a production system. That’s all well and good, but what the heck do you do to get all of your current stuff onto your test system? There are several options, ranging from copy and paste (shudder) to actual config copies and the like, which all work fine. Assuming all you’re looking for though is to transfer over your iRules, like me, the easiest way I’ve found is to use the iRule editor’s export and import features. It makes it literally a few clicks and super easy to get back up and running in the new environment. First, log into your existing LTM system with your iRule editor (you are using the editor, right? Of course you are…just making sure). You’ll see a screen something like this (right) with a list of a bagillionty iRules on the left and their cool, color coded awesomeness on the right. You can go through and select iRules and start moving them manually, but there’s really no need. All you need to do is go up to the File –> Archive –> Export option and let it do its magic. All it’s doing is saving text files to your local system to archive off all of your iRuley goodness. Once that’s done, you can then spin up your new LTM VE and get logged in via the iRule editor over there. Connect via the iRule editor, and go to File –> Archive –> Import, shown below. Once you choose the import option you’ll start seeing your iRules popping up in the left-hand column, just like you’re used to. This will take a minute depending on how many iRules you have archived (okay, so I may have more than a few iRules in my collection…) but it’s generally pretty snappy. One important thing to note at his point, however, is that all of your iRules are bolded with an asterisk next to them. This means they are not saved in their current state on the LTM. If you exit at this point, you’ll still be iRuleless, and no one wants that. Luckily Joe thought of that when building the iRule editor, so all you need to do is select File –> Save All, and you’ll be most of the way home. I say most of the way because there will undoubtedly be some errors that you’ll need to clean up. These will be config based errors, like pools that used to exist on your old system and don’t now, etc. You can either go create the pools in the config or comment out those lines. I tend to try and keep my iRules as config agnostic as possible while testing things, so there aren’t a ton of these but some of them always crop up. The editor makes these easy to spot and fix though. The name of the iRule that’s having a problem will stay bolded and any errors in that particular code will be called out (assuming you have that feature turned on) so you can pretty quickly spot them and fix them. This entire process took me about 15 minutes, including cleaning up the code in certain iRules to at least save properly on the new system, and I have a bunch of iRules, so that’s a pretty generous estimate. It really is quick, easy and painless to get your code onto an LTM VE and get hacking coding. An added side benefit, but a cool one, is that you now have your iRules backed up locally. Not only does this mean you’re double plus sure that they won’t be lost, but it means the next time you want to deploy them somewhere, all you have to do is import from the editor. So if you haven’t yet, go download your BIG-IP LTM VE and get started. I can’t recommend it enough. Also make sure to check out some of the really handy DC content that shows you how to tweak it for more interfaces or Joe’s supremely helpful guide on how to use a single VM to run an entire client/LTM/server setup. Wicked cool stuff. Happy iRuling. #Colin1.3KViews0likes1CommentHelp! how to Change request URL without Redirect
Hope result: When Client access URL is http://abc.com/abc, iRule will chang it to http://abc.com/123/bac/... and send to server. Notice: couldn't use http:redirect uri, since client couldn't support redirect. Please give me some direction! Thanks.1KViews0likes4CommentsReading SOAP header through iRule
Team, Can anyone help me with configuring an iRule script to read a custom SOAP header in an incoming HTTP service request and make my own decision logic based on the content. I basically need to read through a collection SOAP header and scan individual elements in it. I am new to iRule and would appreciate some help on this. Thanks!802Views0likes8Commentsmac osx anyone?
anyone know if f5 has plans to expand their supported platforms at all in the future, particularly osx? i'm interested in seeing the irule editor ported. non-windows platforms are gaining a larger and larger portion of the desktop market both in and out of the enterprise. seems like a good plan to jump on that market early.594Views0likes18CommentsiRule Editor Updates
As you may have noticed today, when you fired up the iRule Editor, that a new version is available for download. I snuck in a couple of releases over the last couple of months and have been meaning on writing up some of the new features so looks like this is my chance. The version information, along with features/enhancements put into each release, is always available from within the F5 iRule Editor Help menu item from within the editor but for those of you to lazy to click the couple of links it takes to get to the "What's New" section of the help, I'll go over the major points here. Administrative Domains With BIG-IP v9.4, the concept of configuration "silos" was added to allow an administrator the ability to place sections of the configuration into "buckets" and assign control of those "buckets" to individual users. Basically allowing the admin to give each user control of only portions of the configuration. If you are running post v9.4, check out the new "Partition" file menu where you can view, and change if you are allowed, the current partition you are working in. Auto Indenting Thanks to one of our awesome DevCentral users for submitting the code changes to allow auto-indenting when the enter key is typed. This will save in a lot of wear-and-tear on your tab or space keys! Enhanced CPU Statistics Reporting This has been a long time coming. Way back, heck I can't even remember exactly how long, unRuleY posted a message to the forums indicating some calculations that can be done on the clock cycle statistics that are presented when the "timing" command is used within your iRule. Last week, Deb published a tech tip with an Excel spreadsheet that will do these calculations for you. I took this as the final kick-in-the-butt to get moving on Editor integration. Well, it's here. Right click on an iRule, select the "Statistics" tab, and you'll be presented with few new options. First, is the CPU Speed. Since this is not directly exposed via iControl, we had to make some assumptions based on the platform that iControl reports you are running on. Click on "Guess" for the Editor to get that info from the BIG-IP and present what the platform guides for your system states that the CPU is running at. For an exact value, you can run "cat /proc/cpuinfo" from the BIG-IP command prompt and search for the CPU speed in MHz. Once you get the clock speed correct, you can view the following metric types CPU Cycles/Request - This is the raw number of clock cycles that the LocalLB::Rule::get_statistics() method returns. So, you can see the smallest (Minimum), Average and Largest (Maximum) number of clock cycles each iRule Event takes to execute. Run Time (ms)/Request - This is the number of milliseconds (1/1000th of a second) that the events take to execute per request. Again, the smallest, average, and largest requests are displayed. Percent CPU Usage/Request - This is the percentage of the CPU that each request took up per request. Max Concurrent Requests - By taking the inverse of the Percent CPU Usage/Request we come up with the max number of requests until maxing out the CPU. Keep in mind that this value assumes that the CPU is 100% dedicated to iRule processing which isn't the case. You'll want to assume a number smaller that this. Enjoy these new features and make sure to let me know what you think of the Editor and any and all new feature requests you would like to see added in the future. -Joe Reading: Confessions of a Economic Hitman Listening To: 155 by +44546Views0likes1CommentEnhanced iRules templates suggestion
I was thinking that the templates in the iRules editor could be greatly expanded and be much more useful for customers with large collections of iRules. My suggestion is to first store a version number in each iRule template file. Then allow input parameters to be defined. This could be accomplished by adding special comments in the first couple lines like: iRule Template "Cookie Rename" Version 1.1 Parameter orig_name: the cookie name you want to rename Parameter new_name: the name you want to rename the cookie to when HTTP_REQUEST { if { [HTTP::cookie exists "__orig_name__"] } { set cookie_s [HTTP::cookie "__orig_name__"] HTTP::cookie remove "__orig_name__" set cookie_a [HTTP::header cookie] HTTP::header replace "cookie" "$cookie_a; __new_name__=$cookie_s" } } Now, when you create an iRule off of the template, it can ask you for values for each parameter. When the rule is created on the BIG-IP, it could be something like this: rule cookie_rewrite_abc { This rule was generated from the template "Cookie Rename" Version 1.1 Parameter orig_name="abc" Parameter new_name="def" MANUAL MODIFICATION IS NOT RECOMMENDED!! when HTTP_REQUEST { if { [HTTP::cookie exists "abc"] } { set cookie_s [HTTP::cookie "abc"] HTTP::cookie remove "abc" set cookie_a [HTTP::header cookie] HTTP::header replace "cookie" "$cookie_a; def=$cookie_s" } } } Now, whenever you change to a newer version of the template, a function could be provided to list all iRules based on that template and allow the user to selectively regenerate the rules with the newer template but the original parameter values. Ideally the iRules editor might store the templates in a binary format to force changes to be done through the GUI so they could be tracked. This could mean that when I make a change to the template above, it could automatically be changed to version 1.2 and all iRules based on version 1.1 could be checked to make sure they have not been manually modified, and if not they could be automatically or mostly-automatically upgraded to the new version. It gets complicated if you want to have multiple instances of the iRules editor with the same templates... then you'd have to store the templates file on a share drive or the like. These are just some initial thoughts, but it could allow somebody to deploy many similar iRules quickly and update those easily when changes are required.510Views0likes2CommentsIrule Editor Syntax Check
I'm a developer tasked with writing the iRule, but they don't give me access to the f5. I toss the iRules over the fence and they send me back syntax errors. And then i blindly make changes and toss them back over the fence. The iRule Editor does not seem to allow syntax checking without connecting to the f5. Not much use to me. Can you make the syntax check available without connection to the f5?499Views0likes3Comments