Functions/Public/Platform.ps1
|
# Platform dashboard, item, and server functions Function Get-NectarPlatformItems { <# .SYNOPSIS Return information about all the platforms installed .DESCRIPTION Return information about all the platforms installed .PARAMETER Platform Show information about selected platform. Choose one or more from: 'AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','CISCO','CISCO_CMS','CISCO_VKM','SKYPE','SKYPE_ONLINE','TEAMS' .PARAMETER TimePeriod The time period to show event data from. Select from 'LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','CUSTOM'. CUSTOM requires using TimePeriodFrom and TimePeriodTo parameters. .PARAMETER TimePeriodFrom The earliest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodTo parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TimePeriodTo The latest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodFrom parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .PARAMETER PageSize The size of the page used to return data. Defaults to 1000 .PARAMETER ResultSize The total number of results to return. Defaults to 1000. Maximum result size is 9,999,999 results .EXAMPLE Get-NectarPlatformItems -Platform CISCO .NOTES Version 1.0 #> Param ( [Parameter(Mandatory=$True)] [ValidateSet('AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','SKYPE','CISCO','CISCO_CMS','CISCO_VKM','CISCO_WEBEX_CALLING','TEAMS','SKYPE_ONLINE','CISCO_CMS_VKM','AVAYA_AURA_CM','RIG','LYNC_VKM','SKYPE_FOR_BUSINESS_VKM','CISCO_UNITY','CISCO_EXPRESSWAY','AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','ZOOM','ENDPOINT_CLIENT','WEB_RTC_AIR_PHONE','WEB_RTC_AMAZON_CONNECT','WEB_RTC_CISCO_WEBEX','WEB_RTC_FIVE9','WEB_RTC_GENESYS_CLOUD','WEB_RTC_GENESYS_MCPE','WEB_RTC_NICE_CXONE','DIAGNOSTICS','GENESYS','JABRA','MISCELLANEOUS', IgnoreCase=$True)] [string]$Platform, [Parameter(Mandatory=$False)] [ValidateSet('LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','TODAY','YESTERDAY','WEEK_TO_NOW','MONTH_TO_NOW','CUSTOM', IgnoreCase=$True)] [string]$TimePeriod = 'LAST_HOUR', [Parameter(Mandatory=$False)] [Alias("StartDateFrom")] [DateTime]$TimePeriodFrom, [Parameter(Mandatory=$False)] [Alias("StartDateTo")] [DateTime]$TimePeriodTo, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName, [Parameter(Mandatory=$False)] [ValidateRange(1,100000)] [int]$PageSize = 1000, [Parameter(Mandatory=$False)] [ValidateRange(1,9999999)] [int]$ResultSize ) Begin { Connect-NectarCloud } Process { $Params = @{ 'TimePeriod' = $TimePeriod 'Platform' = $Platform } # Convert date to UNIX timestamp If($TimePeriodFrom) { $TimePeriodFrom = (Get-Date -Date $TimePeriodFrom -UFormat %s) + '000' $Params.Add('StartDateFrom',$TimePeriodFrom) } If($TimePeriodTo) { $TimePeriodTo = (Get-Date -Date $TimePeriodTo -UFormat %s) + '000' $Params.Add('StartDateTo',$TimePeriodTo) } Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } If ($TenantName) { $Params.Add('Tenant',$TenantName) } $URI = "https://$Global:NectarCloud/dapi/platform/clusters" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader -Body $Params If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} $JSON.elements } Catch { Write-Error "Could not get platform items. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformItemSummary { <# .SYNOPSIS Return summary information about a specific platform item .DESCRIPTION Return summary information about a specific platform item .PARAMETER ClusterID The ID of a cluster to return summary information .PARAMETER Platform Show information about selected platform. Choose one or more from: 'AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','CISCO','CISCO_CMS','CISCO_VKM','SKYPE','SKYPE_ONLINE','TEAMS' .PARAMETER Source Show information about either events, current status or both .PARAMETER TimePeriod The time period to show event data from. Select from 'LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','CUSTOM'. CUSTOM requires using TimePeriodFrom and TimePeriodTo parameters. .PARAMETER TimePeriodFrom The earliest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodTo parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TimePeriodTo The latest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodFrom parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .PARAMETER PageSize The size of the page used to return data. Defaults to 1000 .PARAMETER ResultSize The total number of results to return. Defaults to 1000. Maximum result size is 9,999,999 results .EXAMPLE Get-NectarPlatformItemSummary -Platform CISCO -ClusterID 3_1 .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [string]$ClusterID, [Parameter(Mandatory=$True)] [ValidateSet('AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','SKYPE','CISCO','CISCO_CMS','CISCO_VKM','CISCO_WEBEX_CALLING','TEAMS','SKYPE_ONLINE','CISCO_CMS_VKM','AVAYA_AURA_CM','RIG','LYNC_VKM','SKYPE_FOR_BUSINESS_VKM','CISCO_UNITY','CISCO_EXPRESSWAY','AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','ZOOM','ENDPOINT_CLIENT','WEB_RTC_AIR_PHONE','WEB_RTC_AMAZON_CONNECT','WEB_RTC_CISCO_WEBEX','WEB_RTC_FIVE9','WEB_RTC_GENESYS_CLOUD','WEB_RTC_GENESYS_MCPE','WEB_RTC_NICE_CXONE','DIAGNOSTICS','GENESYS','JABRA','MISCELLANEOUS', IgnoreCase=$True)] [string]$Platform, [Parameter(Mandatory=$False)] [ValidateSet('Events','Current','All', IgnoreCase=$True)] [string]$Source = 'All', [Parameter(Mandatory=$False)] [ValidateSet('LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','TODAY','YESTERDAY','WEEK_TO_NOW','MONTH_TO_NOW','CUSTOM', IgnoreCase=$True)] [string]$TimePeriod = 'LAST_HOUR', [Parameter(Mandatory=$False)] [Alias("StartDateFrom")] [DateTime]$TimePeriodFrom, [Parameter(Mandatory=$False)] [Alias("StartDateTo")] [DateTime]$TimePeriodTo, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName, [Parameter(Mandatory=$False)] [ValidateRange(1,100000)] [int]$PageSize = 1000, [Parameter(Mandatory=$False)] [ValidateRange(1,9999999)] [int]$ResultSize ) Begin { Connect-NectarCloud } Process { $Params = @{ 'TimePeriod' = $TimePeriod 'Platform' = $Platform } # Convert date to UNIX timestamp If($TimePeriodFrom) { $TimePeriodFrom = (Get-Date -Date $TimePeriodFrom -UFormat %s) + '000' $Params.Add('StartDateFrom',$TimePeriodFrom) } If($TimePeriodTo) { $TimePeriodTo = (Get-Date -Date $TimePeriodTo -UFormat %s) + '000' $Params.Add('StartDateTo',$TimePeriodTo) } Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } If ($TenantName) { $Params.Add('Tenant',$TenantName) } $URI = "https://$Global:NectarCloud/dapi/platform/cluster/$ClusterID/summary" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader -Body $Params If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} If ($Source -ne 'All') { $JSON.$Source } Else { $JSON } } Catch { Write-Error "Could not get platform item summary. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformItemResources { <# .SYNOPSIS Return resource information about a specific platform item .DESCRIPTION Return resource information about a specific platform item .PARAMETER ClusterID The ID of a cluster to return resource information .PARAMETER Platform Show information about selected platform. Choose one or more from: 'AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','CISCO','CISCO_CMS','CISCO_VKM','SKYPE','SKYPE_ONLINE','TEAMS' .PARAMETER TimePeriod The time period to show event data from. Select from 'LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','CUSTOM'. CUSTOM requires using TimePeriodFrom and TimePeriodTo parameters. .PARAMETER TimePeriodFrom The earliest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodTo parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TimePeriodTo The latest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodFrom parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .PARAMETER PageSize The size of the page used to return data. Defaults to 1000 .PARAMETER ResultSize The total number of results to return. Defaults to 1000. Maximum result size is 9,999,999 results .EXAMPLE Get-NectarPlatformItemResources -Platform CISCO -ClusterID 3_1 .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [string]$ClusterID, [Parameter(Mandatory=$True)] [ValidateSet('AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','SKYPE','CISCO','CISCO_CMS','CISCO_VKM','CISCO_WEBEX_CALLING','TEAMS','SKYPE_ONLINE','CISCO_CMS_VKM','AVAYA_AURA_CM','RIG','LYNC_VKM','SKYPE_FOR_BUSINESS_VKM','CISCO_UNITY','CISCO_EXPRESSWAY','AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','ZOOM','ENDPOINT_CLIENT','WEB_RTC_AIR_PHONE','WEB_RTC_AMAZON_CONNECT','WEB_RTC_CISCO_WEBEX','WEB_RTC_FIVE9','WEB_RTC_GENESYS_CLOUD','WEB_RTC_GENESYS_MCPE','WEB_RTC_NICE_CXONE','DIAGNOSTICS','GENESYS','JABRA','MISCELLANEOUS', IgnoreCase=$True)] [string]$Platform, [Parameter(Mandatory=$False)] [ValidateSet('LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','TODAY','YESTERDAY','WEEK_TO_NOW','MONTH_TO_NOW','CUSTOM', IgnoreCase=$True)] [string]$TimePeriod = 'LAST_HOUR', [Parameter(Mandatory=$False)] [Alias("StartDateFrom")] [DateTime]$TimePeriodFrom, [Parameter(Mandatory=$False)] [Alias("StartDateTo")] [DateTime]$TimePeriodTo, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName, [Parameter(Mandatory=$False)] [ValidateRange(1,100000)] [int]$PageSize = 1000, [Parameter(Mandatory=$False)] [ValidateRange(1,9999999)] [int]$ResultSize ) Begin { Connect-NectarCloud } Process { $Params = @{ 'TimePeriod' = $TimePeriod 'Platform' = $Platform } # Convert date to UNIX timestamp If($TimePeriodFrom) { $TimePeriodFrom = (Get-Date -Date $TimePeriodFrom -UFormat %s) + '000' $Params.Add('StartDateFrom',$TimePeriodFrom) } If($TimePeriodTo) { $TimePeriodTo = (Get-Date -Date $TimePeriodTo -UFormat %s) + '000' $Params.Add('StartDateTo',$TimePeriodTo) } Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } If ($TenantName) { $Params.Add('Tenant',$TenantName) } $URI = "https://$Global:NectarCloud/dapi/platform/cluster/$ClusterID/resources" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader -Body $Params If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} $JSON } Catch { Write-Error "Could not get platform item server resources. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformItemServers { <# .SYNOPSIS Return information about a specific platform item's servers .DESCRIPTION Return information about a specific platform item's servers .PARAMETER ClusterID The ID of a cluster to return server information .PARAMETER Platform Show information about selected platform. Choose one or more from: 'AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','CISCO','CISCO_CMS','CISCO_VKM','SKYPE','SKYPE_ONLINE','TEAMS' .PARAMETER Type Show information about either publishers, subscribers or both .PARAMETER TimePeriod The time period to show event data from. Select from 'LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','CUSTOM'. CUSTOM requires using TimePeriodFrom and TimePeriodTo parameters. .PARAMETER TimePeriodFrom The earliest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodTo parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TimePeriodTo The latest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodFrom parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .PARAMETER PageSize The size of the page used to return data. Defaults to 1000 .PARAMETER ResultSize The total number of results to return. Defaults to 1000. Maximum result size is 9,999,999 results .EXAMPLE Get-NectarPlatformItemServers -Platform CISCO -ClusterID 3_1 .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [string]$ClusterID, [Parameter(Mandatory=$True)] [ValidateSet('AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','SKYPE','CISCO','CISCO_CMS','CISCO_VKM','CISCO_WEBEX_CALLING','TEAMS','SKYPE_ONLINE','CISCO_CMS_VKM','AVAYA_AURA_CM','RIG','LYNC_VKM','SKYPE_FOR_BUSINESS_VKM','CISCO_UNITY','CISCO_EXPRESSWAY','AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','ZOOM','ENDPOINT_CLIENT','WEB_RTC_AIR_PHONE','WEB_RTC_AMAZON_CONNECT','WEB_RTC_CISCO_WEBEX','WEB_RTC_FIVE9','WEB_RTC_GENESYS_CLOUD','WEB_RTC_GENESYS_MCPE','WEB_RTC_NICE_CXONE','DIAGNOSTICS','GENESYS','JABRA','MISCELLANEOUS', IgnoreCase=$True)] [string]$Platform, [Parameter(Mandatory=$False)] [ValidateSet('Publisher','Subscribers','All', IgnoreCase=$True)] [string]$Type = 'All', [Parameter(Mandatory=$False)] [ValidateSet('LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','TODAY','YESTERDAY','WEEK_TO_NOW','MONTH_TO_NOW','CUSTOM', IgnoreCase=$True)] [string]$TimePeriod = 'LAST_HOUR', [Parameter(Mandatory=$False)] [Alias("StartDateFrom")] [DateTime]$TimePeriodFrom, [Parameter(Mandatory=$False)] [Alias("StartDateTo")] [DateTime]$TimePeriodTo, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName, [Parameter(Mandatory=$False)] [ValidateRange(1,100000)] [int]$PageSize = 1000, [Parameter(Mandatory=$False)] [ValidateRange(1,9999999)] [int]$ResultSize ) Begin { Connect-NectarCloud } Process { $Params = @{ 'TimePeriod' = $TimePeriod 'Platform' = $Platform } # Convert date to UNIX timestamp If($TimePeriodFrom) { $TimePeriodFrom = (Get-Date -Date $TimePeriodFrom -UFormat %s) + '000' $Params.Add('StartDateFrom',$TimePeriodFrom) } If($TimePeriodTo) { $TimePeriodTo = (Get-Date -Date $TimePeriodTo -UFormat %s) + '000' $Params.Add('StartDateTo',$TimePeriodTo) } Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } If ($TenantName) { $Params.Add('Tenant',$TenantName) } $URI = "https://$Global:NectarCloud/dapi/platform/cluster/$ClusterID/servers" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader -Body $Params If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} If ($Type -ne 'All') { $JSON.$Type } Else { $JSON } } Catch { Write-Error "Could not get platform item servers. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformServerServices { <# .SYNOPSIS Return service information about a specific platform item .DESCRIPTION Return service information about a specific platform item .PARAMETER ClusterID The ID of a cluster to return service information .PARAMETER ServerID The ID of a server within a cluster to return service information .PARAMETER Platform Show information about selected platform. Choose one or more from: 'AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','CISCO','CISCO_CMS','CISCO_VKM','SKYPE','SKYPE_ONLINE','TEAMS' .PARAMETER TimePeriod The time period to show event data from. Select from 'LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','CUSTOM'. CUSTOM requires using TimePeriodFrom and TimePeriodTo parameters. .PARAMETER TimePeriodFrom The earliest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodTo parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TimePeriodTo The latest date/time to show event data from. Must be used in conjunction with -TimePeriod CUSTOM and TimePeriodFrom parameters. Use format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'. All time/dates in UTC. Use date-time format as in 2020-04-20T17:46:37.554 .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .PARAMETER PageSize The size of the page used to return data. Defaults to 1000 .PARAMETER ResultSize The total number of results to return. Defaults to 1000. Maximum result size is 9,999,999 results .EXAMPLE Get-NectarPlatformServerServices -Platform CISCO -ClusterID 3_1 -ServerID 1 .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [Alias("PlatformItemId")] [string]$ClusterID, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [Alias("Id")] [string]$ServerID, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [ValidateSet('EDGE','FE','MEDIATION','GATEWAY','PUBLISHER','SUBSCRIBER','CUBE','IM_PRESENCE','VG224','CUCM','CMS','HW_CFB','CUCM_SW_CFB', IgnoreCase=$False)] [string]$Type, [Parameter(Mandatory=$True)] [ValidateSet('AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','SKYPE','CISCO','CISCO_CMS','CISCO_VKM','CISCO_WEBEX_CALLING','TEAMS','SKYPE_ONLINE','CISCO_CMS_VKM','AVAYA_AURA_CM','RIG','LYNC_VKM','SKYPE_FOR_BUSINESS_VKM','CISCO_UNITY','CISCO_EXPRESSWAY','AVAYA_MEDIA_GATEWAY','AVAYA_SESSION_MANAGER','AVAYA_VOICE_PORTAL','ZOOM','ENDPOINT_CLIENT','WEB_RTC_AIR_PHONE','WEB_RTC_AMAZON_CONNECT','WEB_RTC_CISCO_WEBEX','WEB_RTC_FIVE9','WEB_RTC_GENESYS_CLOUD','WEB_RTC_GENESYS_MCPE','WEB_RTC_NICE_CXONE','DIAGNOSTICS','GENESYS','JABRA','MISCELLANEOUS', IgnoreCase=$False)] [string]$Platform, [Parameter(Mandatory=$False)] [ValidateSet('LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','TODAY','YESTERDAY','WEEK_TO_NOW','MONTH_TO_NOW','CUSTOM', IgnoreCase=$False)] [string]$TimePeriod = 'LAST_HOUR', [Parameter(Mandatory=$False)] [Alias("StartDateFrom")] [DateTime]$TimePeriodFrom, [Parameter(Mandatory=$False)] [Alias("StartDateTo")] [DateTime]$TimePeriodTo, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName, [Parameter(Mandatory=$False)] [ValidateRange(1,100000)] [int]$PageSize = 1000, [Parameter(Mandatory=$False)] [ValidateRange(1,9999999)] [int]$ResultSize ) Begin { Connect-NectarCloud } Process { $Params = @{ 'TimePeriod' = $TimePeriod 'Platform' = $Platform 'type' = $Type } # Convert date to UNIX timestamp If($TimePeriodFrom) { $TimePeriodFrom = (Get-Date -Date $TimePeriodFrom -UFormat %s) + '000' $Params.Add('StartDateFrom',$TimePeriodFrom) } If($TimePeriodTo) { $TimePeriodTo = (Get-Date -Date $TimePeriodTo -UFormat %s) + '000' $Params.Add('StartDateTo',$TimePeriodTo) } Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } If ($TenantName) { $Params.Add('Tenant',$TenantName) } $URI = "https://$Global:NectarCloud/dapi/platform/cluster/$ClusterID/server/$ServerID/services" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader -Body $Params If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} $JSON } Catch { Write-Error "Could not get platform item server services. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformDashboard { <# .SYNOPSIS Return information about all custom Platform dashboards .DESCRIPTION Return information about all custom Platform dashboards .PARAMETER DashboardName The name of a dashboard to return data on .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .EXAMPLE Get-NectarPlatformDashboards .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$DashboardName, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName ) Begin { Connect-NectarCloud } Process { Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } $URI = "https://$Global:NectarCloud/aapi/client/dashboards?tenant=$TenantName" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} If ($DashboardName) { Return $JSON | Where-Object {$_.name -eq $DashboardName} } Else { Return $JSON } } Catch { Write-Error "Could not get platform dashboards. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformDashboardItems { <# .SYNOPSIS Return information about all platform dashboard items .DESCRIPTION Return information about all platform dashboard items .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .EXAMPLE Get-NectarPlatformDashboardItems .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName ) Begin { Connect-NectarCloud } Process { Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } $URI = "https://$Global:NectarCloud/dapi/platform/dashboard/items?tenant=$TenantName" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} Return $JSON } Catch { Write-Error "Could not get platform items. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformDashboardItemPollerSummary { <# .SYNOPSIS Return current poller information about a given device/item .DESCRIPTION Return current poller information about a given device/item .PARAMETER ItemID The ID of the item to return poller information about .PARAMETER PollerGroup The poller group to return poller information on. Choose from Application, Server or Network .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .EXAMPLE Get-NectarPlatformDashboardItemPollerSummary -ItemID 320_51 .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [Alias('ID')] [string]$ItemID, [Parameter(Mandatory=$True)] [ValidateSet('Application','Server','Network', IgnoreCase=$True)] [string]$PollerGroup, [Parameter(ValueFromPipelineByPropertyName, DontShow)] [Alias('Name')] [string]$ItemName, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName ) Begin { Connect-NectarCloud } Process { Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } $URI = "https://$Global:NectarCloud/dapi/platform/dashboard/item/$ItemID/summary?tenant=$TenantName&group=$($PollerGroup.ToUpper())" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader # If the command is called as part of a pipeline from Get-NectarPlatformDashboard then add the device name to the output If ($ItemName) {$JSON | Add-Member -Name 'ItemName' -Value $ItemName -MemberType NoteProperty} # Add the Item ID and PollerGroup to the output $JSON | Add-Member -Name 'ItemID' -Value $ItemID -MemberType NoteProperty $JSON | Add-Member -Name 'PollerGroup' -Value $PollerGroup -MemberType NoteProperty If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} Return $JSON } Catch { Write-Error "Could not get platform dashboards. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarPlatformDashboardItemPollerDetail { <# .SYNOPSIS Return specific poller information over time about a given device/item .DESCRIPTION Return specific poller information over time about a given device/item .PARAMETER ItemID The ID of the item to return poller information about .PARAMETER Index The numeric index of the poller to return information on .PARAMETER Type The metric type assigned to the poller .PARAMETER PollerGroup The poller group to return poller information on. Choose from Application, Server or Network .PARAMETER ExpandHistogram Show a detailed table with the contents of the histogram output instead of a difficult to parse array .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .EXAMPLE Get-NectarPlatformDashboardItemPollerDetail -ItemID 320_51 .NOTES Version 1.0 #> Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [string]$ItemID, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [string]$Index, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [string]$Type, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$True)] [ValidateSet('Application','Server','Network', IgnoreCase=$True)] [string]$PollerGroup, [Parameter(Mandatory=$False)] [ValidateSet('LAST_HOUR','LAST_DAY','LAST_WEEK','LAST_MONTH','TODAY','YESTERDAY','WEEK_TO_NOW','MONTH_TO_NOW','CUSTOM', IgnoreCase=$False)] [string]$TimePeriod = 'LAST_DAY', [Parameter(Mandatory=$False)] [Alias("StartDateFrom")] [DateTime]$TimePeriodFrom, [Parameter(Mandatory=$False)] [Alias("StartDateTo")] [DateTime]$TimePeriodTo, [Parameter(Mandatory=$False)] [switch]$ExpandHistogram, [Parameter(ValueFromPipelineByPropertyName, DontShow)] [string]$ItemName, [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName ) Begin { Connect-NectarCloud } Process { Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } $Params = @{} # Convert date to UNIX timestamp If($TimePeriodFrom) { $TimePeriodFromUNIX = (Get-Date -Date $TimePeriodFrom -UFormat %s) + '000' $Params.Add('StartDateFrom',$TimePeriodFromUNIX) } If($TimePeriodTo) { $TimePeriodToUNIX = (Get-Date -Date $TimePeriodTo -UFormat %s) + '000' $Params.Add('StartDateTo',$TimePeriodToUNIX) } $URI = "https://$Global:NectarCloud/dapi/platform/dashboard/item/$ItemID/metric?type=$Type&group=$($PollerGroup.ToUpper())&timePeriod=$TimePeriod&index=$Index&tenant=$TenantName" Write-Verbose $URI $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader -Body $Params If ($ItemName) {$JSON | Add-Member -Name 'ItemName' -Value $ItemName -MemberType NoteProperty} If ($TenantName) {$JSON | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty} If ($ExpandHistogram) { $Histogram = $JSON.histogram $HistoFormatted = @() ForEach ($Element in $Histogram) { $RowData = New-Object PsObject $RowData | Add-Member -NotePropertyName 'Date' -NotePropertyValue $Element[0] $RowData | Add-Member -NotePropertyName 'Item' -NotePropertyValue $ItemName $RowData | Add-Member -NotePropertyName 'Poller' -NotePropertyValue $JSON.Name $RowData | Add-Member -NotePropertyName 'Value' -NotePropertyValue $Element[1] $HistoFormatted += $RowData } Return $HistoFormatted } Else { Return $JSON } } Catch { Write-Error "Could not get item poller detail. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } Function Get-NectarServers { <# .SYNOPSIS Returns a list of platform servers .DESCRIPTION Returns a list of platform servers like datacenter names (TEAMS), servernames (CISCO etc) .PARAMETER TenantName The name of the Nectar DXP tenant. Used in multi-tenant configurations. .EXAMPLE Get-NectarServers .NOTES Version 1.0 #> [Alias("gns")] Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory=$False)] [string]$TenantName ) Begin { Connect-NectarCloud } Process { Try { # Use globally set tenant name, if one was set and not explicitly included in the command If ($Global:NectarTenantName -And !$PSBoundParameters.ContainsKey('TenantName')) { $TenantName = $Global:NectarTenantName } ElseIf ($TenantName) { If ($TenantName -NotIn $Global:NectarTenantList) { $TList = $Global:NectarTenantList -join ', ' Throw "Could not find a tenant with the name $TenantName on https://$Global:NectarCloud. Select one of $TList. $($_.Exception.Message)" } } $URI = "https://$Global:NectarCloud/dapi/info/platform/servers?tenant=$TenantName" $JSON = Invoke-RestMethod -Method GET -URI $URI -Headers $Global:NectarAuthHeader If (!$JSON.elements) { Write-Error "Server list could not be found." } Else { If ($TenantName) { $JSON.elements | Add-Member -Name 'TenantName' -Value $TenantName -MemberType NoteProperty } # Add the tenant name to the output which helps pipelining $JSON.elements | Add-Member -TypeName 'Nectar.LocationList' Return $JSON.elements } } Catch { Write-Error "Unable to get server details. $($_.Exception.Message)" If ($PSCmdlet.MyInvocation.BoundParameters["ErrorAction"] -ne "SilentlyContinue") { Get-JSONErrorStream -JSONResponse $_ } } } } |