1 Reply Latest reply on Nov 8, 2012 8:16 PM by bruce.li

    Cannot add a postgreSQL query as a metric

    bruce.li

      I'd like to add a custom metric for the postgresql database. The idea is simple, I need to query the postgresql rhq event table to find the number of error and fatal events in last 5 mins.  Below is the query:

       

      select 'metricColumn',count(id)  from rhq_event where timestamp >(date_part('epoch',now())*1000-300000) and (severity='ERROR' or severity='FATAL');
      

       

      This query works on psql console. However,  when I imported into JON, it threw error like this:

      Message :

      Failed to manually import resource

      Severity :

      Error

      Time :

      Friday, September 21, 2012 10:58:53 AM UTC+12

      Detail :
      java.lang.RuntimeException:[1348181932975] org.rhq.core.clientapi.agent.PluginContainerException:Failed to add resource with type [Query] and parent resource id [10161] -> org.rhq.core.util.exception.WrappedRemotingException:null
      --- STACK TRACE FOLLOWS ---
      [1348181932975] org.rhq.core.clientapi.agent.PluginContainerException:Failed to add resource with type [Query] and parent resource id [10161] -> org.rhq.core.util.exception.WrappedRemotingException:null
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)
         at Unknown.anonymous(Unknown Source)

       

      And I cannot find out any logs about this problem.

       

      Any help will be appreicated.

       

      Thanks.