1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

Using event manager - question

Discussion in 'Plesk for Linux - 8.x and Older' started by ElricM, Jul 27, 2005.

  1. ElricM

    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?
  2. hardweb

    hardweb Guest

    This aproach is not recommended. I advise you to query directly the psa database as it's faster and less intenssive.
  3. ElricM

    ElricM Guest

    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.
  4. hardweb

    hardweb Guest

    If you want you can modify the cron line for:


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