Forum Discussion

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Currently classes are merely implemented as Tcl lists. So, you can manipulate the class members using the standard Tcl list commands.

     

     

    lappend - add an element to the end of the list

     

    linsert - insert an element into a list

     

    lreplace - replace/delete elements of a list

     

    lset - replace the value of an element of a list

     

  • Is there a way to save these changes to the class, or does it do so automatically?

     

     

    Thanks,

     

    Brian
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    No, there is currently not a way to save the class.

     

     

    Also, I should add that in 9.0.3 we re-implemented the data structure behind a class, so that it is much faster and scalable. You can still use Tcl lists to manipulate the class, however, the class will then lose its efficiency.

     

     

    We are also considering adding a set of commands that would allow one to manipulate the class. These commands would also support permanently saving the added/deleted members to the class.

     

  • Loc_Pham_101863's avatar
    Loc_Pham_101863
    Historic F5 Account
    iControl, Bigpipe, and GUI already have support for classes, including the ability for adding/deleting/finding/listing class and class members. They just don't have visibility to class members that are added to a class from within an iRule, but that's due to the fact that an iRule not being able to save the class.

     

    Loc
  • One thing I am testing -- it seems that I can log the contents of a class... Unfortunately the formatting isn't that useful... Is there a good doc or discussion thread on how to format the output to /var/log/ltm?

     

     

    I am thinking about writing an iRule that collects all the URIs requested for a VIP into a two field class. (Field 1: URI Field 2: request count) Upon RULE_INIT it will dump this class to the log.

     

     

    Three questions:

     

    ----------------

     

    1) Is this possible?

     

    2) Do you know of anyone who has already written this iRule?

     

    3) Would this be too inefficient without the optimized class manipulation commands?

     

     

    Thanks,

     

    Brian
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Well, this would be cool... I'm not sure about the approach though. Here are the problems:

     

    a) log can only log one line at a time max 1024 chars.

     

    b) RULE_INIT is a bit tricky to force to evaluate (it's only evaluated when a rule has been modified).

     

     

    Another approach that I'm a little surprised no one has done yet is the following:

     

    Create a dedicated tcp/http VIP. In the HTTP_REQUEST event, if the request is something like: "/vip_stat", then generate your payload into a variable and then use HTTP::respond to return the content. The same vip could report on other tcl statistics as well. If the request is invalid, simply use HTTP::respond to throw a 404. The vip would never really connect to anything on the backside. Then you could use curl or something to retrieve the status into a file from either the host or any other box...

     

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    You currently can modify a class/datagroup from an iRule. You will need to use either the session table or a Tcl array (this one is not a good option though as you need to be sure have logic to remove entries from the array otherwise it will grow forever).