go-pc-metrics

module
v0.0.0-...-165a0e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: Apache-2.0

README

GitHub go.mod Go version

GitHub code size in bytes

GitHub

Description

go-pc-metrics is a project written in Go (Golang) that includes two applications: the agent and the server. The agent collects system metrics from your computer and sends them to the server for further processing and storage. The server receives metrics, displays them in a browser, and stores them in the chosen storage (supports memory, file, postgresql).

Installation and Running

git clone https://github.com/korovindenis/go-pc-metrics.git cd go-pc-metrics

Agent (cmd/agent)

The agent is an application that collects system metrics from your computer and sends them to the server for further processing and storage.

Compiling the Agent

To compile the agent, execute the following command:

make build-agent

Agent Parameters
  • --address (or env var ADDRESS): The address of the web server to which metrics will be sent.
  • --logs: Logging level (info, debug).
  • --report (or env var REPORT_INTERVAL): The frequency of sending metrics to the server (default 10 seconds).
  • --poll (or env var POLL_INTERVAL): The frequency of collecting metrics from the computer (default 2 seconds).
  • --key (or env var KEY): The key for signing messages sent to the server.

Server (cmd/server)

The server is an application that receives metrics from the agent, displays them in a browser, and stores them in the chosen storage (supports memory, file, postgresql).

Compiling the Server

To compile the server, execute the following command:

make build-server

Using the Server

Server Parameters
  • --address (or env var ADDRESS): The address on which the server will run (default :8080).
  • --logs: Logging level (info, debug).
  • --store_interval (or env var STORE_INTERVAL): Used if storage = disk, specifying how frequently to write received data from memory to disk (default 300 seconds).
  • --file_storage_path (or env var FILE_STORAGE_PATH): Used if storage = disk, specifying the path to the file for storing agent metrics (default ./tmp/metrics-db.json).
  • --restore (or env var RESTORE): Whether to load data from storage during server initialization.
  • --database_dsn (or env var DATABASE_DSN): Connection string for connecting to PostgreSQL.
  • --key (or env var KEY): The key for verifying the signature of messages received from the agent.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributions and Feedback

Contributions to this project are welcome! If you have suggestions, find issues, or want to contribute new features or improvements, please feel free to open an issue or a pull request on GitHub.

Your feedback is valuable to us. If you have any questions or encounter any issues while using go-pc-metrics, please don't hesitate to reach out and open an issue on the GitHub repository. We appreciate your support in making this project better.

Directories

Path Synopsis
cmd
agent/app
The main application, the client part
The main application, the client part
server/app
The main application, the backend
The main application, the backend
staticlint
Staticlint provides essential static code analysis checks.
Staticlint provides essential static code analysis checks.
internal
adapters/storage/disk
Storage with file system
Storage with file system
adapters/storage/memory
Storage with RAM
Storage with RAM
adapters/storage/postgresql
Storage with postgresql
Storage with postgresql
domain/entity
Application Entities
Application Entities
domain/usecases/agent
the business logic of the client side
the business logic of the client side
domain/usecases/server
the business logic of the backend
the business logic of the backend
logger
Logging of service information
Logging of service information
server/config
Getting the settings for the application
Getting the settings for the application
server/handler
Module with handlers
Module with handlers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL