Skip to main content

Roberts base module

Project description

rvr.base

This is Roberts personal base module. Currently it provides the following functionality:

  • Logging to Azure log analytics
  • Sending notifications using https://notify.run/
  • Querying configuration from a single configuration (.ini) file.

Prerequistes

You'll need an Azure log analytics workspace. This is where the logs are send to. This module is developed for Linux and tested on:

  • Ubuntu 20.04 using Python 3.8.10.
  • Raspberry Pi OS using Python 3.9.2

The configurationfile The configuration file is used for some configuration settings like the Log analytics workspace and password... it's a bad practice I know... Perhaps I'll improve the security later on. The file is located in '/etc/rvr/config.ini'.

The file requires the following content:

[AZ GENERAL]
tenant = 83ebf573-f6a0-4a5a-a14e-323ba97ec356

[AZ_LOG_ANALYTICS_WORKSPACE]
workspace_id = 'log analytics workspace_id'
primary_key = 'log analytics primary key'
powerstatistics_workspace_id = 'log analytics workspace_id'
powerstatistics_primary_key = 'log analytics primary key'

[AZ SERVICE PRINCIPAL LOGANALYTICSREADER]
service_principal_loganalyticsreader_id = 'service principal'
service_principal_loganalyticsreader_secret = 'secret'

[HOME_WIZARD_P1]
hwip = IP

Installing the module

Just install the module with pip3 install rvr-base.

Using the module

An example says more than 1000 words in my opinion. Please see the example.py file in this project for examples.

Building

Prerequistes for building Make sure you'll have the following PIP packages installed:

  • wheel
  • setuptools
  • twine

Build the module Make sure the cursor is the root folder of the project and run: python3 -m build

Distributing the module

python3 -m twine upload dist/* --verbose -u

Testing the build module

Yeah I know, this isn't proper testing. But for now I've got to do with it. Here is an example:

# create a Python virtual environment:
python3 -m venv venv

# Make the environment active
source venv/bin/activate

# Install the build module
pip3 install ./dist/rvrbase-<VERSION AND THE REST OF THE FILE>.whl

#Run the example script
python3 example.py

Sources used

https://packaging.python.org/en/latest/tutorials/packaging-projects/ https://medium.com/slalom-build/reading-and-writing-to-azure-log-analytics-c78461056862

Disclaimer

This module has been written for my personal use. Feel free to use it but at your own discression. There is no support or whatsoever on my part.

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

rvr-base-1.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

rvr_base-1.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file rvr-base-1.1.1.tar.gz.

File metadata

  • Download URL: rvr-base-1.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for rvr-base-1.1.1.tar.gz
Algorithm Hash digest
SHA256 da2dd4eafbaa28213ca4bbac0d7f07691e2fbd476e3666eb8677800060814324
MD5 62021b97782267482b9b1ee1bf973dba
BLAKE2b-256 7815b748f3579cc92358e2782a581a69d4ae27f91d21b0831cf5d79edb8370ee

See more details on using hashes here.

File details

Details for the file rvr_base-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: rvr_base-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for rvr_base-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ef5af354d2841a7df7c975132dd69f8e42956b989c7fd5295fa99a378303e96
MD5 23b559c2bf7c3e1370157663d4a67a8d
BLAKE2b-256 6c1b4a8904c4c64183d2a137b55a730998f29acbeb6a8fc94c49d1962fc027a4

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