A user asked about using Invoke-CUQuery -Table and sIPAddresses to enrich alerts for ControlUp. They got it to work using individual quotes for each field. The discussion can be found at https://support.controlup.com/v1/docs/monitor-cluster-powershell-fields-by-table#computers.
Read the entire ‘Understanding the use of Invoke-CUQuery -Table in ControlUp’ thread below:
Happy Saturday, everyone.
Hopefully this is an easy question. I’m learning how to use the Invoke-CUQuery -Table command within a PowerShell script to enrich alerts, and I need to know which table contains the IP address of a computer.
Computers or ComputerView. IPAddresses field or something like that. See https://support.controlup.com/v1/docs/monitor-cluster-powershell-fields-by-table#computers
Do note that this is a text field. If a machine has multiple IP addresses you’ll need to parse the field. I think there is a new line between addresses
Hey Dennis. Thanks.
Odd issue. The following works:
invoke-cuquery -table Computers -where "sName = ‘ILARLWCPA2040’" -fields sIPAddresses
The following errors:
invoke-cuquery -table Computers -where "sName = ‘ILARLWCPA2040’" -fields "sIPAddresses,sOSCaption"
with:
invoke-cuquery : Query has failed with error: ‘Acceptable data loss threshold was crossed with: 91.6666666666667 percentage, query is aborted.’
At line:3 char:1
+ invoke-cuquery -table Computers -where "sName = ‘ILARLWCPA2040’" -fie …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`+ CategoryInfo : InvalidArgument: (:) [Invoke-CUQuery], InvalidOperationException`
`+ FullyQualifiedErrorId : General,ControlUp.PowerShell.User.Cmdlets.QueryMonitorService.InvokeQueryCmdlet`
I got it to work using * , but not sure why adding two fields errored out.
Each field needs quotes individually.
So -fields “sIPAdresses”,”sOSCaption”
Oh….
Continue reading and comment on the thread ‘Understanding the use of Invoke-CUQuery -Table in ControlUp’. Not a member? Join Here!
Categories: All Archives, ControlUp Scripts & Triggers
