Sigyn alerting agent
- Node.js version 18 or higher
This package is available in the Node Package Repository and can be easily installed with npm or yarn
$ npm i @sigyn/agent
# or
$ yarn add @sigyn/agent
$ touch .env
Add these variables:
# Required
GRAFANA_API_TOKEN=your_token
# Default to sigyn.sqlite3
SIGYN_DB=your_db
$ touch sigyn.config.json
Please see here for config documentation
import { start } from "@sigyn/agent";
await start();
Run Sigyn agent. It will fetch logs depending your rules polling
and send alerts when count
threshold is reached.
-
location: string
Optional, default toprocess.cwd()
. The path to your SQLite database, it will create the file if it doesn't exists but the directory must exists. -
options.logger: Logger
Optional, default topino
. You can use your own logger which must be an object with theses 3 methods:debug
,info
&error
. -
options.level
Optional, only works if no logger given. Set log level:"info" | "debug" | "error"
. -
options.timeout
Optional, you can provide a timeout for Grafana API requests. Default:30_000
.
The returned scheduler instance allow you to put some extra logic if needed, see API for scheduler.
interface Logger {
info: (message: string) => void;
error: (message: string) => void;
debug: (message: string) => void;
}
interface StartOptions {
logger?: Logger;
level?: "info" | "debug" | "error";
timeout?: number;
}
MIT