Enabling Cloudstack Usage Server in 4.3

You should have the “cloudstack-usage” packages installed already.

In the CloudStack management portal go to > Global Settings then type “usage” in the search and you should see the following shown below.

Now make changes to the following items. The usage server should already be enabled by default. Use your own preferred timezone for the relevant settings.

  • enable.usage.server = true
  • usage.aggregation.timezone = America/New_York
  • usage.execution.timezone = America/New_York
  • usage.stats.job.aggregation.range = 10

Lets restart the services now.

service cloudstack-management restart

service cloudstack-usage restart

If you have problems!

I had this problem where the usage server would not start in CloudStack 4.3. In most cases you’d probably not know it wasn’t running unless you checked or tried to pull some of the usage information.

You may see an error message the one below:

Caused by: java.sql.SQLException: No suitable driver found for
at java.sql.DriverManager.getConnection(DriverManager.java:635)
at java.sql.DriverManager.getConnection(DriverManager.java:195)
at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
at com.cloud.utils.db.TransactionLegacy.getConnection(TransactionLegacy.java:556)
at com.cloud.utils.db.TransactionLegacy.prepareStatement(TransactionLegacy.java:467)
at com.cloud.utils.db.TransactionLegacy.prepareAutoCloseStatement(TransactionLegacy.java:460)
at com.cloud.utils.db.GenericDaoBase.searchIncludingRemoved(GenericDaoBase.java:394)

Or one where the JAVA_HOME can’t be found. There both two different issues but I’ll show how you can fix both.

First lets fix the error related to “JAVA_HOME”. This is easy and all you need to do is install “java–1.6.0”.

yum install java-1.6.0 -y

Next lets fix the issue related to the “java.sql.SQLException” message.

service cloudstack-usage stop

Created a symbolic link for “mysql-connector-java.jar” and make it available to the usage server:

ln -s /usr/share/java/mysql-connector-java.jar /usr/share/cloudstack-usage/lib/mysql-connector-java.jar

service cloudstack-usage start

NOTE: I added both of these fixes to the “cldstk-deploy” tool so if you use the latest version to deploy Cloudstack you should not have this issue.

Your all done!

You should be able to query the “cloud_usage” database and see data in the tables or use the api to retrieve data.

I’d also like to thank the Cloudstack community on the mailing lists who always help provide useful information for those in need of help with Cloudstack related issues. You can subscribe here.

Enabling Cloudstack Usage Server in 4.3 originally appeared on theHyperadvisor by Antone Heyward

1 comment

Add yours
  1. satya pothina

    I have tried your solution to fix usage issue on fresh installation of CloudStack 4.3, but no luck. Found ‘zero’ records in cloud_usage database.

    Using cloudmonkey, I have called ‘generate usagerecords’ and ‘list usagerecords’ commands.

    Any help will be appreciated.

    Thanks in advance

Leave a Reply