Forum Discussion

smp_86112's avatar
smp_86112
Icon for Cirrostratus rankCirrostratus
Aug 24, 2010

Difference Between "External" and "Scripted" Monitor

I am being forced to develop a monitor that will check the status of some DB2 databases. Since there is nothing built in for this, I am looking closely for the first time at External monitors. What we've decided to do is configure the monitor to execute a simple shell script. This shell script will open a simple SSH session, and then on the target system we force the authorized_keys file to execute a script that the DB2 admin will manage.

My systems run 10.2.0. Based on what I've read about External monitors, the resource will be marked Up if the command returns *anything* to stdout. And based on my testing, I have been able to validate this.

But then I started thinking about how I would accomplish this same thing using a "Scripted" monitor. I'm not real clear on the difference, and there doesn't seem to be much documentation. The best example I've found is in the Configuration Guide, but even there, they use an SMTP example but don't extrapolate one might use this in different ways.

It seems like a Scripted monitor allows you to mark a member up/down depending on a custom receive string??? As opposed to an External monitor which marks a member up/down based on anything returned to stdout??? Is that the difference?

Also I don't quite understand how to implement. This is what I've got in my External monitor script:

!/bin/bash
ssh -T -i /config/monitors/private_key.pri 

Let's say this command returns the string "hello". How would I implement the same thing with a Scripted monitor?

3 Replies

  • George_Watkins_'s avatar
    George_Watkins_
    Historic F5 Account
    Hi smp,

    Hope everything has been going well since Chicago. In this case you'll want to use an external (EAV or External Application Verification) monitor. The scripted monitor works just like an expect (http://en.wikipedia.org/wiki/Expect) script. I'm not sure if all the features of expect are implemented, but the basic ones behave the same as far as I can tell. The scripted monitor will read send/expect instructions from a file on the BIG-IP then send those commands to the raw port (just like telnet or nc). So if you're trying to test SSH, the send/expect instructions would look something like this:

     
    expect SSH-2.0-OpenSSH
    send SSH-2.0-BIG-IP_Monitor
    

    Not a very interesting conversation, but that's about as far as you can get until the key exchange, which is a little hairy to do in an expect script. A better example would be an intelligent FTP scripted monitor:

    expect 220
    send user anonymous
    expect 331
    send pass anonymous
    expect 230
    send quit
    expect 221
    

    Hope this helps,

    -George
  • Ahh, yes that does help George. I was not aware that Expect was a formal unix utility - I thought it simply referred to the Receive string, which says a little bit about the documentation I guess. I can see now that a Scripted monitor for SSH is probably not the best idea, and that I should probably stick with an Extended monitor. Thanks a lot for the insight.
  • George_Watkins_'s avatar
    George_Watkins_
    Historic F5 Account
    I tried the FTP example yesterday afternoon and ran into some problems myself. This is a new feature without a lot of documentation at the moment. I am going to get some more info from dev on the syntax and available functionality. I hope to post a Tech Tip outlining Scripted monitors in the near future.

     

     

    -George