This repo contains the boxmetrics agent built with Go
Only needed when contributing or building from source
This project should be working as expected with the following minimal version of:
| Dependency | Version |
|---|---|
| Go | >= 1.12 |
The application must be launch with root or a sudoers, otherwise some features can be unavailable
- Run this command
docker run --rm -p 4455:4455 -p 5544:5544 286829485023.dkr.ecr.us-west-2.amazonaws.com/boxmetrics-agent:<TAG>-
Donwload a binary from Github release page
-
Run application
# Made application executable
sudo chmod +x boxmetrics-agent
# Start application
./boxmetrics-agent- Clone the git repository
# cloning git repository
git clone https://github.com/boxmetrics/boxmetrics-agent- Build application
# go to boxmetrics-agent directory
cd boxmetrics-agent
# run helper command to build
make build- Run application
# Made application executable
sudo chmod +x bin/boxmetrics-agent
# Start application
./bin/boxmetrics-agent start| Path | Description |
|---|---|
/ws/v1 |
Websocket root |
/ |
Test page |
Both request and response are JSON message
| Key | Type | Require | Default | Description |
|---|---|---|---|---|
| type | string | yes | NA | Request type |
| value | string | yes | NA | Type value |
| options | object | no | Default Options Object | Request options |
| format | boolean | no | true | Enable formating |
| Value | Description |
|---|---|
| info | Return value information type |
| script | Run value script |
| command | Execute value as command (Use options to add parameters) |
| Value | Response | Description |
|---|---|---|
| memory | Schema | Return memory information |
| cpu | Schema | Return cpu usage information |
| cpuinfo | Schema | Return cpu hardware information |
| disks | Schema | Return disks information |
| containers | Schema | Return containers full information |
| containersid | Array of string | Return containers ID list |
| host | Schema | Return host information |
| users | Schema | Return users list |
| sessions | Schema | Return user sessions list |
| network | Schema | Return network information |
| connections | Schema | Return opened connections list |
| processes | Schema | Return processes information list |
| process | Schema | Return process full information (options.pid must be set) |
| general | Schema | Return system wide informations |
| Value | Response | Description |
|---|---|---|
| adduser | string | Add user to the system (options.args must be set with corresponding value) |
| killprocess | string | Kill one process (options.pid must be set) |
| Key | Type | Require | Default | Description |
|---|---|---|---|---|
| args | Array | no | null | Array of arguments to pass to the command or to pass to adduser script eg. ["-p <pass>", "-u <username>", "-g group1"] (-g arg is optional and can be used multiple times) |
| env | Array | no | null | Array of environment variable to add before executing command eg. MY_VAR=abc |
| pwd | string | no | "" | Location where the command run, if empty string run in the cwd of the process |
| pid | number | no | 0 | PID use to retrieve information with process info type or to kill on script killprocess |
| Key | Type | Description |
|---|---|---|
| event | object | The event send |
| data | object | The data reponse of the event. Corresponding to a specific schema |
| startDate | string | Start date of the response processing |
| endDate | string | End date of the response processing |
| duration | string | Duration of the response processing |
| status | object | Status of the response |
| error | string | Error message (null if no error) |
| Key | Type | Description |
|---|---|---|
| code | number | Status code |
| message | string | Status message |
-
Fork the git repository
-
Create your feature branch
-
Apply your changes
-
Run application
# run test
make test
# start application in dev mode
make run # only on first time
go run main.go- Open browser to test your change!
Project is running at http://localhost:4455 or https://localhost:5544
-
Commit your changes
-
Push it on your fork
-
Create new pull request
.
βββ certificates # Project Certificates
βββ configs # Configuration file templates or default configs
βββ docs # Design and user documents
βββ init # System init and process manager/supervisor configs
βββ internal
β βββ pkg # Private library code
βββ scripts # Scripts to perform various build, install, analysis, etc operations
βββ test # Additional external test apps and test data
βββ Dockerfile # Docker image
βββ go.mod # Module dependencies
βββ go.sum # Ensure dependencies integrity
βββ LICENSE
βββ main.go # Application entry point
βββ Makefile # Helpers command
βββ README.md
Laurent Panek Security System Integrator |
Abdessalam Benharira JavaScript Developer |


