Forum Discussion
SMB monitor on 11.4
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 intervaldefaults-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}
fiHelp guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com