In the OCUM/AUM 9.6 and I think even previous versions, when you setup an Alert, there is an 'Action' tab which basically allows you to add or associate a script with your ALERT. What that means is that : When an alert is generated for an event in Unified Manager, an alert email is sent to the specified recipients and if you have associated an alert with a script, the script is executed.
It is covered here:
I have never used this feature, but after reading the documentation it appears to me that it is used for running a command on the FILER to get more details perhaps or to do something in resposne to that event.
If your intention is to generate a list of folders/Dir and their sizes for the 'Volume Space Full' or 'Volume Space Nearly Full' Altert email, then I am afraid you may have to do this outside of OUCM using your custom (like 'du' in *nix.)
As you said - execute the script when conditions are met.