Has anybody used the HQAPI to fetch the metrics of a resource programmatically? I want a sample code which uses the HQAPI to fetch the metrics of a resource.
Asked
Active
Viewed 2,170 times
3 Answers
2
There is a treasure trove of examples here http://svn.hyperic.org/projects/hqapi/trunk/src/org/hyperic/hq/hqapi1/test/
and I am trying to put together some explanation here http://www.javamonamour.org/2012/05/creating-alert-recovery-with-hyperic.html

Pierluigi Vernetto
- 1,954
- 1
- 25
- 27
1
They seem to have plenty of examples on Github e.g.
Also there is an example in their docs:

Andrey Adamovich
- 20,285
- 14
- 94
- 132
0
The are actually a lot of ways you could do this:
- Run the plain old hqapi.sh resource list (or like) commands, which could be very slow.
Paste directly in your browser window a restful URL:
http://__host__:7080/hqu/hqapi1/alert/find.hqu?begin=1344004728555&end=1444004728999&count=100&severity=1¬Fixed
Use curl to achieve that:
curl -u hqadmin "http://__host__:7080/hqu/hqapi1/alertdefinition/listDefinitions.hqu?resourceId=10201"
- I personally like using a scripting language like Python to do this.
- Then there is Groovy script, which you can run in a Groovy console under the administration tab. Check the hqapi1 hqu plugin.

Jamal
- 763
- 7
- 22
- 32

vHalaharvi
- 179
- 1
- 10