• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Using event manager - question

E

ElricM

Guest
I want to use the Event Manager to trap domains that exceed their monthly bandwidth limit. I've been playing with it and I notice that the execution of event manager scripts is very sensitive to the proper arguments being passed in. I can test it with events like client account updated, physical hosting updated, etc. However it's obviously pretty hard to test for my event of interest which is 'Traffic limit for domain reached'.

The allowable parameters for this event are 'old_maximum_traffic', 'new_maximum_traffic' but how am I supposed to know which domain tripped the event???

I am assuming that if I do something like:

/mydirectory/myscript <new_maximum_traffic> <new_domain_name>

that parameter "<new_domain_name>" will be null. In fact, if the parameter is out of context my experiments seem to show that the event might not fire at all.

So again, how will I know which domain triggered the 'Traffic limit for domain reached' event?
 
This aproach is not recommended. I advise you to query directly the psa database as it's faster and less intenssive.
 
Originally posted by hardweb
This aproach is not recommended. I advise you to query directly the psa database as it's faster and less intenssive.
Well, turns out this won't work for me anyway since it appears that Plesk only writes the bandwidth to the database once every 24 hours. I have some domains that offer file downloads, and some of them can be quite large, like 400-500 MBs. The domain might exceed it's bandwidth allocation in a matter of hours, 24 hours is way too long to wait. I'm now customizing the download utility to keep track of bytes downloaded directly rather than relying on Plesk to take the domain offline. In the long run, this is a better solution anyway since the visitor can receive a "sorry, too bad" message rather than domain is offline contact the administrator.
 
If you want you can modify the cron line for:

/usr/local/psa/admin/sbin/statistics

to execute every several hours, this is the script that writes statistics every 24 hours :)
 
Back
Top