Hello, I have a test database called c0freenet with a 25MB quota. I filled it with more than 30MB of data. Now on the ISPConfig 3.1 home page I have always "Used Space" 0 under Database quota (Quota is 25 MB) If I run /usr/local/ispconfig/server/cron.sh by hand, 100-monitor_database_size.inc.php says: database c0freenet size does not exceed quota: 26214400 (quota) > 0 (used) But that's not true. I checked the library and internally it runs a mysql query: SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='c0freenet'; that returns about 40MB: +-------------------------------+ | SUM(data_length+index_length) | +-------------------------------+ | 41324160 | +-------------------------------+ Any clue on how to fix this ? I installed ispconfig3-stable-3.1-e2465bd7a2d324259c3c1dae00dfca8c2535edcc Thank you, Roberto
When did you install the ISPConfig git-stable version? If it was not installed in the past few days, try to make an update to the current git-stable version to see if that solves the issue.
I installed it yesterday ... do I need to update ? Can you outline the procedure to do so ? Thank you, Roberto
That is the latest stable-3.1. Is this a single server or multi-server install? If multi-server, make sure all your servers are on that same version. Check that the password in /usr/local/ispconfig/server/lib/mysql_clientdb.conf works (run 'mysql -u root -p -h localhost mysql' and paste that password).
Hello, this is a single Ubuntu 14.04 installation. I checked mysql_clientdb.conf and the username and password is correct. mysql logins just fine
grep 'ISPC_APP_VERSION' /usr/local/ispconfig/server/lib/config.inc.php reports: define('ISPC_APP_VERSION', '3.1dev'); but I downloaded https://git.ispconfig.org/ispconfig/ispconfig3/repository/archive.tar.gz?ref=stable-3.1 So is this stable or development version ? Thank you, Roberto
The archive you downloaded is the latest git-stable version, as @Jesse Norell pointed out already in post #4.
It is a development version of the stable-3.1 branch, a git branch of the current stable version, 3.1. At some point in the future that branch will become the next stable release (3.1.14). Not to be confused with the master branch, which is development branch for the next version of ispconfig, eg. 3.2. Not many features make it into 3.1, it's mostly for bugfixes, and the particular ispconfig3-stable-3.1-e2465bd7a2d324259c3c1dae00dfca8c2535edcc which you installed is a few bugfixes/changes ahead of the most recent stable release, 3.1.13.
I'm using the same version on debian 9 and database quotas are working there; I don't have ubuntu 14.04 to test offhand. Maybe do a quick checksum and make sure you see the same: Code: # md5sum /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_database_size.inc.php 5ccae058c2273791dcd0d382c410968b /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php f0515547b8b650221ba09fb70c7555a8 /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_database_size.inc.php Beyond that, it sounds like getDatabaseSize() is returning 0, so I'd try adding some debugging lines to the getDatabaseSize() function in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php and see what you might find, eg. start with: Code: public function getDatabaseSize($database_name) { global $app; require_once 'lib/mysql_clientdb.conf'; $app->log("getDatabaseSize(): running query: " . "SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".$this->escape($database_name)."'"); $result = $this->_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".$this->escape($database_name)."'"); if(!$result) { $this->_sqlerror('Unable to determine the size of database ' . $database_name); return; } $app->log("getDatabaseSize(): got result"); $database_size = $result->getAsRow(); $result->free(); $app->log("getDatabaseSize(): \$database_size[0] is: " . $database_size[0]); return $database_size[0] ? $database_size[0] : 0; } You may have to similarly debug db_result::getAsResult() (same file), or 100-monitor_database_size.inc.php .. something must be different in your setup, though I don't know what offhand.
Hi Jesse, the md5s are the same. I modified db_mysql.inc.php as you said, but running cron.sh by hand doesn't output anything new: # /usr/local/ispconfig/server/cron.sh database c0xx1 size does not exceed quota: 26214400 (quota) > 0 (used) database c2xx2 size does not exceed quota: 104857600 (quota) > 0 (used) database c3xx3 size does not exceed quota: 104857600 (quota) > 0 (used) /usr/bin/fail2ban-client /sbin/iptables /sbin/ip6tables I tried looking on /var/log/ispconfig/ispconfig.log but it's empty .. is this normal ? On System -> Server Config I have log level set to Errors as a note, there is no getAsResult() in db_mysql.inc.php # grep -i getasresult db_mysql.inc.php returns nothing That's my first ispconfig installation, so I still miss pieces here and there Let me know, Thank you, Roberto
IIRC the log messages would end up in cron.log, not ispconfig.log, and not on the cli. Also make sure you edited /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php, not the identical file under /usr/local/ispconfig/interface/.... My mistake, it is getAsRow().
I edited classes/db_mysql.inc.php but On cron.log I have only this: Fri Oct 12 11:10:01 CEST 2018 database c0xxx size does not exceed quota: 26214400 (quota) > 0 (used) Fri Oct 12 11:10:01 CEST 2018 database c2xxx size does not exceed quota: 104857600 (quota) > 0 (used) Fri Oct 12 11:10:01 CEST 2018 database c3xxx size does not exceed quota: 104857600 (quota) > 0 (used) Fri Oct 12 11:10:01 CEST 2018 database c4xxx size does not exceed quota: 104857600 (quota) > 0 (used) Fri Oct 12 11:10:01 CEST 2018 finished. Fri Oct 12 11:10:01 CEST 2018 /usr/bin/fail2ban-client Fri Oct 12 11:10:01 CEST 2018 /sbin/iptables Fri Oct 12 11:10:01 CEST 2018 /sbin/ip6tables Fri Oct 12 11:11:01 CEST 2018 Fri Oct 12 11:11:01 CEST 2018 Fri Oct 12 11:11:01 CEST 2018 finished. I changed to log level -> Debug in the web panel. Let's see
Even with loglevel Debug I don't see any "getDatabaseSize(): running query" I have a lot of lines in both cron.log and ispconfig.log but not those Any clue ? -- Roberto
As for debug messages, it looks like from the cron you have to use "print", it seems $app is not setup the same when running a cronjob. As for the issue, I actually can reproduce it (I verified the system where I thought it was working had a different db_mysql.inc.php, and the one with the right version wasn't working anymore); try this: Code: public function getDatabaseSize($database_name) { global $app, $conf; static $db=null; if ( ! $db ) { $clientdb_host = ($conf['db_host']) ? $conf['db_host'] : NULL; $clientdb_user = ($conf['db_user']) ? $conf['db_user'] : NULL; $clientdb_password = ($conf['db_password']) ? $conf['db_password'] : NULL; $clientdb_port = ((int)$conf['db_port']) ? (int)$conf['db_port'] : NULL; $clientdb_flags = ($conf['db_flags'] !== NULL) ? $conf['db_flags'] : NULL; require_once 'lib/mysql_clientdb.conf'; $db = new db($clientdb_host, $clientdb_user, $clientdb_password, NULL, $clientdb_port, $clientdb_flags); } $result = $db->_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".$db->escape($database_name)."'"); if(!$result) { $db->_sqlerror('Unable to determine the size of database ' . $database_name); return; } $database_size = $result->getAsRow(); $result->free(); return $database_size[0] ? $database_size[0] : 0; }
Hello, bug was fixed. Everything is working now. https://git.ispconfig.org/ispconfig/ispconfig3/issues/5149 Thank you Jess !