Multiple Server instances

Daniel Poggel Daniel_Poggel at web.de
Wed Feb 10 13:43:56 UTC 2010


Thanks for help. I solved the problem with your hints (cause was the API Change ManualAddFacet ==> i didn't noticed that).

Now I have another problem with a metric. If i add a new service manual, i see no metric and no availabilty scan is executed. In the log file i noticed the following error:

2010-02-10 14:34:04,329 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.RuntimeDiscoveryExecutor)- Parent [Resource[id=10404, type=DX4DatabaseService, key=Database Monitoring BELEGE, name=Database Monitoring BELEGE, parent=Database Monitoring , version=2.3]] must be imported/commited before service scan can run.

If i make --cleanconfig with the agent the metric shows up. But that isn't a really nice solution. Can someone help? 




> -----Ursprüngliche Nachricht-----
> Von: "Jay Shaughnessy" <jshaughn at redhat.com>
> Gesendet: 05.02.10 16:47:18
> An: rhq-devel at lists.fedorahosted.org
> Betreff: Re: Multiple Server instances


> 
> Not sure but it sounds like the discovery code is not setting the plugin 
> connection property correctly.  A quick look suggests you may not be 
> setting the plugin config properties.  Certainly different discovered 
> (server) resources should have different plugin configuration values.  
> Check via the GUI to see what values are being set by discovery.   If 
> the values are not as you expect it is the discovery code setting values 
> incorrectly.
> 
>   Also, for testing purposes you could edit the dx4database connection 
> property (if it's not read only) and see if this gets the code working 
> the way you expect.
> 
> On 2/5/2010 3:58 AM, Daniel Poggel wrote:
> > Hello,
> > i developed a plugin to select some data from an oracle database. In Jopr (now RHQ) I can create multiple Server - Instances. In the rhq-plugin.xml I definied a metric, which scheduled every 35 seconds.
> >
> > In my Server Component I have some variables, which set in the start() method like:
> > dx4database = resourceContext.getPluginConfiguration().getSimple(CONFIG_DX4DB).getStringValue();
> >
> > The getValues() Method returns with a JDBC-SQL-SELECT the specific metric. In the SQL-Statement I used the variable, mentioned above.
> > Now it seems that each server in JOPR didn't use his own properties, definied under Connection. The dx4database is defined as "private String dx4database" in the ServerComponentClass.
> > Another Problem is: If i create a new Server in JOPR, the metric that I defined in the rhq-plugin.xml didn't show up under Schedules-Register.
> > Please, can anyone help? How Can I create with the two JAVA-Class (ServerComponent and ServerDiscoverComponent) more than one instance with their own properties and their own attributes?
> >
> >
> > Here are some code snippets:
> > rhqplugin.xml:
> > ......
> >   <server name="Doxis4DatabaseMonitorServer"
> >             class="Doxis4DatabaseMonitorComponent"
> >             discovery="Doxis4DatabaseMonitorDiscoveryComponent"
> >             description="Doxis 4 CSB Server"
> >             supportsManualAdd="true">
> >
> >        <plugin-configuration>
> >              <c:simple-property name="dbname" default="nr-vm-oracle" displayName="Database Name" description="Oracle-Database name" required="true"/>
> >                <c:simple-property name="SID" default="ser" displayName="Database SID" description="The Database SID" required="true"/>
> >                <c:simple-property name="port" default="1521" displayName="Port" description="The Database Access-Port" required="true"/>
> >                 <c:simple-property name="username" default="UI_DOXIS4_UIT" displayName="Username" description="Database - Schema (User)" required="true"/>
> >              <c:simple-property name="password" displayName="Password" description="Password" required="true"/>
> >              <c:simple-property name="dx4database" displayName="Doxis4 Datenbank" description="Doxis4 Datenbank" required="true"/>
> >        </plugin-configuration>
> >
> >        <metric property="archivdocuments" displayType="summary" displayName="Anzahl archiv. Dokumente"/>
> >     </server>
> > .........
> > DiscoveryComponent:
> >      public Set<DiscoveredResourceDetails>  discoverResources(ResourceDiscoveryContext context) {
> >          Set<DiscoveredResourceDetails>  result = new HashSet<DiscoveredResourceDetails>();
> >          ResourceType resourceType = context.getResourceType();
> >          Configuration configuration = null;
> >          List<Configuration>  configurations = context.getPluginConfigurations();
> >          configuration=configurations.get(0);
> >          String key = "Database Monitoring "+configuration.getSimpleValue("dx4database", null);
> >          String name = key;
> >          String version = "3.6";
> >          String description = "Database Monitoring";
> >          result.add(new DiscoveredResourceDetails(resourceType, key, name,
> >                  version, description, configuration, null));
> >
> >          return result;
> >      }
> >
> > ServerComponent:
> > ..............
> >      public void start(ResourceContext con)
> >              throws InvalidPluginConfigurationException, Exception {
> >          this.resourceContext = con;
> >          this.contentContext = con.getContentContext();
> >          database_host = resourceContext.getPluginConfiguration().getSimple(
> >                  CONFIG_DATABASENAME).getStringValue();
> >          database_user = resourceContext.getPluginConfiguration().getSimple(CONFIG_USER)
> >                  .getStringValue();
> >          database_password = resourceContext.getPluginConfiguration().getSimple(
> >                  CONFIG_PASSWORD).getStringValue();
> >          database_port = resourceContext.getPluginConfiguration().getSimple(CONFIG_PORT)
> >                  .getStringValue();
> >          database_sid = resourceContext.getPluginConfiguration().getSimple(CONFIG_SID)
> >                  .getStringValue();
> >          dx4database = resourceContext.getPluginConfiguration().getSimple(CONFIG_DX4DB)
> >                  .getStringValue();
> >
> >          DataSource unpooled = DataSources.unpooledDataSource(
> >                  "jdbc:oracle:thin:@"
> >                          + database_host
> >                          + ":"
> >                          + database_port
> >                          + ":"
> >                          + database_sid, database_user,database_password);
> >          pooled=DataSources.pooledDataSource(unpooled);
> >      }
> >
> >      public void getValues(MeasurementReport report,
> >              Set<MeasurementScheduleRequest>  metrics) throws Exception {
> >
> >          for (MeasurementScheduleRequest request : metrics) {
> >               archdocuments=getArchiveSize();
> >               System.out.println("RequestName:"+request.getName());
> >              if (request.getName().equals("archivdocuments"))
> >                  report.addData(new MeasurementDataNumeric(request, new Double(
> >                          archdocuments)));
> >          }
> >      }
> > .....................
> > ___________________________________________________________
> > NEU: Mit WEB.DE DSL über 1000,- ¿ sparen!
> > http://produkte.web.de/go/02/
> > _______________________________________________
> > rhq-devel mailing list
> > rhq-devel at lists.fedorahosted.org
> > https://fedorahosted.org/mailman/listinfo/rhq-devel
> >    
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel
> 


_________________________________________
NEU: Mit WEB.DE DSL über 1000,- ¿ sparen!
http://produkte.web.de/go/02/



More information about the rhq-devel mailing list