Skip to content

SlimIO/Agent

Repository files navigation

Agent

version Maintenance mit dep size known vulnerabilities Build Status

An agent is the result of the addition of a Core and several Addons called "built in". The presence of these addons is often mandatory (Each of them have a key role like managing the local database, managing alerting, metrics etc..). These behaviors are more described in the SlimIO specification if you are interested.

Main components of Agent:

  • SlimIO Core (The most important component which load addons and handle communications between them).
  • SlimIO Arg-Parser (The package we use to parse process.argv).

👀 Dont hesitate to follow these links to dig deeper.

Requirements

Getting Started

To create a new agent, follow these steps (commands):

$ git clone https://github.com/SlimIO/Agent.git
$ cd Agent
$ npm ci

💡 for a production installation, just run npm install --production

And then, run the agent with

$ npm start
# or without npm (just with the node.exe binary)
$ node index.js

It will generate all required files and directories.

👀 By default Agent run with verbose activated, use the command npm run silent to run without verbose mode.

Files and directories

This section describe all important files and directories.

name description
📄 agent.(json/toml) local agent configuration. This file is not required to start an agent, it will be dynamically filled the first time!
📁 addons where addons are (and must be) installed.
📁 debug where core dump files are generated (when a critical error occur)

These files and directories are automatically created and managed when they dont exist. So do not bother yourself with that kind of stuff...

👀 agent.json is described by the following JSON Schema.

Manually install an addon

To install a addon (Events for example), follow these steps:

$ cd addons
$ git clone https://github.com/SlimIO/Events.git events # <-- rename to events here!
$ cd events
$ npm install --production # dont forgot to install the Node.js dependencies of that addon...

Get back at the root of the project and edit the agent configuration to add your addon. If there is no configuration yet, think to create the root structure with the addons key.

{
    "addons": {
        "events": { // <-- add your addon
            "active": true,
            "standalone": false
        }
    }
}

or with TOML syntax

[addons.events]
active = true

Then, (re)start the agent and events addon will be loaded ! (Note: the SlimIO CLI have a reload option under configuration command).

Agent configuration

Agent.json (or .toml) contains a list of addons with their settings (These are not mean to be used for the addon itself). All parameters will allow the core to known how you want the addon to behave:

  • standalone (will it have a dedicated process or not?)
  • active (will it be started or not ?).

These settings will influence the way to communicate with it inside the core too. Under the hood the core use the @slimio/config package to load and interact with the configuration (this is why both JSON and TOML are supported formats).

CLI Options

  • all commands start with the prefix --
  • all shorcut start with the prefix -
$ node index --silent -a 1000
name shorcut Default description
silent none false Enable silent mode
autoreload -a 500 Configuration Autoreload delay

Dependencies

Name Refactoring Security Risk Usage
@slimio/arg-parser Minor Low The package we use to parse our script argument (process.argv)
@slimio/core ⚠️Major Low SlimIO Core

License

MIT

Releases

No releases published

Packages

No packages published