ForNeVeR / nightwatch

Stays alert while you sleep.
MIT License
6 stars 0 forks source link
cross-platform devops monitoring

Nightwatch Build (Travis) Build (Appveyor) Status Umbra

Nightwatch is a monitoring service intedned to monitor daily and nightly activities and notify the administrator if something wrong happens.

Build

.NET Core 2.1 SDK is required to build the project.

$ dotnet build

If you need a standalone executable (useful for service deployment), then add the following options:

$ cd Nightwatch
$ dotnet build --configuration Release --runtime win-x64 --output out

Configure

Nightwatch could be configured by placing the nightwatch.yml file in the current directory. You may also override the configuration file path by using the command-line arguments, see the Run section of this document.

nightwatch.yml has the following form:

resource-directory: "some/path"

Nightwatch searches the resource directory for the configuration files. At start, it will recursively read all the *.yml files in the resource directory, and set them up as periodic tasks. Each configuration file describes a Resource.

Currently supported resources are documented below.

Shell Resource

version: 0.0.1.0 # should always be 0.0.1.0 for the current version
id: test # task identifier
schedule: 00:05:00 # run every 5 minutes
type: shell
param:
    cmd: ping localhost # check command

HTTP Resource

version: 0.0.1.0 # should always be 0.0.1.0 for the current version
id: test # task identifier
schedule: 00:05:00 # run every 5 minutes
type: shell
param:
    url: http://localhost:8080/ # URL to visit
    ok-codes: 200, 304 # the list of the codes considered as a success

Run

In developer mode:

$ dotnet run --project Nightwatch

To stop the program, press Ctrl-C.

Add --config ./some/path.yml option to set the configuration file path (nightwatch.yml in the current directory is the default).

Add --service to run in a Windows service mode.

To install the service on Windows, execute the following commands in your shell:

$ sc.exe Nightwatch binpath= "D:\Path\To\Nightwatch.exe --config D:\Path\To\nightwatch.yml --service" start= auto
$ sc.exe start Nightwatch

(note the space and quote placement, that's important)

Test

$ dotnet test Nightwatch.Tests

Contributor documentation