Skip to main content

This project gathers metrics for local or hosted servers that can be run on a server used to post data to Grafana and Prometheus.

Project description

Starlyng Server Metrics

This project gathers metrics for local or hosted servers that can be run on a server used to post data to Grafana and Prometheus.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed Python 3.x.
  • You have a basic understanding of Python and virtual environments.

Setting Up Your Development Environment

To set up your development environment and run the project, follow these steps:

Clone the Repository

First, clone the repository to your local machine:

git https://github.com/starlyngapp/server-metrics.git
cd server-metrics

Create and Activate Virtual Environment

For macOS and Linux:

python -m venv venv
source venv/bin/activate

For Windows:

python -m venv venv
venv\Scripts\activate

Install Required Packages

Install all dependencies listed in the dev-requirements.txt file:

pip install -r dev-requirements.txt

Installation

To install only the package (without dev dependencies):

pip install starlyng_server_metrics

To install development dependencies (useful for contributing to the project):

pip install starlyng_server_metrics[dev]

Alternatively, you can install the development dependencies using:

pip install -r dev-requirements.txt

Environment Configuration

To configure the server metrics collection, you need to set up environment variables. This can be done by creating a .env file in the root of the project.

An example .env file is provided as .env.example. You can copy this file and update the values as needed.

Steps to Configure Environment Variables

  1. Copy the example environment file:
cp .env.example .env
  1. Open the .env file and update the values:
# .env
# List of server IPs and ports in the format ip:port, separated by commas
SERVERS=192.168.1.1:22,192.168.1.2:22

# Path to the SSH private key
KEY_PATH=/path/to/your/.ssh/id_rsa

# SSH username
USERNAME=your_username
  1. Save the .env file.

The SERVERS variable should be a comma-separated list of server IP addresses and ports. The KEY_PATH should point to the SSH private key file you will use for authentication, and USERNAME should be the SSH username.

Usage

To run the main function:

starlyng_metrics

PyPI

starlyng-server-metrics

Command-line Arguments

You can also override configuration using command-line arguments:

starlyng_metrics --servers "192.168.1.1:22,192.168.1.2:22" --key_path "/path/to/your/.ssh/id_rsa" --username "your_username"

Or locally:

python main.py --servers "192.168.1.1:22,192.168.1.2:22" --key_path "/path/to/your/.ssh/id_rsa" --username "your_username"

Building and Uploading Your Package

  1. Build the package:
python setup.py sdist bdist_wheel
  1. Upload to PyPI:
twine upload dist/*

Upload using specific project name referenced in .pypirc

twine upload dist/* --repository starlyng-server-metrics

Running Tests

To run tests, execute the following command in your terminal:

pytest

This command will run all tests and report the results. You can also run specific tests by providing the path and filename of the test file.

Contributing to the Project

Contributions to this project are welcome. Here's how you can contribute:

  1. Fork the project.
  2. Create your feature branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -am 'Add some YourFeature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a pull request.

Contact

If you have any questions, please contact us at:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starlyng_server_metrics-0.3.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

starlyng_server_metrics-0.3.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file starlyng_server_metrics-0.3.0.tar.gz.

File metadata

  • Download URL: starlyng_server_metrics-0.3.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.6

File hashes

Hashes for starlyng_server_metrics-0.3.0.tar.gz
Algorithm Hash digest
SHA256 aebf93f04616c3502cf285d98b6bba3d16b7764ca47a1087269e654401901e62
MD5 fdc7dd5e556290c60d3939a303b788a2
BLAKE2b-256 976946c0d4f40b3318ae44e09550958fb768a64f5bd9384f0c1d267df49c5fac

See more details on using hashes here.

File details

Details for the file starlyng_server_metrics-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for starlyng_server_metrics-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d9ccf98fc3e27c8a016a41bf43249d578023a02382f622e935b19d0f42f015c
MD5 7ec1a380d86465cae40b5fb8d25d8fe9
BLAKE2b-256 7f8074a8aef7ad5bdc074b230d92f50ba838dc7c72a5abab4612cf283e2c8feb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page