Git Product home page Git Product logo

rport-win-watchdog's Introduction

๐Ÿถ A watchdog for the rport service on Windows

โœ‹ Use only if really needed! The rport client is robust and always re-establishes the connection to the rport server. The watchdog should only be used in rare cases when have experienced lost connections. Do not use as a generic preventive measure.

A watchdog that supervises the rport service and restarts it when needed. The watchdog script is intended to be run every five minutes as a scheduled task.

If you have the rport watchdog integration enabled, this scripts checks the internal state of the rport client by reading the state.json file.

If the rport client has not actively confirmed its successful connection to the rport server, the timestamp inside the json file will become obsolete. The scripts will compare this timestamp with the current time and restart the rport service if the given threshold is exceeded.

Installation & Usage

From a PowerShell with administrative rights

If you haven't activated the watchdog integration, do so:

Set-Location "C:\Program Files\rport"
(Get-Content -path rport.conf -Raw) -replace '#watchdog_integration = false','watchdog_integration = true'|`
 Set-Content -Path rport.conf
restart-service rport
Get-Content  .\data\state.json

Download the watchdog script, test and install.

cd "C:\Program Files\rport"
iwr https://github.com/cloudradar-monitoring/rport-win-watchdog/releases/latest/download/watchdog.ps1 `
-OutFile watchdog.ps1

Test, if the state file can be read:

PS> .\watchdog.ps1 -Threshold 90
09/15/2022 19:44:15: RPort is running fine. Last activity 27.7940099239349 seconds ago (< 90).

Before registering the scheduled task, read about what's your best threshold.

Register the script as a scheduled task:

PS>  .\watchdog.ps1 -Threshold 300 -Register
Registering scheduled task ...
Task "RPort-Watchdog" ["C:\Program Files\rport\watchdog.ps1"] scheduled every 5 minutes.

More options

Unregister aka stop the watchdog:

.\watchdog.ps1 -Unregister

Check, if it's working:

PS> .\watchdog.ps1 -State
Task RPort-Watchdog is registered with state: Ready


LastRunTime        : 9/15/2022 7:54:54 PM
LastTaskResult     : 0
NextRunTime        : 9/15/2022 7:59:59 PM
NumberOfMissedRuns : 0
TaskName           : RPort-Watchdog
TaskPath           :
PSComputerName     :

Get the full help message:

Get-Help .\watchdog.ps1 -Full

rport-win-watchdog's People

Contributors

thorstenkramm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.