Is it possible to manually add a resource via CLI?
Joseph Marques
jmarques at redhat.com
Sun Jun 20 17:49:09 UTC 2010
Any database instances should be automatically discovered via a process
scan. All you need to do it search for resources in the NEW state:
rhqadmin at localhost:7080$var criteria =new ResourceCriteria()
rhqadmin at localhost:7080$ criteria.addFilterInventoryStatus(InventoryStatus.NEW)
rhqadmin at localhost:7080$var resources = ResourceManager.findResourcesByCriteria(criteria)
And then import them:
rhqadmin at localhost:7080$DiscoveryBoss.importResources(<resourceIds>)
The method that you used below worked in this case because it is legal
to manually add resources that would already be sitting in the
auto-discovery queue. After importing these resources, you'll likely
have to set the connection password. You can do this with:
rhqadmin at localhost:7080$var connectionProperties = ConfigurationManager.getPluginConfiguration(<resourceId>)
rhqadmin at localhost:7080$ // iterate the properties, setting them as necessary
rhqadmin at localhost:7080$ConfigurationManager.updatePluginConfiguration(<resourceId>, connectionProperties)
-----
If, however, some of your PG servers are not automatically discovery by
the Agent on that box, then you can try to manually add them yourself
via the CLI:
rhqadmin at localhost:7080$var parentId = // find resource id of the platform under which your PG server is running
rhqadmin at localhost:7080$var typeId = // find type id of PG Server via ResourceTypeManager.findResourceTypesByCriteria
rhqadmin at localhost:7080$var params = // build Configuration object representing connection properties (PGData dir, pwd)
rhqadmin at localhost:7080$var newPostgresResource = DiscoveryBoss.manuallyAddResource(typeId, parentId, params)
This is the programmatic equivalent to what you did below in the user
interface.
-joseph
On 06/20/2010 11:29 AM, Alexey Kamenchuk wrote:
> Hi All
>
> As far as i understand, my PostgreSQL servers are not automatically
> discovered due to inability log in using default password "postgres".
> I managed to add PG manually using the "Manually Add" function on a
> platform's Inventory tab and specifying PGDATA directory and psw on
> there. This is fine and acceptable if I need to add couple of DB
> servers. But I have nearly a hundred of them and really need a way of
> doing this in a bulk operation.
>
> So I wondered if CLI can help me with this?
>
> Regards
> Alexey
>
>
> _______________________________________________
> rhq-users mailing list
> rhq-users at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://fedorahosted.org/pipermail/rhq-users/attachments/20100620/3e83224c/attachment.html
More information about the rhq-users
mailing list