We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

how to be alerted if mount status changes

Medium Priority
498 Views
Last Modified: 2012-05-11
I have a few linux server that i am tyring to setup some alerts for. There is one main Linux server that is connected to a fibre channel SAN that is mounted on the box. these drives are then shared via NFS to the other servers.

Recently we had a few problems where there were some file system errors and the drives changed to read only.

My question is how I can monitor and create an alert if this were to happen again? I am using Opmanager to monitor my network devices and servers, and have configured it to monitor some processes on the Linux serversm, but I cant seem to get it to monitor the status of the mounts.

How can this be accomplished? Do I need to setup a log server or can this be scripted?
Comment
Watch Question

Top Expert 2011
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
CERTIFIED EXPERT

Author

Commented:
thank you
Top Expert 2011

Commented:
Woo, I missing something...
-------  /usr/local/bin/check_mount.sh
..
touch ${NFS_MOUNT}/test-mount
if [ $? -eq 0 ]
then
   echo "the nfs is rw"
   /bin/rm -f ${NFS_MOUNT}/test-mount   #### change this line
else
...
CERTIFIED EXPERT

Author

Commented:
i keep on getting this error when running this script:

check_mount.sh: line 7: [: missing `]'
check_mount.sh: line 7: ?: command not found


This is what I have for the script

#//bin/sh

HOSTNAME='rbmpl01'
FIBRE_MOUNT=/Production

touch ${FIBRE_MOUNT}/test-mount
if [ &? -eq 0 ]
then
        echo "the Production mount is rw"
else
        echo $FIBRE_MOUNT | mailx -s "mount fail on $HOSTNAME" ryan.palamara@zaisgroup.com
fi
CERTIFIED EXPERT

Author

Commented:
by the way it is fedora 9 if that matters.
Top Expert 2011

Commented:
> if [ &? -eq 0 ]
You have typo there
it should be
if [ $? -eq 0 ]
Top Expert 2011

Commented:
Work for all the Linux

Your first line is wrong
>#//bin/sh
should be
#!/bin/sh
CERTIFIED EXPERT

Author

Commented:
thank you again
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.