List Spectrum users through the CLI
search cancel

List Spectrum users through the CLI

book

Article ID: 233867

calendar_today

Updated On:

Products

Spectrum Network Observability

Issue/Introduction

How to get the list of users for a particular user group through CLI.
 
How to get the list of model handles for users in CA Spectrum.
 
We used the following command. This can be done using the Command Line Interface (CLI) “show enumerations” command.
 
In the following command, 0x11ee8 is the attribute id for Model_Class and 0x3d0002 is the model type handle for the GnSNMPDev model type.
 
[spectrum@spectrum vnmsh]$ ./show enumerations attr=0x11ee8 mth=0x3d0002
 
But we specifically need the list for "users ".
 
If you want to fetch via API, the user for a particular group, how to fetch it?

Environment

All supported DX NetOps Spectrum releases

Cause

Out of the Box there are no direct APIs for this. A new one would require an RFE submitted to Product Management for a new feature.

Resolution

The sample commands shown below are based off this User hierarchy in Spectrum.

Open a terminal on the SpectroSERVER to query.

Go to the $SPECROOT/vnsmh directory. Log in to the Spectrum CLI using the command "./connect". Sample output after entering vnmsh CLI:

[spectrum@ss vnmsh]$ ./connect

Starting CLI Local Server VnmShd
SPECTRUM Command Line Interface 24.3.5.000

Copyright 2025 CA Technologies, A Broadcom Company All Rights Reserved

CA Technologies, A Broadcom Company
One CA Plaza
Islandia, NY  11749 USA
+1 (800) 225-5224

connect: successful ss
current landscape is 0x1000000

WARNING:  CLI is a powerful tool that allows a user to make changes
directly to the SPECTRUM knowledge-base without the error checking
provided by OneClick.  Please read the accompanying CLI user
documentation before using the create, destroy, or update commands.

[spectrum@ss vnmsh]$

To get all users use mth=0x10004. The command is "./show models mth=0x10004". Sample output.

[spectrum@ss vnmsh]$ ./show models mth=0x10004
MHandle     MName                             MTypeHnd    MTypeName
0x1012c5c   test12345(Active)                 0x10004     User
0x1012c5a   test(Active)                      0x10004     User
0x100c995   UserA(Active)                     0x10004     User
0x1000354   UserB(Active)                  0x10004     User
0x1000349   UserC(Active)                  0x10004     User
0x1000063   spectrum(Active)                  0x10004     User
[spectrum@ss vnmsh]$

To get all user groups use mth=0x1040a. The command is "./show models mth=0x1040a". Sample output.

[spectrum@ss vnmsh]$ ./show models mth=0x1040a
MHandle     MName                             MTypeHnd    MTypeName
0x1000352   pmspec                            0x1040a     UserGroup
[spectrum@ss vnmsh]$

To get users in a group use the group Model_Handle (Ex: 0x1000352 is a group model handle above). The command is "./show children mh=0x1000352". Sample output.

[spectrum@ss vnmsh]$ ./show children mh=0x1000352
MHandle     MName                             MTypeHnd    MTypeName        Relation
0x1000349   UserC                                0x10004     User             Has_Member
0x1000354   UserB                                0x10004     User             Has_Member
0x1000353   UserGroup-pmspec-671683d5-fe68-1  0x10475     AccessGroup      HasAccessGroup
[spectrum@ss vnmsh]$

To get the group a user is a member part use the user model handle (Ex: 0x1000349 is UserC users Model_Handle value). The command is "./show parents mh=0x1000349". Sample output.

[spectrum@ss vnmsh]$ ./show parents mh=0x1000349
MHandle     MName                             MTypeHnd    MTypeName        Relation
0x1000006   Repair                            0x10371     Repair_Entity    Can_Assign
0x1000352   pmspec                            0x1040a     UserGroup        Has_Member
0x1000013   Service Manager                   0x10453     LicenseRole      UserRole
0x1000016   Administrator                     0x10453     LicenseRole      UserRole
0x1000017   Operator                          0x10453     LicenseRole      UserRole
[spectrum@ss vnmsh]$