Forum Discussion

Birddog_17215's avatar
Birddog_17215
Icon for Nimbostratus rankNimbostratus
Jul 23, 2013

SMB monitor on 11.4

Wanted to post some info as i've been working on this for the past few weeks with F5. It appears they have added the SMB tools back into 11.4 and i was able to get the external monitor working that Aaron provided here https://devcentral.f5.com/wiki/AdvD...-CIFS.ashx

 

 

I did have to make a couple modifications to the script as well as its placement for it to work. I am currently going thru my config and documenting the changes. Once i have those i'll post them.

 

6 Replies

  • Ariel_Santa_Cr1's avatar
    Ariel_Santa_Cr1
    Historic F5 Account
    Hi Birddog, I need to make this script to work in 11.4. I would like to learn from experience to avoid hitting the same issues. Could you post the script you are using? Thanks!
  • Ariel_Santa_Cr1's avatar
    Ariel_Santa_Cr1
    Historic F5 Account

    Well, I made both, the internal monitor and the script provided by Aaron, work in my lab.

     

    To make the internal monitor to work you need to create the /var/run/monitors directory, apparently the destination of the file is hardcoded to that dir and in version 11.4 is no longer available, so you have to do it manually.

     

    The script provided by Aaron (Windows File Share Monitor SMB CIFS) worked just fine, the difference in 11.4 is that you have to upload the file instead of placing it in a specific directory. To upload the script in the GUI you need to go to System --> File Management --> External Monitor Program File List

     

    Once uploaded you can modify the content in the GUI.

     

    When creating the External Monitor you can reference to the previously uploaded Program File.

     

    good luck!

     

  • Apologize for the delayed response but here is the script. I used Aaron's script as ARO did above and modified it to add the use of the AD domain with a service account specifically set to this monitor. This allows me to test AAA as well as reading a string inside a file to test all the way to shared storage.

    I did have to create an smb directory and conf file to fix a problem i was having with access denied messages in 11.4. Not sure if its fixed in later versions: mkdir /root/.smb/ touch /root/.smb/smb.conf

    when i created the external monitor i used the following variables:

    default settings and tweaked interval
    defaults-from external
    destination *:*
    interval 10
    time-until-up 0
    timeout 31
    
    monitor script uploaded thru File Management
    run /Common/smb-monitor
    
    turn debug off '0' or on '1'
    user-defined DEBUG 0
    
    example file thru Samba to SAN storage
    user-defined FILE /share/smb.hc
    
    password of AD service account
    user-defined PASSWORD mypassword
    
    string inside smb.hc file that monitor looks for (in this case the word 'working')
    user-defined SEARCH_STRING working
    
    username of AD service account
    user-defined USERNAME jdoe
    
    Domain name of AD domain
    user-defined WORKGROUP MYDOMAIN
    
    Below is the domain portion i added into Aaron's script: Check if a variable named WORKGROUP exists from the monitor definition This can be set using a monitor variable WORKGROUP=MYDOMAIN

    if [ -n "$WORKGROUP" ] then if [ $DEBUG -eq 1 ]; then logger -p local0.debug "EAV

    basename $0
    (PID $$): Workgroup: $WORKGROUP"; fi Set the password flag WORKGROUP="-w $WORKGROUP" else if [ $DEBUG -eq 1 ]; then logger -p local0.debug "EAV
    basename $0
    (PID $$): No workgroup specified"; fi WORKGROUP='' fi

    Send the request and check the response. If we have a string to search for, use grep to look for it. Check if a variable named SEARCH_STRING exists from the monitor definition This can be set using a monitor variable SEARCH_STRING=my_string

    if [ -n "$SEARCH_STRING" ] then SUCCESS_STATUS=0 if [ $DEBUG -eq 1 ]; then logger -p local0.debug "EAV

    basename $0
    (PID $$): Checking ${IP}${FILE} for "$SEARCH_STRING" with status of $SUCCESS_STATUS using\ smbget $USERNAME $PASSWORD $WORKGROUP $GUEST_FLAG --nonprompt --quiet --stdout smb://${IP}${FILE} | grep \"$SEARCH_STRING\" "; fi smbget $USERNAME $PASSWORD $WORKGROUP $GUEST_FLAG --nonprompt --quiet --stdout smb://${IP}${FILE} | grep $SEARCH_STRING 2>&1 > /dev/null else SUCCESS_STATUS=1 if [ $DEBUG -eq 1 ]; then logger -p local0.debug "EAV
    basename $0
    (PID $$): Checking ${IP}${FILE} with status of $SUCCESS_STATUS using\ smbget $USERNAME $PASSWORD $WORKGROUP $GUEST_FLAG --nonprompt --quiet --stdout smb://${IP}${FILE} "; fi smbget $USERNAME $PASSWORD $WORKGROUP $GUEST_FLAG --nonprompt --quiet --stdout smb://${IP}${FILE} fi

  • does this work in 13.1.0.4? I am looking to monitor for the existence of a single file on a server and if its not there then take it out of the rotation and mark it down.