Forum Discussion

forsan_102218's avatar
forsan_102218
Icon for Nimbostratus rankNimbostratus
Sep 16, 2014

External/Scripted monitor fails

Hi,

I need to have a monitor that do a curl on a url witch returns a specific value. I could have done this with the regular http monitor but I need to insert a random number into the URI to avoid caching in the internal proxy.

I have tried to import the script and create an external monitor but without any results. I'm checking the access log on the apache server and I can not see any requests. I have also created a "script" monitor where I put the script in the /config/eav/ directory. In the script monitor I can set it in the debug mode and I get the following in the log.

********** Debugging session beginning at: Tue Sep 16 21:57:08 2014

Arguments 1-2:
::ffff:192.168.20.1
80

Environment variables:
DEBUG=yes
FILENAME=test
MON_TMPL_NAME=/Common/test
NODE_IP=::ffff:192.168.20.1
NODE_PORT=80
--
!/bin/sh
invalid line from file /config/eav/test:
        '!/bin/sh'

If I run the script manually it works as expected, but not when the monitor is executing the script. I have 755 as access:

-rwxr-xr-x 1 root root 2267 Sep 16 21:51 test

Regards Andréas

2 Replies

  • The scripted monitor uses an Expect-like syntax:

     

    http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-monitors-reference-11-5-0/3.htmlunique_652701621

     

    It doesn't support Bash code, so that's why you're getting that error. To use a Bash monitor script, you must configure it as an External monitor. In 11.x and above, you have to first import the script as a file object under the system menu, then in the Local Traffic section define an External monitor that implements this script.

     

  • Hi Kevin,

    thank you for your reply. That explains why the scripted monitor is not working.

    I have now been able to create a working external monitor.

    The issue I had with my first try was this:

    /bin/bash^M: bad interpreter: no such file or directory

    I created the script in a windows computer and got the ^M in the file. So I recreated the script in a linux computer and ran it trough the dos2unix program and imported it to the BigIP again.

    After this, the script was running without any issues.

    Best Regards Andréas