I have an NFS share on which I have both soft and hard quotas set, and I want to be able to e-mail the user in question if a quota is exceeded. The only notifications for quota events that I've seen in the manuals is to e-mail the NAS administrator or other fixed e-mail addresess. I was considering setting up a cron process on the work station to run the command line quota report, extract the UID of the offenders, translating that into user names, which on our network are the e-mail address names as well, and sending e-mails to people to delete or compress files.
Before I possibly reinvent the wheel here, has anyone else done anything like this that they can share details about?
I have done a setup utlizing an event processing/systems mgmt. software installed at the site. Whereas, setup the Celerra quota msgs to send SNMP traps the event processing host. It had intelligence/rules engine that could scrape the trap fields and build an email message for delivery to MS exchange platform. It worked well.
You may want to explore any systems mgmt. software existing at your center that can receive and process SNMP traps, and interface with your email system.
Here you go - attached is a skript that does implement quota exceeded EMail notification for NFS clients
The basic idea is:
First configure the Celelerra to generate events for hard and soft quota exeeded using nas_event for the UFS facility event number 4 and 5
Register the attached quota_handler skript to get called every time the event is raised facilitypolicy 64,7 disposition range=4-5, exec "/home/nasadmin/quota_handler"
The quota_handler script grabs the event line and analyzes it
The event line contains the relevant user UID and file system.
In the attached script, the resolve() function uses NIS to resolve username from uid. This function could be edited to use the local passwd file, ldap or any other source
Prequisites: - sendmail is configured on the Celerra control station - NIS is configured and the NIS passwd map contains the numeric UID's and user names - the users login name as resolved by NIS can be used to as an EMail address
Please test it thoroughly before putting it into a production environment
Of course this comes with the usually disclaimers .... no liability .. no support
BUT EMC professional service is happy to offer assistence
I am planning to use this for CIFS only enviornement, if i can get it to work . For resolving uid to sid (username) i am thinking abt using "server_usermapper server_2 -E -u /path/filename" (export can be run as cron) and then using gawk to extract the uname and domain from there.
Any suggestions?? Once i get it to work i ll let everyone know.......
The server_usermapper -Export output is good for resolving uid to sid relationships, but be careful about the username. For server_usermapper the username is only a comment. Server_usermapper will only list the username of the sids which was choosen during the time the usermapper created the mapping between sid and uid. if the winodws username was changed afterwards, server_usermapper will report the original one and not the actual one.
telenoiz
1 Rookie
•
26 Posts
1012
0
Posted September 10th, 2008 13:00
It worked well.
You may want to explore any systems mgmt. software existing at your center that can receive and process SNMP traps, and interface with your email system.