You can translate the document:

Goal

This document describes how to create a Windows PowerShell script that can be used to alert if a Denodo Virtual DataPort (VDP) server is stopped and to attempt to start it again. The script will also store the historical status of the VDP server to a log file.

Keep in mind that this article applies to Denodo servers started as Windows services. If you start your server as a Process, refer to the Automating status check and startup of Denodo processes article.

Content

Sample script

The following script will check the status of the Virtual DataPort service and will try to restart it if stopped. A similar script can be used to check the status of any Denodo service.

####################################################

#                                                  #

#      Virtual DataPort service status notifier    #

#                                                  #

####################################################

#-------------------Configuration------------------

Param(

     [string]$vdpServiceName,

     [string]$denodoHome,

     [string]$logFilePath

)

#-------------------------------------------------

function taskbarNotification($status){

        [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

        $objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon

        $objNotifyIcon.Icon = ($denodoHome + "\resources\Denodo\ico\denodo_platform.ico")

        $objNotifyIcon.BalloonTipText = ("VDP Server is " + $status)

        $objNotifyIcon.BalloonTipTitle = "Denodo Platform 9.0"

        $objNotifyIcon.Visible = $True

        $objNotifyIcon.ShowBalloonTip(10000)

}

function logStatus($status){

    $status = ((Get-Date).ToString() + " " +$status)

    Add-Content $logFilePath $status

}

if((Get-Service -Name $vdpServiceName).Status -eq "Stopped"){

    taskbarNotification("stopped")

    logStatus("VDP Server is stopped")

    Start-Service $vdpServiceName

    if((Get-Service -Name $vdpServiceName).Status -eq "Running"){

        taskbarNotification("running")

        logStatus("VDP Server is running")

        Exit

    }

    else{

        taskbarNotification("stopped. Unable to start the service.")

        logStatus("VDP Server is stopped. Unable to start the service.")

        Exit

    }

}

else{

    logStatus("VDP Server is running")

}

Running the script

1. Copy it to a text editor and save it to any location, for instance: C:\vdpService.ps1

2. Open a command prompt as an Administrator and execute the following:

powershell -ExecutionPolicy Bypass -File C:\vdpService.ps1 -vdpServiceName "vdpserver90" -denodoHome "C:\Denodo\DenodoPlatform9.0"  -logFilePath "C:\vdpService.log"

where:

  • powershell: The program to run.
  • -ExecutionPolicy Bypass: By default, unsigned PowerShell scripts are prevented from execution. This option allows bypassing this restriction.
  • -File: Path to the PowerShell script.
  • -vdpServiceName: The service name for the VDP Server. To get the name of the service go to Start > Run and run services.msc. Double click on the service name, for instance, for Denodo VDP 9.0 the service name will be "Denodo VQL Server 9.0". The name to be used in the script will be the value for "Service name" in the pop-up window under the “General” tab. In a default installation of Denodo Platform 9.0, this value will be vdpserver90.
  • -denodoHome: The path to the Denodo Platform installation. For instance “C:\Denodo\DenodoPlatform9.0”.
  • -logFilePath: The path where the log file will be saved. For instance “C:\vdpService.log”.

Automating the execution of the script

1. Open the Windows Task Scheduler (Control Panel > System and Security >  Administrative Tools > Task Scheduler).

2. Click on "Create Task..." in the right side pane.

3. Type in the name and description in the "General" tab and check "Run with highest privileges".

4. Use the "Trigger" tab to schedule when this task should run.

5. In the "Actions" tab, for the "Program/script" option, type the same command as for the manual execution:

powershell -ExecutionPolicy Bypass -File C:\vdpService.ps1 -vdpServiceName "vdpserver90" -denodoHome "C:\Denodo\DenodoPlatform9.0"  -logFilePath "C:\vdpService.log"

6. Save the task.

Note: Make sure to change the configuration in both Denodo Solution Manager and Denodo Platform.

Disclaimer
The information provided in the Denodo Knowledge Base is intended to assist our users in advanced uses of Denodo. Please note that the results from the application of processes and configurations detailed in these documents may vary depending on your specific environment. Use them at your own discretion.
For an official guide of supported features, please refer to the User Manuals. For questions on critical systems or complex environments we recommend you to contact your Denodo Customer Success Manager.

Questions

Ask a question

You must sign in to ask a question. If you do not have an account, you can register here