There's actually a template to do this that arrived as part of update 4.0.2 SP3. I just found that it wasn't returning the correct figure. Perhaps it was because I am using a DAG, I dunno... See the attached txt file for the full script. You'll need to edit the script in notepad. Just do a find on "MBXservername" and replace all instances with the identity of your Mailbox server.
Create a new "Windows Script Monitor" Component monitor and paste your edited script into the body section.
Script Argument should be: /ServerName:"servername"
HTH
:)