Questo contenuto non è disponibile nella lingua selezionata.

22.2. Changing Server Configuration Before Importing


Metrics schedules and server configuration are applied through synchronizers. Synchronizers control what elements are imported into the JBoss ON server and how to apply them to the server. The synchronizer has a default template which applies configuration changes to every import operation.
The synchronizer configuration can be changed to change what settings are imported into the target server.
The first part of the script would export the XML archive, as before.
//log into the first server
rhq.login('rhqadmin','rhqadmin','server1.example.com','7080');

//export the settings
var ex = SynchronizationManager.exportAllSubsystems();
rhqadmin@localhost:7080$ saveBytesToFile(ex.exportFile, 'export.xml.gz');

// log out of the first server
rhq.logout()
Copy to Clipboard Toggle word wrap
The XML file contains the full configuration information, so just checking that file can give you an idea of what settings to change.
On the second server, change the synchronizer settings.
  1. Get the default definition.
    rhqadmin@localhost:7080$ var systemSettingsImportConfigurationDefinition = SynchronizationManager.getImportConfigurationDefinition('org.rhq.enterprise.server.sync.SystemSettingsSynchronizer')
    Copy to Clipboard Toggle word wrap
  2. Create a new configuration instance.
    rhqadmin@localhost:7080$ var configurationObject = systemSettingsImportConfigurationDefinition.configurationDefinition.defaultTemplate.createConfiguration()
    
    rhqadmin@localhost:7080$ var systemSettingsImportConfiguration = new ImportConfiguration(systemSettingsImportConfigurationDefinition.synchronizerClassName, configurationObject)
    Copy to Clipboard Toggle word wrap
  3. Change the settings.
    For example, this edits the server synchronizer so that it imports only the database settings for storing monitoring data.
    rhqadmin@localhost:7080$ configurationObject.getSimple('propertiesToImport').setValue('CAM_DATA_PURGE_1H, CAM_DATA_PURGE_6H, CAM_DATA_PURGE_1D, CAM_DATA_MAINTENANCE')
    Copy to Clipboard Toggle word wrap
    For the metrics template synchronizer, define which metric schedules to import per resource type, based on a properties list or a properties map. For example:
    rhqadmin@localhost:7080$ configurationObject.getSimple('updateAllSchedules').setBooleanValue(true)
    rhqadmin@localhost:7080$ var updateList = new PropertyList('metricUpdateOverrides')
    rhqadmin@localhost:7080$ var update = new PropertyMap('metricUpdateOverride')
    rhqadmin@localhost:7080$ update.put(new PropertySimple('metricName', 'MCBean|ServerInfo|*|freeMemory'))
    rhqadmin@localhost:7080$ update.put(new PropertySimple('resourceTypeName', 'JBossAS Server'))
    rhqadmin@localhost:7080$ update.put(new PropertySimple('resourceTypePlugin', 'JBossAS5'))
    rhqadmin@localhost:7080$ update.put(new PropertySimple('updateSchedules', 'true'))
    
    rhqadmin@localhost:7080$ updateList.add(update)
    
    rhqadmin@localhost:7080$ configurationObject.put(updateList)
    Copy to Clipboard Toggle word wrap
After changing the synchronizer settings, then import the configuration.
rhqadmin@localhost:7080$ var configsToImport = new java.util.ArrayList()
rhqadmin@localhost:7080$ configsToImport.add(systemSettingsImportConfiguration);
rhqadmin@localhost:7080$ configsToImport.add(metricTemplatesImportConfiguration);
rhqadmin@localhost:7080$ SynchronizationManager.importAllSubsystems(ex, configToImport);
Copy to Clipboard Toggle word wrap
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat