I'm going to argue that you're asking the wrong question, because of one small fact: why do you care how often a drive has been defragmented? How would you know if those defrag operations all completed successfully? What purpose would that information serve to you?
You shouldn't care how often a drive is defragged, but you should care how much it's fragmented, especially when it gets to the point of impacting performance. I personally don't know what point that is, but I know on Windows, you can run
defrag X: /a /v to view a verbose (
/v) analysis (
/a) of the drive before defragmenting it. This will provide you with an approximate percentage of how fragmented the disk is.
In my opinion, anything higher then a few percent is worth a quick defrag pass. It would be trivial to write a batchfile to automate this for you, to only defrag the hard drive if it reaches a certain threshold. In that same batchfile, you could also log to a file when you executed the defrag job, so you could keep count if you wanted. As ioi also mentioned, you could also use a scheduled task to do this.