Forum Discussion

Dave_24664's avatar
Dave_24664
Icon for Nimbostratus rankNimbostratus
Oct 07, 2011

irule to help me sleep

Hi all, hoping to get some pointers on how to start this little effort and to find out if it is even possible.

Like many of you, you are likely responsible for your companies websites, and in our case we have an external monitoring service that lets me know when things are not quite right, and often it seems to happen in the wee hours of the morning when I'm trying to sleep. In this age of social networking, it seems that more and more, our business is using the Facebook like button, along with the Twitter tweet button. With all sites, there are days when even the big boys are having network or server issues. What frustrates me, is that I'll get alerted because these assets are not responding, or are very slow. The worse part is, there is really nothing that I can do as an IT person to stop it. Well I'm hoping with my F5 in hand that this isn't the case.

What I'd like to be able to do, is create an iRule that looks at the response from our web servers, and if it sees a certain URL, that it just replaces it with something benign or nothing at all. So effectively what I'm hoping to do is to remove the Facebook like button and/or the Twitter tweet button HTML code from being sent to the user.

My thoughts are that they are down anyhow, so the fact that the button doesn't show in the first place, it's likely its not working either, so if they were missing altogether what would it matter. I'm tying to be a bit selfish here for my own sanity.

Here is a sample snippet of how we use it today:

 

&nbsp; <iframe src="..." scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height: 20px;" allowTransparency="true">iframe><br>

 

So what I'm hoping to do is write an iRule that effectively neutralizes the above, and doesn't show the offending item.

I'll still get alerted when it happens, but at least I can either enable an iRule, or add some text to a data group or something to disable the links and then go back to bed, when they get things working again, I'd just turn it back on. I'm hoping to make it generic enough to apply to things like pixels as well as those too are often issues.

Can anyone here offer some pointers on how I might proceed with this one? Any articles or references would be great.

  • c_p_i_o_17707's avatar
    c_p_i_o_17707
    Historic F5 Account
    I'm wondering if the use of sideband connections (introduced in v11) could be used to solve this problem.

     

    http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086484/v11-iRules-Intro-to-Sideband-Connections.aspx

     

    Specifically, you'd try to open a sideband connection to Facebook/twitter and if it fails, enable/disable options on pages that are being served.

     

     

    For replacing text, you could either use a stream profile in conjunction with STREAM:: iRule primitives.

     

     

    For pixels, I'm not too sure.
  • Hi Dave,

     

     

    I agree with c_p_i_o in the suggestion of utilizing the Stream Profile, but rather that removing them, you could just use the stream profile to replace the target URL's to an Opps, Sorry, or Out of Order page somewhere else on your site. I may be wrong but I would assume that people would handle an redirect better than they would the disappearing and reappearing buttons.

     

     

    http://devcentral.f5.com/wiki/iRules.STREAM__expression.ashx

     

     

    Just a thought.

     

     

  • Agreed. Stream expressions are the way to go here, but I'll add a twist: I would consider setting dummy pools for both facebook and twitter so you actually monitor them. In your rule you can then simply check the status of the pool(s). If up, don't modify the response content. If not, null it out. From a design perspective the advantage to this is that you're not actually monitoring via the data plane, like a sideband connection or HTTP::retry would do: in other words, you're not potentially stalling the response waiting for an OOB connection to another site. Native BigIP monitoring facilities seem like a better choice here, and allow you the same flexibility if not more.

     

     

    HTH, and please post back your solution - this is an interesting use case.

     

     

    -- Matt Cauthorn
  • Hi - I'm also very interested to hear the outcome of your tests with stream expressions, but just a thought to help you sleep for now, as I totally understand.

     

    I'm in the same position as you with out-of-hours alerts, and its important to react to things you can deal with and not things that you cant. After all we have day jobs too right!:

     

    Many of these 3rd party external monitoring companies offer you the ability to omit certain URLs from the test/monitor. Not sure who you use, but it may be worth checking with their support staff if this can be achieved. You could always have a seperate monitor that just checks the 3rd party URLs and alert a seperate list of people, as you would still want to know I'm sure.

     

    Of course apologies if you have already checked with them, but we've had to do this for several 3rd party URLs that may go down outside our control.

     

     

    Sam.