PowerShell Cmdlets for Cisco UCS Management Pack

9 C H A P T E R

PowerShell Cmdlets for Cisco UCS Management Pack

Cisco UCS Management Pack supports the use of cmdlets that can be imported from a PowerShell Module. These cmdlets internally take care of functions such as discovery of chassis along with enabling or disabling monitors on components. Previously, these discovery actions had to be performed manually. The cmdlets also allow you to add a new UCS domain or update an existing UCS domain without logging on to the GUI.

This chapter includes the following sections:

? Importing Cmdlets from the PowerShell Module

? Adding or Updating UCS Instance or Instances

? Retrieving, enabling, or disabling UCS Object Discoveries

? Retrieving, enabling or disabling UCS Fault Monitors

Importing Cmdlets from the PowerShell Module

Complete the following steps to import cmdlets to the PowerShell session.

Step 1 On the management server where UCS Operations Manager PowerShell Module is installed, open the Operations Manager Shell Console.

Note The CiscoUcsScomPs module is installed within the folder structure of the Cisco management pack, not in the default Powershell folder.

Step 2 Step 3

Import the CiscoUcsScomPs module. All the cmdlets would then be available in the session.

To see all cmdlets in CiscoUcsScomPs module, use the Get-Command -Module CiscoUcsScomPs command in the PowerShell window.

Note In case you are using another PowerShell session, import the OperationsManager module before importing the CiscoUcsScomPs module.

Cisco UCS Management Pack User Guide, Release 3.x

9-1

Chapter 9 PowerShell Cmdlets for Cisco UCS Management Pack

Adding or Updating UCS Instance or Instances

Add-UcsScomInstance Cmdlet

Adds a new UCS instance to the Management Group. You may specify the proxy details used to connect to UCS. If the port is not specified, the default port (80/443) will be used. You need not specify the Run-As-Account details if you intend to manually create or assign it later. You can create multiple UCS instances within a single management pack. When you are adding a UCS instance, provide an existing management pack (can also be input through pipeline), or you can specify a name for the new management pack to be created using ManagementPackName parameter. If none of these management pack parameters are provided, a new management pack is created with a same name as that of the instance.

Syntax:

Add-UcsScomInstance -UcsIPAddress -MachineType {Agent Managed Computer (Trusted Boundary) | Agent Managed Computer (Untrusted Boundary) | Management Server | Gateway Server} -MachineName -InstanceName [-Port ] [-ManagementPackName ] [-Description ] [-NoSsl] [-ProxyHost ] [-ProxyPort ] [-ProxyUsername ] [-ProxyPassword ] [-ExistingRunAsAccount ]

Add-UcsScomInstance -UcsIPAddress -MachineType {Agent Managed Computer (Trusted Boundary) | Agent Managed Computer (Untrusted Boundary) | Management Server | Gateway Server} -MachineName -InstanceName -RunAsAccount -RunAsCredential [-Port ] [-ManagementPackName ] [-Description ] [-NoSsl] [-ProxyHost ] [-ProxyPort ] [-ProxyUsername ] [-ProxyPassword ]

Add-UcsScomInstance -UcsIPAddress -MachineType {Agent Managed Computer (Trusted Boundary) | Agent Managed Computer (Untrusted Boundary) | Management Server | Gateway Server} -MachineName -InstanceName -ExistingManagementPack -Description -RunAsAccount -RunAsCredential [-Port ] [-NoSsl] [-ProxyHost ] [-ProxyPort ] [-ProxyUsername ] [-ProxyPassword ]

Add-UcsScomInstance -UcsIPAddress -MachineType {Agent Managed Computer (Trusted Boundary) | Agent Managed Computer (Untrusted Boundary) | Management Server | Gateway Server} -MachineName -InstanceName -ExistingManagementPack -Description [-Port ] [-NoSsl] [-ProxyHost ] [-ProxyPort ] [-ProxyUsername ] [-ProxyPassword ] [-ExistingRunAsAccount ]

Parameters ? UcsIPAddress - IP address or host name of the UCS to register ? MachineType - Type of Operations Manager machine to register the UCS ? MachineName - FQDN of the machine on which UCS will be registered (all scripts related to this

UCS MP will be run on this machine) ? InstanceName - Name to be given to this UCS instance ? Port - Port number ? ManagementPackName - Name of the new management pack to be created (if not specified,

InstacneName will be used for management pack)

Cisco UCS Management Pack User Guide, Release 3.x

9-2

Chapter 9 PowerShell Cmdlets for Cisco UCS Management Pack

? Description - Optional description string for the UCS instance ? NoSsl - Switch parameter to specify non-secure (http) connectivity with UCS ? ProxyHost - IP address or hostname of proxy server to be used for communicating with UCS ? ProxyPort - Proxy port number ? ProxyUsername - Username for proxy server ? ProxyPassword - Password for proxy server ? ExistingRunAsAccount - Name of the existing Run-As account to be used for this instance ? RunAsAccount - Name of new Run-As account to be created for this instance ? RunAsCredential - Credentials for the new Run-As account to be created (credentials of UCS) ? ExistingManagementPack - Existing management pack object to which the instance is to be added

Note You can either add a UCS instance on a new Management pack or an existing pack name, but you cannot do both for a single Instance.

Examples:

$secureString = ConvertTo-SecureString "PASSWORD" -AsPlainText -Force $credentials = New-Object System.Management.Automation.PSCredential ("USERNAME",$secureString)

