S2S-Robert said:Yes I guess that's how you'd do it. No running processes would mean a cpu load of 0.
Will this be a problem with the second reread though? The actual reading will take some time as well, and perhaps this way some domains can slip through. Although that won't be for the large ones eating up the resources that's true...
I'll think I'm really liking the way this project is taking!
l0rdphi1 said:Next will be the account suspension stuff @X, I guess.
SUSPENSION_DURATION = 300
MAX_CPU = 20
while "SELECT domain FROM cpu_monitor WHERE cpu_x1>MAX_CPU" {
user = GET_USER(domain)
`/usr/local/directadmin/scripts/suspenduser suspend <user>`
"INSERT INTO suspended (domain,user,time) VALUES (domain,user,TIME)"
// above could be cached and inserted all at once after the while()
}
while "SELECT user, domain FROM suspended WHERE time<TIME-SUSPENSION_DURATION" {
`/usr/local/directadmin/scripts/suspenduser unsuspend <user>`
"DELETE FROM suspended WHERE domain='domain' LIMIT 1"
// again, could be cached and ran all at once after the while()
}
I like that. Sounds like a nice alternative to pissing off people However, since the script that would suspend or email is separate from the one that collects data, you can do whatever you want.S2S-Robert said:The idea of suspending the entire domain is somewhat rough for my taste. If the domain exceeds a certain threshold I'd rather be e-mailed about that fact especially if the average of that domain exceeds the threshold for more than xxx hours.
Limiting the users' load would be ideal, but I'm not sure it's possible.S2S-Robert said:I don't think load balancing will be in place right? Because that would be ideal, if the load of that particular domain is over the threshol level then just cap that domain at whatever you want.