Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Hello!
I want to monitor The Active IQ (9.13) itself, that if u suer can't access the application we get alert.
How can I do this?
And what are the services important in the application (ociea, ocie, mysqld, somthing else?)
Solved! See The Solution
Hi Shai,
You can query the AIQUM service status using the REST API. Here's an example:
Param(
[Parameter(Mandatory = $True, HelpMessage = "The AIQUM server Hostname, FQDN or IP Address")]
[String]$Server,
[Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to AIQUM")]
[System.Management.Automation.PSCredential]$Credential
)
#'------------------------------------------------------------------------------
Function Get-UMAuthorization{
[Alias("Get-UMAuth")]
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to AIQUM")]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]$Credential
)
#'---------------------------------------------------------------------------
#'Set the authentication header to connect to AIQUM.
#'---------------------------------------------------------------------------
$auth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
$headers = @{
"Authorization" = "Basic $auth"
"Accept" = "application/json"
"Content-Type" = "application/json"
}
Return $headers;
}#'End Function Get-UMAuthorization
#'------------------------------------------------------------------------------
Function Get-UMSystemInfo{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, HelpMessage = "The AIQUM server Hostname, FQDN or IP Address")]
[ValidateNotNullOrEmpty()]
[String]$Server,
[Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to AIQUM")]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]$Credential
)
#'---------------------------------------------------------------------------
#'Set the authentication header to connect to AIQUM.
#'---------------------------------------------------------------------------
$headers = Get-UMAuthorization -Credential $Credential
#'---------------------------------------------------------------------------
#'Enumerate the system information.
#'---------------------------------------------------------------------------
[String]$uri = "https://$Server/api/management-server/system"
Try{
$response = Invoke-RestMethod -Uri $uri -Method GET -Headers $headers -ErrorAction Stop
Write-Host "Enumerated system information on server ""$Server"" using URI ""$uri"""
}Catch{
Write-Warning -Message $("Failed enumerating system on Server ""$Server"" using URI ""$uri"". Error " + $_.Exception.Message + ". Status Code " + $_.Exception.Response.StatusCode.value__)
}
Return $response;
}#'End Function Get-UMSystemInfo.
#'------------------------------------------------------------------------------
#'Set the certificate policy and TLS version.
#'------------------------------------------------------------------------------
If(-Not("TrustAllCertsPolicy" -As [Type])){
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#'------------------------------------------------------------------------------
#'Enumerate the AIQUM System Information.
#'------------------------------------------------------------------------------
[Int]$errorCount = 0
Try{
$system = Get-UMSystemInfo -Server $Server -Credential $Credential -ErrorAction Stop
}Catch{
Write-Warning -Message $("Failed Enumerating System Information for Server ""$Server"". Error " + $_.Exception.Message)
Exit -1
}
If($Null -eq $system){
Write-Warning -Message "Failed Enumerating System Information for Server ""$Server"""
Exit -1
}
#'------------------------------------------------------------------------------
#'Check the Service Status.
#'------------------------------------------------------------------------------
Write-Host $("The Server ""$Server"" is running " + $system.Product + " " + $system.Version)
ForEach($service In $system.Services){
If($service.Status -ne "running"){
Write-Warning -Message $("The Service """ + $service.Name + """ is """ + $service.Status + """")
[Int]$errorCount++
}Else{
Write-Host $("The Service """ + $service.Name + """ is """ + $service.Status + """")
}
}
If($errorCount -ne 0){
Write-Warning -Message "There are $errorCount Services that are unavailable on Server ""$Server"""
}Else{
Write-Host "All Services are available on Server ""$Server"""
}
#'------------------------------------------------------------------------------
Usage:
PS C:\Scripts\PowerShell\Projects\AIQUM> .\GetSystemInfo.ps1 -Server aiqum.testlab.local -Credential $credentials
Enumerated system information on server "aiqum.testlab.local" using URI "https://aiqum.testlab.local/api/management-server/system"
The Server "aiqum.testlab.local" is running Active IQ Unified Manager 9.13P1
The Service "ocie" is "running"
The Service "ocie_au" is "running"
All Services are available on Server "aiqum.testlab.local"
Hope that helps
/Matt
Hi Shai,
You can query the AIQUM service status using the REST API. Here's an example:
Param(
[Parameter(Mandatory = $True, HelpMessage = "The AIQUM server Hostname, FQDN or IP Address")]
[String]$Server,
[Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to AIQUM")]
[System.Management.Automation.PSCredential]$Credential
)
#'------------------------------------------------------------------------------
Function Get-UMAuthorization{
[Alias("Get-UMAuth")]
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to AIQUM")]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]$Credential
)
#'---------------------------------------------------------------------------
#'Set the authentication header to connect to AIQUM.
#'---------------------------------------------------------------------------
$auth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
$headers = @{
"Authorization" = "Basic $auth"
"Accept" = "application/json"
"Content-Type" = "application/json"
}
Return $headers;
}#'End Function Get-UMAuthorization
#'------------------------------------------------------------------------------
Function Get-UMSystemInfo{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, HelpMessage = "The AIQUM server Hostname, FQDN or IP Address")]
[ValidateNotNullOrEmpty()]
[String]$Server,
[Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to AIQUM")]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]$Credential
)
#'---------------------------------------------------------------------------
#'Set the authentication header to connect to AIQUM.
#'---------------------------------------------------------------------------
$headers = Get-UMAuthorization -Credential $Credential
#'---------------------------------------------------------------------------
#'Enumerate the system information.
#'---------------------------------------------------------------------------
[String]$uri = "https://$Server/api/management-server/system"
Try{
$response = Invoke-RestMethod -Uri $uri -Method GET -Headers $headers -ErrorAction Stop
Write-Host "Enumerated system information on server ""$Server"" using URI ""$uri"""
}Catch{
Write-Warning -Message $("Failed enumerating system on Server ""$Server"" using URI ""$uri"". Error " + $_.Exception.Message + ". Status Code " + $_.Exception.Response.StatusCode.value__)
}
Return $response;
}#'End Function Get-UMSystemInfo.
#'------------------------------------------------------------------------------
#'Set the certificate policy and TLS version.
#'------------------------------------------------------------------------------
If(-Not("TrustAllCertsPolicy" -As [Type])){
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#'------------------------------------------------------------------------------
#'Enumerate the AIQUM System Information.
#'------------------------------------------------------------------------------
[Int]$errorCount = 0
Try{
$system = Get-UMSystemInfo -Server $Server -Credential $Credential -ErrorAction Stop
}Catch{
Write-Warning -Message $("Failed Enumerating System Information for Server ""$Server"". Error " + $_.Exception.Message)
Exit -1
}
If($Null -eq $system){
Write-Warning -Message "Failed Enumerating System Information for Server ""$Server"""
Exit -1
}
#'------------------------------------------------------------------------------
#'Check the Service Status.
#'------------------------------------------------------------------------------
Write-Host $("The Server ""$Server"" is running " + $system.Product + " " + $system.Version)
ForEach($service In $system.Services){
If($service.Status -ne "running"){
Write-Warning -Message $("The Service """ + $service.Name + """ is """ + $service.Status + """")
[Int]$errorCount++
}Else{
Write-Host $("The Service """ + $service.Name + """ is """ + $service.Status + """")
}
}
If($errorCount -ne 0){
Write-Warning -Message "There are $errorCount Services that are unavailable on Server ""$Server"""
}Else{
Write-Host "All Services are available on Server ""$Server"""
}
#'------------------------------------------------------------------------------
Usage:
PS C:\Scripts\PowerShell\Projects\AIQUM> .\GetSystemInfo.ps1 -Server aiqum.testlab.local -Credential $credentials
Enumerated system information on server "aiqum.testlab.local" using URI "https://aiqum.testlab.local/api/management-server/system"
The Server "aiqum.testlab.local" is running Active IQ Unified Manager 9.13P1
The Service "ocie" is "running"
The Service "ocie_au" is "running"
All Services are available on Server "aiqum.testlab.local"
Hope that helps
/Matt