Start-LXCAEventMonitor
This cmdlet creates an event monitor object to which you can subscribed by using the Register-ObjectEvent cmdlet.
You can use this cmdlet to monitor specific Lenovo XClarity Administrator events and trigger a defined script to handle the incoming event. It reconnect to XClarity Administrator when the network is not available or the management server is rebooted, and to continue monitoring events
Syntax
Start-LXCAEventMonitor [-Connection LXCAConnection]
[-EventID String[]]
[-SourceID String[]]
[-Severity EventSeverity[]]
[-EventClass EventClass[]]
[-MessageRegex String]
[CommonParameter]
Parameters
- -Connection LXCAConnection
- Specifies the connection to the Lenovo XClarity Administrator server. If no connection is specified, the result from the last Connect-LXCA cmdlet is used.
- -EventID String[]
- Specifies the event IDs to be monitored.
- -SourceID String[]
- Specifies the UUID of the component that is the event source (raiser or owner).
- -Severity EventSeverity[]
- Specifies the severity of the event to be monitored. You can specify one or more of the following severities, separated by a comma.
- Unknown
- Informational
- Warning
- Minor
- Major
- Critical
- Fatal
NoteThe severities that are listed through this cmdlet differ from those listed in theLenovo XClarity Administrator web interface. Lenovo XClarity Administrator web interface severity Severity parameter Critical Fatal, Critical, Major Warning Minor, Warning Informational Informational Unknown Unknown - -EventClass EventClass[]
- Specifies the event source type. You can specify one or more of the following types, separated by a comma.
- ADAPTOR (adapter card)
- AUDIT
- BLADE (Flex System server)
- COOLING
- DISKS (storage)
- EXPANSION (expansion card)
- IOMODULE (Flex System switch)
- MEMORY
- OTHER
- POWER
- PROCESSOR
- SWITCH (RackSwitch switch)
- SYSTEM (rack or tower server)
- TEST
- UNKNOWN
- OTHER
- BACKPLANE
- CHASSIS
- DRIVE
- EXTDRIVE. External drive
- FAN
- M2_ADAPTER
- M2DRIVE
- OCP
- PCIE
- PSU
- RETIMER
- RISER
- _7MMDrive
- PUMP
- -MessageRegex String
- Specifies the event message regex expression.
- CommonParameters
- This cmdlet supports the following common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer, -PipelineVariable, -OutVariable. For detailed information about each common parameter, see the Microsoft PowerShell Common Parameters webpage.
Results
This cmdlet returns an LXCAEventMonitor object.
Examples
The following example creates an event monitor and the uses Register-ObjectEvent to print out the event ID and message when a monitored event is received.
- -EventName must be LXCAEvent.
- -SourceIdentifier must be a unique string.
- -Action is the script that handles the incoming event.
In the script, $EventArgs.Events is for all incoming events at this moment. Each event has the same properties as the event returned by Get-LXCAEvent cmdlet.
To stop the event monitoring, invoke $monitor.StopMonitor().
$cred = Get-Credential
Connect-LXCA -Host 192.0.2.0 -Port 443 -Credential $cred
$monitor = Start-LXCAEventMonitor -EventClass Audit,Power -Severity Critical,Fatal
Register-ObjectEvent -InputObject $monitor -EventName LXCAEvent -SourceIdentifier MonitorAUDITPOWER`
-Action { Write-Host $EventArgs.Events[0].EventID -ForegroundColor Blue`
Write-Host $EventArgs.Events[0].Message -ForegroundColor Blue }
... ...
$monitor.StopMonitor()
Disconnect-LXCA