Server Automation (SA): Tools to test and report on Dynamic Device Groups (SA 10.10 and up)

  • KM02149634
  • 22-Feb-2016
  • 14-May-2021


Description and location of four tools provided by HP SA support that allows for the reporting and testing of Dynamic Device Groups (DDGs) used in a SA environment (SA version 10.10 and above).


What tools are available for use in testing and reporting on Dynamic Device Groups (DDGs) in a
Server Automation environment


Dynamic Dervice Groups (DDGs) in Server Automation are dynamically maintained lists of SA
managed servrers that grows and contracts as servers are added and removed from the
SA environment.  They are very handy, but if used incorrectly DDGs can have a negative effect
on the performance of the SA database server as their memberships are recalculated hourly;
if the rules defining the DDGs are inefficient and/or there are a very large number of DDGs
in the environment, their recalculations can make the SA database very busy.

Starting with SA 10.20, four tools were introduced via the SA Rollups (product patches that
can be obtained from HP Support). The tools/scripts are called dgDump, dgTree, dgUsage and dgOptimizer.
All four tools (if installed) will be found in /opt/opsware/support/bin, and each has man pages
in /opt/opsware/support/man/man1. These tools are also part of the Opsware Support tools RPM (OPSWtools.rpm)
that can be obtained from Microfocus support (as well as current SA rollups). 

dgDump - Dumps the details of a dynamic device group, reports on the select statement being
generated by the membership rules of the DDG.  The optional -t flag, if specified, will also
cause the select statements to be executed, and will report both the amount of time required
by the select statement and how many members currently belong in the DDG.

Example of the dgDump usage..

              dgDump -t 5540001

              role_class_id: 5540001
              role_class_full_name: Device Groups Private brett Demo DeviceGroup
              role_class_short_name: Demo DeviceGroup
              created_by: brett
              created_dt: 20150414T06:42:01
              modified_by: : brett
              modified_dt: : 20150414T06:44:37
              parent_role_class_id: 5410001
              rule: ((device_ram LESS_THAN_OR_EQUAL_TO â2048â))
              sql: SELECT DISTINCT dvc_id from  (select /* ResourceTypeView.01 */ devices.*
              from truth.devices where devices.DVC_ID in (((((select /* RA.device_base_view */
               distinct devices.dvc_id from   (select /* RA.device_ram */ devices.dvc_id as
              dvc_id, round(to_number(mem.quantity) / 1024) as device_ram from truth.devices
              left join (select * from truth.memory_components where memory_type = âRAMâ) mem
              on devices.dvc_id = mem.dvc_id) device_ram,  truth.devices where
              devices.opsw_lifecycle != âDELETEDâ and devices.dvc_id = device_ram.dvc_id  and
              device_ram.device_ram <= 2048)))))) devices
              time_to_execute: 1 devices in 0.002 seconds.


Of note in the above, is the name of the DDG, the creator, the rules used in SA to define the membership, and the resulting
SQL generated by SA.   The amount of time and the number of devices present in the DDG will only
be present if the -t option is selected.


dgTree - Reports on the number and type of Device groups for a specific user. 

Example of the dgTree output:

       # dgTree -di -s ascii2 "Private/jyaya"
       jyaya (D:17340001)
        +- Mine (D:17360001)
        |  +- Still Mine (D:17380001)
        |  â- Also Mine (D:17370001)
        +- My other Static (S:17400001)
        â- My Static (S:17390001)

It the example above, jyaya is the SA user, and the D or S before the Device Group ID is either Dynamic or Static.


dgUsage - Reports on the usage of the device groups by other components of SA (software policies, audit polices,
patch policies, etc.  Very useful to tracking down DDGs that are no longer used and that can be removed in order
to remove their impact on the database. 

Example of the dbUsage tool.

       # dgUsage --verbose Public/dgRoot
       dgRoot [17550001] - DeviceGroup:[17600001,17570001,17560001,17570002,17590001,17580001]
       dgRoot/AccessControlUserGroup [17600001] - AccessControl
       dgRoot/AuditLinkedDG [17570001] - AuditPolicy:[20001]
       dgRoot/SoftwarePolicyLinkedDG [17560001] - SoftwarePolicy:[1210001]
       dgRoot/MultiUsage [17570002] - SoftwarePolicy:[610001,920001],PatchPolicy:[17560002]
       dgRoot/PatchPolicyLinkedDG [17590001] - PatchPolicy:[980001,17560002]
       dgRoot/DeviceGroupWithServer [17580001] - ORPHAN

In the case above, ORPHAN indicates that the DDG is not being used by any SA component currently.


dgOptimizer - Scans thru the rules of every dynamic device group that uses the CONTAINS or BEGINS_WITH operators and queries the database to see
the operator(s) can be replaced with something simpler and less "busy".  This can in turn decrease the performance hit these dynamic device

group queries place on the database. 

Again, man pages for each of these tools can be found in /opt/opsware/support/man/man1.