Happy Friday!
Trying to see if there is a way to set up an agent with auto expiration date? If we set up few VM's for a week, set up agents on them and then delete them a week later. We are trying to avoid a situation of someone: forgetting to remove the monitoring agents from the dashboard or deleting wrong agent from the dashboard.
Or maybe someone has some other ideas?
It sounds like you want to remove the agent from the Hyperic Server and then remove the agent itself automatically after a week. Is that right?
I haven't seen any native functionality for auto self destruct sort of speak. Off the top of my head, you can configure a cron job to run a week after it's created to delete the resource from the hyperic server and then delete the agent as long as you have hqapi on the machine.
Let me know if this is something you're looking for.
0 12 13 6 0 /bin/agent_removal.sh
############################# Content of agent_removal.sh############
#!/bin/bash
id=$(./hqapi.sh resource list --properties="/path/to/properties/file" --platform="platform.name.in.hyperic"
hqapi.sh resource delete --properties="/path/to/properties/file" --id="$id"
/bin/rm -rf /location/of/agent/home
#id is the resource of the id of the platform which can be obtained by ./hqapi.sh resource list --properties="/path/to/properties/file" --platform="platform.name.in.hyperic"
# you can create a variable prior to the resource delete and pass that to --id
It sounds like you want to remove the agent from the Hyperic Server and then remove the agent itself automatically after a week. Is that right?
I haven't seen any native functionality for auto self destruct sort of speak. Off the top of my head, you can configure a cron job to run a week after it's created to delete the resource from the hyperic server and then delete the agent as long as you have hqapi on the machine.
Let me know if this is something you're looking for.
0 12 13 6 0 /bin/agent_removal.sh
############################# Content of agent_removal.sh############
#!/bin/bash
id=$(./hqapi.sh resource list --properties="/path/to/properties/file" --platform="platform.name.in.hyperic"
hqapi.sh resource delete --properties="/path/to/properties/file" --id="$id"
/bin/rm -rf /location/of/agent/home
#id is the resource of the id of the platform which can be obtained by ./hqapi.sh resource list --properties="/path/to/properties/file" --platform="platform.name.in.hyperic"
# you can create a variable prior to the resource delete and pass that to --id