JAnttila
Contributor
Contributor

HqAPI assistance needed - Problems with CLI commands

Hello I am evaluating the latest version of the opensource HypericHQ and I am currently trying to add new platforms to the system via the command line API tools. I am getting the error message below.
"Error running command: The given object already exists"

The command I am executing from the localhost which is also running the agent and hyperic-hq server. I can setup and use the ICMP Ping fine when I do it all via the web gui and it monitors just fine and collects the metrics but when I try and add another new unique host I get the error message.

/hqapi.sh resource createPlatform --prototype="ICMP Ping" --agentId=10001 --fqdn=dallas33.xxxx.net --ip=208.xxx.xxx.xx2 --name=dallas33.xxxx.net --host="127.0.0.1" --user="hqadmin" --password="hqadmin" --port="8080"

Note I have the gui listening on port 8080 instead of the default 8070 and I am not 100% sure I am using the correct agentId number for the single agent I am running. Could anyone assist me in finding out which portion of the above object already exists and secondly how can I properly identify the agentID number? Also is there a way to get a more verbose output from the hqapi.sh CLI commands.

Thanks,

Jeremy
0 Kudos
3 Replies
JAnttila
Contributor
Contributor

I have figured out how to find the agentId. Could still use some help with the existing object error. I also created a client.preferences file as noted in the API docs and that is making it easier.

Incase anyone ever needs the command its below.

./hqapi.sh agent list
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AgentsResponse>
<Status>Success</Status>
<Agent unidirectional="false" version="4.1.0" port="2144" address="72.233.xx.xx" id="10001"/>
</AgentsResponse>

Basically I need an easy way via shell to setup several thousand IP's to be monitored by ICMP PING. Any suggestions?

Message was edited by: JAnttila
0 Kudos
JAnttila
Contributor
Contributor

I may have figured this out. Can someone please confirm this is the best method to add a large amount of hosts that need basic ping tests.

./hqapi.sh resource createService --prototype="ICMP Ping" --resourceId=10629 --name=dallas3.xxxx.net -- ip=208.xxx.xxx.xx2 name=dallas3.xxxx.net count=3 ping="/bin/ping" switch="-c" hostname="dallas3.xxx.net"

-Jeremy
0 Kudos
admin
Immortal
Immortal

That's right. Your previous attempt was trying to call createPlatform
to create a service.

Charles


0 Kudos