Feature request:
There is already a similar discussion of 2015 on the subject matter on forums: https://www.virtualmin.com/node/38131, where Eric states Virtualmin does not offer quota per visits. So I'd like to file a feature request for visits quota limit because lot's of hosting companies offer hosting plans with monthly visits quotas.
For example, let's take an example of https://www.siteground.com/web-hosting.htm - so how SG can offer such plans? Easy! They use cPanel which enables them to do so. And because I envision Virtualmin as a control panel of no lesser capabilities I'd like to ask for a new feature to start supporting monthly visits quota limitation. And to say frankly I don't see any reason why Virtualmin can't support this feature and why it would be difficult to implement.
Support request:
And until and if this feature is implemented, I'd like to deem this as a support request, because not to switch to cPanel we are going to have this feature for Virtualmin implemented programmatically for now and would like to hear *min team's opinion what would be the best way to do so. The idea is to regularly check the number of unique visits and when it reaches a certain threshold (like 90%) to send a warning notification and when it reaches 100% then to automatically disable the respective domain.
Does Virtualmin have monthly visits stats collected, calculated and ready to use anywhere? If not would you recommend just to enable one of AWstats or Webalizer and use their data?
Thanks for consideration!
Comments
Submitted by andreychek on Fri, 12/16/2016 - 08:21 Comment #1
Howdy -- I emailed Joe and Jamie about your feature request. We will be discussing that.
If we decide to do that, it would likely take some time to develop such a feature -- at the very least a few months -- so if you need that functionality you may need to look into a way to achieve that on your own in the meantime. Part of this can be done using Virtualmin's API -- but unfortunately probably not the hard part :-)
Once you determine that a domain is over it's quota, you can disable it from the API using a command like this one:
virtualmin disable-domain --domain domain.name --why "Domain is over quota"
The hard part is going to be determining unique visitors.
While Virtualmin does regularly review and parse the Apache logs, it only is calculating the total bandwidth used by all requests to a given domain. It's not tracking visitors, or unique visitors. It allows tools like AWstats and Webalizer to handle that.
I unfortunately don't know how to reliably determine that information. That'd be something we'd have to spend some time researching, should we decide to implement that.
What you'd probably need to do, is find a tool that regularly parses the Apache logs, determines unique visitors, and provides that information to you on the command line.
AWstats and Webalizer do calculate that information, but to my knowledge you'd have to parse their HTML in order to get the stats, which might be a bit tricky.
So that's the hard part -- finding a tool that gets you the information you want on the command line.
Once you have that, you could have a script run regularly from cron that reviews that information, and if a domain is over quota, it could use the virtualmin command line tools to disable it.
Submitted by yngens on Sat, 12/17/2016 - 02:46 Comment #2
Eric,
Thanks for the very detailed explanation. We will research the options on our end, meanwhile tracking this ticket as I really hope this will be implemented on Vmin core.
Submitted by yngens on Fri, 09/01/2017 - 00:41 Comment #3
Hi there. Any news on this as more and more hosting companies offer plans based on monthly visits?
Submitted by andreychek on Fri, 09/01/2017 - 10:39 Comment #4
Howdy -- sorry, we currently have not made any moves towards implementing this.
One of the things we look for when adding new features is to see how many folks are interested in the feature.
For a feature that would take a decent amount of work to implement and support, we've had very few requests asking for it (I only know of two, yours and the one Forum post back in 2015).
However, I've asked Joe for some more input on that to see if he has any additional thoughts on it, and whether he's had any requests for it.
So, as Eric mentioned, this one is quite a bit of work (all accounting features are). And, we don't already have a reliable source of that data (other than adding more parsing to the logs we do if bandwidth reporting is enabled, which is currently more resource intensive than I like).
I could see this being a good area for a plugin, maybe that uses AWstats for its source of data (since AWstats already knows unique visitor counts). Webalizer does, too, for that matter and is probably somewhat faster and less memory intensive. AWstats being in Perl probably makes it the easier one to integrate, though.
I wouldn't want it in core I don't think since we've had so little demand for it. I can take a look to see what kind of effort it'll be, but I can't really commit to anything else at the moment, and Jamie is gonna be swamped for a while with Webmin 2.0 branching and Cloudmin 10 stuff.
Do you have any experience with Perl? I can provide some pointers on how something like this could be implemented as a plugin (and if we're missing any needed hooks into core I could add them). It would likely be pretty small; maybe a hundred lines of code, including scheduling, querying AWStats for data, reporting, and automatic disabling. Though that depends on how fine-grained you need it to be...I mean, if you need it to be real time rather than once-a-day, it would need its own parser that runs all the time, for example, which would balloon up the complexity a lot.
We could also do it on contract (I'm hesitant to take on contract work when we're already so busy, but I'm also kinda broke, so contract money is good when we're having such a hard time getting people to pay for Virtualmin Pro).
Submitted by yngens on Fri, 09/01/2017 - 16:41 Comment #6
Unfortunately, we are on Drupal, thus PHP area and also have done lot's of *min customizations through scripting in bash, so won't be able to do anything substantial in Perl now.
If we do it on contract can you please tell me what range of cost we would be looking for? Thanks!