Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION

Qlikview Services States

cancel
Showing results for 
Search instead for 
Did you mean: 
YoussefBelloum
Champion
Champion

Qlikview Services States

Last Update:

Sep 21, 2022 1:07:35 PM

Updated By:

Sue_Macaluso

Created date:

Mar 6, 2019 11:28:47 AM

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

 

Tags (1)
Comments
marcus_sommer

Great job!

YoussefBelloum
Champion
Champion

Thank you @marcus_sommer  🙂

khalander
Creator II
Creator II

Hi,

I am getting error. can we run this file through remote desktop?

Regards,

Khalander

YoussefBelloum
Champion
Champion

@khalander 

Try to give more details about the error.

With remote desktop, you're connected on the machine on which you need to run the script,  so it will work.

the code above need some changes espcially on the the variable $servers and all the -Paths

Also, you'll need to verify that all the services listed on the script above are present and launched on your windows server..

Regards,

Youssef

khalander
Creator II
Creator II

Hi Youssef,

 

Thanks for the reply.

I am getting below error.

Export- Csv : Cannot append CSV content to the following file c...Exposrt.csv

Thanks,

Khalander

YoussefBelloum
Champion
Champion

@khalander 

I forgot to tell you that you also need to change your -Path:

$results | Export-Csv -path C:\Temp\Powershell\Eventlogs.csv -NoTypeInformation -Append

Make sure to create your own Path on a disk on which you have write access

khalander
Creator II
Creator II

Yes Youssef,

 

I did the same thing but getting same error. I have changed the path which i have access.

khalander
Creator II
Creator II

Thanks Youssef, It is working now 🙂

It is really Great script.

YoussefBelloum
Champion
Champion

@khalander  I'm pleased that it is useful for community members  😀

Good luck !

Version history
Last update:
‎2022-09-21 01:07 PM
Updated by: