Qlik Community

QlikView Documents

Documents for QlikView related information.

Qlikview Services States

YoussefBelloum
Esteemed Contributor

Qlikview Services States

Hi Everyone,

Here you will find a solution to a problem that I have tried to solve this week, and that could be useful in every Qlik infrastructure.

For anyone who has tried to get a global view of the Qlik services states, here is the solution I found.

@marcus_sommer I thought this might interest you

1.

  • Create a Powershell script (.Ps1) that loop on a list of servers that you define.
  • Get the state of every Qlik service.
  • Verify if that state if Running or not.
  • Prepare the csv file structure (Date, Server, Service, State) and export it.

       * with "append" option to be able to schedule the script to run at a certain frequency on a day and don't lose the lines created each time.

2.

  • Create a .BAT file that calls Powershell.exe to launch the (Ps1) file.
  • Schedule it using the Windows Task scheduler or the QMC.

Below the Powershell Script:

#Define a list of servers
$servers = @("xxx-xxx-xxx","xxx-xxx-xxx","xxx-xxx-xxx"...)

#Loop on the servers defined above
foreach ($server in $servers) {

    #Get the actual date
    $getDate = Get-Date

    #Get the state of all Qlik services
    $statusQlikviewDirectoryServiceConnector = (get-service "QlikviewDirectoryServiceConnector" -ComputerName $server).Status
    $statusQlikViewDistributionService       = (get-service "QlikViewDistributionService"       -ComputerName $server).Status
    $statusQlikviewManagementService         = (get-service "QlikviewManagementService"         -ComputerName $server).Status
    $statusQlikviewServer                    = (get-service "QlikviewServer"                    -ComputerName $server).Status
    $statusQlikViewSettingsService           = (get-service "QlikViewSettingsService"           -ComputerName $server).Status

    #Verify if the QlikviewDirectoryServiceConnector is Running
    if ($statusQlikviewDirectoryServiceConnector -eq "Running") {

        "$getDate $servers  QlikviewDirectoryServiceConnector is up"

        $vExportQlikviewDirectoryServiceConnector = @{
        Date=$getDate
        Server=$servers
        Service='QlikviewDirectoryServiceConnector'
        Status=$statusQlikviewDirectoryServiceConnector
         }
        $results = New-Object psobject -Property $vExportQlikviewDirectoryServiceConnector
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    } 
    
    else {

        "$getDate $servers QlikviewDirectoryServiceConnector is down"

        $vExportQlikviewDirectoryServiceConnector = @{
        Date=$getDate
        Server=$servers
        Service='QlikviewDirectoryServiceConnector'
        Status=$statusQlikviewDirectoryServiceConnector
         }
        $results = New-Object psobject -Property $vExportQlikviewDirectoryServiceConnector
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    }


    #Verify if the Service QlikViewDistributionService is Running
    if ($statusQlikViewDistributionService -eq "Running") {

        "$getDate $servers QlikViewDistributionService is up"

        $vExportQlikViewDistributionService = @{
        Date=$getDate
        Server=$servers
        Service='QlikViewDistributionService'
        Status=$statusQlikViewDistributionService
         }
        $results = New-Object psobject -Property $vExportQlikViewDistributionService
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    } 
    
    else {

        "$getDate $servers QlikViewDistributionService is down"

        $vExportQlikViewDistributionService = @{
        Date=$getDate
        Server=$servers
        Service='QlikViewDistributionService'
        Status=$statusQlikViewDistributionService
         }
        $results = New-Object psobject -Property $vExportQlikViewDistributionService
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    }


    #Verify if the service QlikviewManagementService is running
    if ($statusQlikviewManagementService -eq "Running") {

        "$getDate $servers QlikviewManagementService is up"

        $vExportQlikviewManagementService = @{
        Date=$getDate
        Server=$servers
        Service='QlikviewManagementService'
        Status=$statusQlikviewManagementService
         }
        $results = New-Object psobject -Property $vExportQlikviewManagementService
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    } 
    
    else {

        "$getDate $servers QlikviewManagementService is down"

        $vExportQlikviewManagementService = @{
        Date=$getDate
        Server=$servers
        Service='QlikviewManagementService'
        Status=$statusQlikviewManagementService
         }
        $results = New-Object psobject -Property $vExportQlikviewManagementService
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    }


    #Verify if the service QlikviewServer is Running
    if ($statusQlikviewServer -eq "Running") {

        "$getDate $servers QlikviewServer is up"

        $vExportQlikviewServer = @{
        Date=$getDate
        Server=$servers
        Service='QlikviewServer'
        Status=$statusQlikviewServer
         }
        $results = New-Object psobject -Property $vExportQlikviewServer
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    } 
    
    else {

        "$getDate $servers QlikviewServer is down"

        $vExportQlikviewServer = @{
        Date=$getDate
        Server=$servers
        Service='QlikviewServer'
        Status=$statusQlikviewServer
         }
        $results = New-Object psobject -Property $vExportQlikviewServer
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    }


    #Verify if the service QlikViewSettingsService is running
    if ($statusQlikViewSettingsService -eq "Running") {

        "$getDate $servers QlikViewSettingsService is up"

        $vExportQlikViewSettingsService = @{
        Date=$getDate
        Server=$servers
        Service='QlikViewSettingsService'
        Status=$statusQlikViewSettingsService
         }
        $results = New-Object psobject -Property $vExportQlikViewSettingsService
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    } 
    
    else {

        "$getDate $servers QlikViewSettingsService is down"

        $vExportQlikViewSettingsService = @{
        Date=$getDate
        Server=$servers
        Service='QlikViewSettingsService'
        Status=$statusQlikViewSettingsService
         }
        $results = New-Object psobject -Property $vExportQlikViewSettingsService
        $results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

    }

}

Here is the output of the file export using the script above:

"Date","Status","Server","Service"
"06/03/2019 17:22:34","Running","vw-d-rxx-05","QlikviewDirectoryServiceConnector"
"06/03/2019 17:22:34","Running","vw-d-rxx-05","QlikViewDistributionService"
"06/03/2019 17:22:34","Running","vw-d-rxx-05","QlikviewManagementService"
"06/03/2019 17:22:34","Running","vw-d-rxx-05","QlikviewServer"
"06/03/2019 17:22:34","Running","vw-d-rxx-05","QlikViewSettingsService"

If you need more details on how you run all this and get the schedueling done, don't hesitate to leave a comment or send me a direct message.

Have a great day !

Youssef

 

Comments
MVP & Luminary
MVP & Luminary

Great job!

0 Likes
YoussefBelloum
Esteemed Contributor

Thank you @marcus_sommer  🙂

0 Likes
Version history
Revision #:
5 of 5
Last update:
‎04-12-2019 07:14 AM
Updated by:
 
Contributors