Bug 801186

Summary: postgres plugin Query resource cannot obtain metric
Product: [JBoss] JBoss Operations Network Reporter: Deon Ballard <dlackey>
Component: DocumentationAssignee: Deon Ballard <dlackey>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: JON 3.0.0CC: fbrychta, hrupp, mazz
Target Milestone: ---   
Target Release: JON 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 801167 Environment:
Last Closed: 2013-09-11 11:00:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 801167    
Bug Blocks:    

Description Deon Ballard 2012-03-07 21:15:29 UTC
+++ This bug was initially created as a clone of Bug #801167 +++

using the postgres Query resource type, I'm defining everything correctly, but the metric value isn't coming through.

I think its because the metric propery name is metricColumn (camel case) but hte jdbc metadata that gets returned is all the same case (metriccolumn) and when doing a case-sensitive search in a map for "metricColumn", it fails on lookup (and that's how it gets the value of the column data). This is a guess, but I think that's what is going on.

--- Additional comment from mazz on 2012-03-07 16:00:23 EST ---

I was totally wrong in my guess of what's going on.

Turns out, the metric query should return one row, TWO columns - in this case, the first column must have the value 'metricColumn' (literally) and the second is the numeric value.

select 'metricColumn', count(id) from my_table

is one example.

I did tweek the code slightly to support the use case where you don't want to supply a metric query and I allow for the name/description to be optional. I also added some debug log messages. But the core functionality was already there and working.

So, this should be considered a doc issue more than anything. We need better docs to explain how to use this resource.

--- Additional comment from mazz on 2012-03-07 16:07:00 EST ---

master git commit: 0910465

Comment 1 John Mazzitelli 2012-06-05 18:28:24 UTC
for information on this, see:

http://management-platform.blogspot.com/2012/03/monitoring-custom-data-from-db-queries.html

Comment 3 Filip Brychta 2012-09-11 11:42:24 UTC
Verified on 3.1.1.CR2. Created query to monitore number of alarms.