Forum Discussion

mkelnerct_62546's avatar
mkelnerct_62546
Icon for Nimbostratus rankNimbostratus
Apr 14, 2008

External Monitor for Shared Folders

Does anyone have a sample script to set up an external monitor to monitor shared folders on load balanced servers?

7 Replies

  • Are you wanting to monitor a Windows File Share (using samba)?

     

     

    If so you could probably write a simple external monitor which calls smbclient. If the host responds, the monitor script would return UP. You can check the man page (man smbclient) for details on the client. There are some good external monitor examples in the Codeshare (Click here).

     

     

    You could take the HTTP post using curl example and modify it to call smbclient instead (Click here).

     

     

    Aaron
  • This would be to monitor a standard windows file share - not using samba. To better explain, I have a replicating folder that is shared on multiple servers running windows 2003 server that are part of a single virtual server pool. I want to monitor if the share is available on each server. I could not find any examples of using the smbclient here.
  • Hey Aaron,

     

     

    Thanks for posting the information. Just one question. Using the http monitor as a template where would you replace the information? Would it be the http in that line?

     

     

     

    send request & check for expected response curl -fNs http://${IP}:${PORT}${URI} | grep -i "${RECV}" 2>&1 > /dev/null

     

     

     

    Thanks again

     

     

    Matt
  • Hi guys,

     

     

    Samba is an opensource implementation of Microsoft's SMB protocol. Once you figure out the options for smbclient to get a response when the fileshare is available, you could script it following the external HTTP POST monitor example. In a quick test, this command worked to list the server's c$ share:

     

     

    smbclient //1.1.1.1/c$ -U test_user -W test_domain -c ls

     

     

    This command makes a request to host 1.1.1.1, accesses the c$ share as test_user on test_domain and executes a directory listing (-ls).

     

     

    So you could replace the entire line in the sample monitor:

     

     

    curl -fNs http://${NODE}:${PORT}${URI} -d "${DATA}" | grep -i "${RECV}" 2>&1 > /dev/null

     

     

    with:

     

     

    smbclient //${NODE}/c$ -p ${PORT} -U test_user -W test_domain -c ls | grep -i "${RECV}" 2>&1 > /dev/null

     

     

    Note that I haven't tested the smbclient command in the shell script. If the server requires a password you'd need to add it to the smbclient command.

     

     

    Here are a few related links for Samba:

     

     

    Samba man page:

     

    http://us3.samba.org/samba/docs/man/manpages-3/smbclient.1.html

     

     

    Samba examples:

     

    http://articles.techrepublic.com.com/5100-6345-1047248.html

     

     

    Aaron
  • I am looking on the samba website and do not see an smbclient for windows. Or is this something that is installed on the F5 device...can you please point me in the right direction to get the client that I need.
  • It looks like F5 has provided a built-in SMB monitor in 9.4:

     

     

    https://support.f5.com/kb/en-us/products/big-ip_ltm/releasenotes/product/relnotes9_4.htmlnew

     

     

    New health monitors

     

    This release includes three new health monitors. The SASP monitor uses the Server/Application State Protocol (SASP) to communicate and verify availability of resources managed through the IBM® Group Workload Manager. The RPC monitor verifies the availability of Remote Procedure Call (RPC) servers using the rpcinfo command. Finally, the SMB monitor employs Server Message Block (SMB) to verify whether either an SMB/CIFS server or a specific share on that server is available.

     

     

    From the 9.4.x online help:

     

     

     

    User Name

     

     

    Specifies the user name if the monitored target requires authentication.

     

    Password

     

     

    Specifies the password if the monitored target requires authentication.

     

    Path/Filename

     

     

    Specifies a specific file associated with a service. The monitor uses the relative path to the service itself when attempting to locate the file. You are not required to specify a value for this option; however, if you elect to use this option you must also specify a service using the service name option.

     

    SMB/CIFS Server

     

     

    Specifies the NetBIOS server name of the SMB/CIFS server for which the monitor checks for availability. You must specify a server for this monitor to function.

     

    Service Name

     

     

    Specifies a specific service on the SMB/CIFS for which you want to verify availability. You are not required to specify a service name.

     

     

     

     

    Aaron
  • I did note that the SMB monitor exists in 9.4, however we have 9.3.1. And no, we haven't resolved the issue yet. Did you ever get a chance to test a sample as stated in an earlier thread?