Add-UcsScomInstance -UcsIPAddress 10.10.10.10 ?InstanceName `UCSNAME_10' ?MachineType `Management Server' ?MachineName FQDN of `SCOM_MS1' ?Secure ?ProxyHost '10.10.10.2' ?ProxyPort 58 ?RunAsAccount `UCS10' ?RunAsCredential $credentials

Update-UcsScomInstance Cmdlet Updates the required properties for an existing template (registered UCS). You may specify the new values for any parameter or parameters you intend to modify. For the remaining parameters, existing values are used.

Syntax:

Update-UcsScomInstance [-InstanceName] [[-UcsIPAddress] ] [[-Port] ] [[-MachineType] {Agent Managed Computer (Trusted Boundary) | Agent Managed Computer (Untrusted Boundary) | Management Server | Gateway Server}] [[-MachineName] ] [[-Description] ] [[-Secure] ] [[-ProxyHost] ] [[-ProxyPort] ] [[-ProxyUsername] ] [[-ProxyPassword] ]

Parameters ? InstanceName ? Name of the registered UCS instance to be updated ? UcsIPAddress ? New IP address or hostname to be assigned ? Port ? New port number ? MachineType ? New Machine Type ? MachineName ? FQDN of new Operations Manager machine name ? Description ? New description of MP ? Secure ? Boolean value to either set or reset secure connection option ? ProxyHost - New proxy server host name or IP address to be used for communicating with UCS ? ProxyPort ? New proxy port number

Cisco UCS Management Pack User Guide, Release 3.x

9-3

Chapter 9 PowerShell Cmdlets for Cisco UCS Management Pack

? ProxyUsername ? New proxy username ? ProxyPassword ? New proxy password

Examples

Update-UcsScomInstance -InstanceName `SCOM_MS1' ?MachineType `Agent Managed Computer (Trusted Boundary)' ?MachineName FQDN of machine `SCOM_AGENT1' ?Description `UCS 10' ?Secure $false ?Port 80

Update-UcsScomAllInstances Cmdlet Updates all the existing UCS instances after upgrade from version 3.0(1) or 3.0.(2) to 3.1.2.

Retrieving, enabling, or disabling UCS Object Discoveries

Get-UcsScomDiscovery Cmdlet Gets all Operations Manager discoveries per the specified criteria. You need to specify the instance name and an optional classes or discovery names.

Syntax:

Get-UcsScomDiscovery -InstanceName Get-UcsScomDiscovery -InstanceName -DiscoveryName Get-UcsScomDiscovery -InstanceName -ClassName

Parameters: ? InstanceName ? Displays name of the registered UCS instance ? DiscoveryName ? Array of display names of discoveries ? ClassName ? Array of display names of classes for which corresponding discoveries are returned

Examples:

Get-UcsScomDiscovery ?Instancename `MyMpName' Get-UcsScomDiscovery ?Instancename `MyMpName' -DiscoveryName `Chassis Discovery','Blade Discovery','FEX Discovery' Get-UcsScomDiscovery ?Instancename `MyMpName' -DiscoveryName `Chassis Discovery' Get-UcsScomDiscovery ?Instancename `MyMpName' ?ClassName `Blade Interface Card','Fabric Interconnect PSU'

Enable-UcsScomDiscovery Cmdlet Enables all Operations Manager discoveries provided as input. You may pipe the output of Get-UcsScomDiscovery cmdlet or provide it as an array of discoveries.

Syntax:

Enable-UcsScomDiscovery [-Discovery]

Parameter: Discovery ? Array of Operations Manager discoveries retrieved using the Get-UcsScomDiscovery cmdlet

Cisco UCS Management Pack User Guide, Release 3.x

9-4

Chapter 9 PowerShell Cmdlets for Cisco UCS Management Pack

Examples:

Get-UcsScomDiscovery ?InstanceName `MyMpName' -DiscoveryName `Chassis Discovery','Blade Discovery' | Enable-UcsScomDiscovery

Note All parent discoveries (if disabled) are also enabled with complete information on the Operations Manager console.

Disable-UcsScomDiscovery Cmdlet Disables all Operations Manager discoveries provided as input. You may pipe the output of Get-UcsScomDiscovery cmdlet or provide it as an array of discoveries.

Syntax:

Disable-UcsScomDiscovery [-Discovery]

Parameter: Discovery ? Array of Operations Manager discoveries retrieved using the Get-UcsScomDiscovery cmdlet

Examples:

Get-UcsScomDiscovery ?InstanceName `MyMpName' -DiscoveryName `Chassis Discovery','Blade Discovery' | Disable -UcsScomDiscovery

Retrieving, enabling or disabling UCS Fault Monitors

Get-UcsScomMonitor Cmdlet Gets all Operations Manager monitors per specified criteria. You need to specify the Instance name. Optional search criteria include Classes, Severity, Fault IDs, and Affected Classes.

Syntax:

Get-UcsScomMonitor -InstanceName [-Class ] [-IncludeSubClasses] [-Severity {Error | Warning}] Get-UcsScomMonitor -InstanceName -FaultID [-AffectedClass ]

Parameters: ? InstanceName ? Displays name of the registered UCS instance ? Class ? Array of display names of classes for which corresponding monitors will be returned ? IncludeSubClasses ? To include the subclasses (of class parameter) as well ? Severity ? Severity of monitors to be considered. This could also be an `Error' or `Warning'. Error

maps to Critical in Operations Manager ? FaultID ? Array of Fault IDs for which corresponding monitors are returned ? AffectedClass ? Array of target class IDs to filter monitors further

Examples:

Get-UcsScomMonitor ?Instancename `MyMpName' ? Class `Blade','Chassis' ?Severity `Error' Get-UcsScomMonitor ?Instancename `MyMpName' ? Class `Blade' - IncludeSubClasses Get-UcsScomMonitor ?Instancename `MyMpName' ?Severity `Warning'

Cisco UCS Management Pack User Guide, Release 3.x

9-5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download