Search

2. Getting the JBoss ON ID for an Object

download PDF
Everything in JBoss ON — resources, configuration properties, bundle archives, templates, alerts, everything — is identified with a unique ID number. Most of these ID numbers are visible in the web UI as part of the URL which goes to that object's details page.
Not every ID is easily found, though. For example, searching for a metric template requires the resource type ID, but the resource type ID is hard to find.
In other instances, you may want to run a script against multiple resources, which means there are multiple resource IDs which may not be explicitly known at the time you write the script.
Searching for a resource (Section 1, “Searches”) retrieves the resource's details, including its ID.
rhqadmin@localhost:7080$ criteria = new ResourceCriteria();
ResourceCriteria:
        inventoryManagerRequired: false
                 persistentClass: class org.rhq.core.domain.resource.Resource

rhqadmin@localhost:7080$ criteria.addFilterResourceTypeName('Linux')

rhqadmin@localhost:7080$ ResourceManager.findResourcesByCriteria(criteria);
one row
Resource:
                         id: 10001
                       name: gs-dl585g2-01.rhts.eng.bos.redhat.com
                    version: Linux 2.6.32-220.el6.x86_64
        currentAvailability: UP
               resourceType: Linux
This is true for any *Criteria search. It retrieves the ID for the object is searches for, even if that ID is not explicitly displayed.
This ID can then be used in other operations.
rhqadmin@localhost:7080$ var metrics = MeasurementDataManager.findLiveData(resources.get(0).id, [mdefs.get(0).id]);
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.