1.0.13 • Published 1 year ago

@daemonitor/client v1.0.13

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Daemonitor Client

This is the client for Daemonitor. It can be used to monitor your devices and send events to the Daemonitor server.

Run with PM2:

Clone the repository and install dependencies:

git clone https://github.com/daemonitor/client.git
cd client 
pnpm install

Setup your client.config.json and .env files:

cp client.config.json.example client.config.json
cp .env.example .env

Start the client with PM2:

pm2 start npm --name daemonitor-client -- run start

Install as a service using systemd

Note: you will not be able to use the PM2 monitoring plugin if you install as a service.

Setup your configuration file at /etc/daemonitor/client.config.json

sudo cp client.config.json.example /etc/daemonitor/client.config.json
sudo cp .env.example /etc/daemonitor/.env

Install the package globally:

sudo npm install -g @daemonitor/client

You should now be able to run the client from the command line:

daemonitor-client

Install the service:

sudo cp daemonitor-client.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable daemonitor-client
sudo systemctl start daemonitor-client

Configuration

The client can be configured using the client.config.json file. The following options are available:

OptionDescriptionOptions
connectorsAn array of connectors to load.["rest-api", "console"]
pluginsAn array of plugins to load.["os", "pm2", "ewelink", "web"]
plugin aliasAn object of options for the plugin.See plugin documentation.

Plugins

OS

The OS plugin provides information about the operating system.

PM2

The PM2 plugin provides information about PM2 processes.

OptionDescriptionDefault
processesAn array of process names to monitor.[]

Web

The Web plugin provides information about web services.

OptionDescriptionDefault
endpointsAn array of endpoints to monitor.[]

Endpoints can be configured with the following options:

OptionDescriptionDefault
nameThe name of the endpoint.
urlThe URL of the endpoint.
methodThe HTTP method to use.GET
headersAn object of headers to send.{}
bodyThe body to send.
intervalThe interval to poll the endpoint.60000
timeoutThe timeout for the request.5000
expectedStringsAn array of strings that should be present in the response.[]
expectedStatusCodeThe expected status code.200
unexpectedStringsAn array of strings that should not be present in the response.[]
unexpectedStatusCodeThe unexpected status code.200
expectedResponseTimeThe expected response time.1000
unexpectedResponseTimeThe unexpected response time.1000
expectedResponseSizeThe expected response size.0
unexpectedResponseSizeThe unexpected response size.0

EWeLink

The EWeLink plugin provides information about EWeLink devices.

OptionDescriptionDefault
emailEWeLink email address.
passwordEWeLink password.
regionEWeLink region.us
devicesAn array of device IDs to monitor.[]

Connectors

Console

The Console connector logs events to the console.

OptionDescriptionDefault
levelThe minimum log level to log.info

REST API

The REST API connector sends events to a REST API.

OptionDescriptionDefault
urlThe URL of the REST API.
tokenThe token to use for authentication.
levelThe minimum log level to log.info
intervalThe interval to send events.10000
timeoutThe timeout for the request.5000
maxRetriesThe maximum number of retries.3
retryDelayThe delay between retries.1000
retryBackoffThe backoff factor for retries.2
retryJitterThe jitter factor for retries.0
1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago