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@localhost:7080$var criteria =new ResourceCriteria()
rhqadmin@localhost:7080$ criteria.addFilterInventoryStatus(InventoryStatus.NEW)
rhqadmin@localhost:7080$var resources = ResourceManager.findResourcesByCriteria(criteria)
And then import them:
rhqadmin@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@localhost:7080$var connectionProperties = ConfigurationManager.getPluginConfiguration(<resourceId>)
rhqadmin@localhost:7080$ // iterate the properties, setting them as necessary
rhqadmin@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@localhost:7080$var parentId = // find resource id of the platform under which your PG server is running
rhqadmin@localhost:7080$var typeId = // find type id of PG Server via ResourceTypeManager.findResourceTypesByCriteria
rhqadmin@localhost:7080$var params = // build Configuration object representing connection properties (PGData dir, pwd)
rhqadmin@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@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/rhq-users
Your logs indicate the process table scan is succeeding, but the overall discovery workflow is not completing successfully. I've diagnosed the issue in some detail and found that this is a regression over how Postgres auto-discovery worked in previous releases -- https://bugzilla.redhat.com/show_bug.cgi?id=608064
If you're using HEAD of master or release-3.0.0 branch, you'll see this issue. I've pinged the developer in question, so keep an eye on that BZ for updates next week.
-joseph
On 06/25/2010 09:37 AM, Alexey Kamenchuk wrote:
Hi Joseph
Thanks a lot for your prompt and detailed answer
Re process scan based auto discovery. For some reason it doesnt work for me. Below is the exception I can see in the agent logs. Any chance you can advise whats wrong here?
Thank you WBR Alexey
2010-06-21 12:09:09,271 INFO [InventoryManager.discovery-1] (rhq.core.pc.inventory.AutoDiscoveryExecutor)- Process scan auto-detected new server resource: scan=[ProcessScan: query=[process|basename|match=^(postgres|postmaster)$,process|basename|nomatch|parent=^(postgres|postmaster)$], name=[unix]], discovered-process=[process: pid=[20646], name=[/data/pgsql/bin/postgres], ppid=[1]] 2010-06-21 12:09:09,292 INFO [ResourceDiscoveryComponent.invoker.daemon-2] (org.rhq.plugins.postgres.PostgresDiscoveryComponent)- Discovered a postgres process: ProcessScanResult: scan=[ ProcessScan: query=[process|basename|match=^(postgres|postmaster)$,process|basename|nomatch|parent=^(postgres|postmaster)$], name=[unix]], info=[process: pid=[20646], name=[/data/pgsql/bi n/postgres], ppid=[1]] 2010-06-21 12:09:09,344 INFO [ResourceDiscoveryComponent.invoker.daemon-2] (org.rhq.plugins.postgres.PostgresDiscoveryComponent)- Failed to connect to the database org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres" at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:291)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108)
at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
at
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:393) at org.postgresql.Driver.connect(Driver.java:267) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at org.rhq.plugins.postgres.PostgresDiscoveryComponent.buildConnection(PostgresDiscoveryComponent.java:195)
at
org.rhq.plugins.postgres.PostgresDiscoveryComponent.getConnection(PostgresDiscoveryComponent.java:259)
at
org.rhq.plugins.postgres.PostgresDiscoveryComponent.createResourceDetails(PostgresDiscoveryComponent.java:150)
at
org.rhq.plugins.postgres.PostgresDiscoveryComponent.discoverResources(PostgresDiscoveryComponent.java:123)
at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:266)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
2010-06-21 12:09:09,345 WARN [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [Postgres Server] Resources - failed after 56 ms. java.lang.Exception: Discovery component invocation failed. at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:270)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException at org.rhq.plugins.postgres.PostgresDiscoveryComponent.getDatabaseNames(PostgresDiscoveryComponent.java:277)
at
org.rhq.plugins.postgres.PostgresDiscoveryComponent.getServerResourceName(PostgresDiscoveryComponent.java:295)
at
org.rhq.plugins.postgres.PostgresDiscoveryComponent.createResourceDetails(PostgresDiscoveryComponent.java:151)
at
org.rhq.plugins.postgres.PostgresDiscoveryComponent.discoverResources(PostgresDiscoveryComponent.java:123)
at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:266)
... 5 more
On 20.06.2010 21:49, Joseph Marques wrote:
Any database instances should be automatically discovered via a process scan.
Hi
Does the RHQ CLI allow to create an alert definition? I've checked AlertDefinitionManagerRemote and AlertManagerRemote but cannot see a way of doing this
Regards Alexey
Hi,
Am 22.07.2010 um 08:55 schrieb Alexey Kamenchuk:
Does the RHQ CLI allow to create an alert definition? I've checked AlertDefinitionManagerRemote and AlertManagerRemote but cannot see a way of doing this
I don't think this is supported yet. Can you please file a RfE at our Bugzilla?
Heiko
Alexey,
Am 22.07.2010 um 15:34 schrieb Alexey Kamenchuk:
https://bugzilla.redhat.com/show_bug.cgi?id=617202 couldnt find a way to specify that this is an enhancement rather then a bug though. have i overlooked the field or is it not available for me?
Perfect. I just prepended "RfE" (Request for Enhancment) - perhaps FR (Feature request is better?)
Anyway, thanks.
rhq-users@lists.stg.fedorahosted.org