Skip to main content

client-side okerr module and utilities

Project description

okerrupdate - client-side okerr module and utilities

Installation

# newer method with pipx
sudo pipx install okerrupdate

# old method with pip3, if you cannot install pipx
sudo pip3 install okerrupdate


sudo okerrmod --init # enable few basic modules, create /etc/cron.d/ job, create okerrupdate config template
sudo vim /etc/okerr/okerrupdate

and modify okerrupdate file:

# Stub for okerrmod            
PREFIX=braconnier:
OKERR_TEXTID=
OKERR_SECRET=
OKERR_URL=
OKERR_DIRECT=0

OKERR_MOD_AVAIL=

or provide values to okerrmod --init as option values (e.g. okerrmod --init --textid MyTextid).

Basic usage

okerrupdate utility

okerrupdate is small script which updates/creates indicators in okerr project.

This will create simplest indicator 'myindicator' with all default settings (type 'heartbeat', policy 'Default'). Indicator will send alert if it will be updated to 'ERR' or if will not be updated for some time (Default policy period+patience).

$ okerrupdate myindicator OK
okerr updated (200 OK) myindicator@okerr = OK

This will create numerical indicator 'temp' with current value 36.6, and policy 'Daily'. Will send alert if not updated for a day or if value will be over maxlim (37).

$ okerrupdate -p Daily -m 'numerical|maxlim=37' temp 36.6
okerr updated (200 OK) temp@okerr = 36.6

Project TextID and secret is read from /etc/okerr/okerrupdate file or OKERR_TEXTID and OKERR_SECRET environment variables.

okerrmod utility

okerrmod is script to perform different local checks (such as free disk space, mysql running, load average, etc.). After initial okerrmod --init, few basic check modules are enabled.

List all available check modules (+ - module enabled, - - module disabled ):

$ okerrmod --list
+ backups 0.1 Check freshness for backup files
+ df 0.1 Free disk space
...

To run enabled checks just run okerrmod without any other commands:

xenon@braconnier:~$ sudo okerrmod 
okerr updated (200 OK) braconnier:maxfilesz@okerr = 9077814
okerr updated (200 OK) braconnier:apache@okerr = 0
okerr updated (200 OK) braconnier:nonempty@okerr = 0
okerr updated (200 OK) braconnier:empty@okerr = 0
...

To run just one check:

$ sudo okerrmod --run ok
okerr updated (200 OK) braconnier:ok@okerr = OK

To enable new check:

$ sudo okerrmod --enable runstatus
2020/01/17 16:12:30 enable /usr/local/lib/python3.7/dist-packages/okerrupdate/mods-available/runstatus
2020/01/17 16:12:30 make default config file: /etc/okerr/mods-env/runstatus

After this, you may want to edit default configuration for this check

sudo vim /etc/okerr/mods-env/runstatus

After this, okerrmod will run this check.

To create your own very basic check 'my' create dir /etc/okerr/mods-available/my and edit /etc/okerr/mods-available/my/check:

#!/usr/bin/python3
print("STATUS: OK")

or if you prefer shell (check is any executable file):

#!/bin/sh
echo STATUS: OK

Now you can run it manually okerrmod --run my, enable okerrmod --enable my, make/edit config file for it /etc/okerr/mods-env/my.

Using okerrupdate python library

Simplest case:

#!/usr/bin/python
import okerrupdate

op = okerrupdate.OkerrProject('MyTextID', secret='MySecret')
i = op.indicator('temp', method='numerical|maxlim=37', policy='Daily')
i.update('36.6')

Documentation

More info in okerrupdate documentation.

Other okerr resources

Project details


Release history Release notifications | RSS feed

This version

2.0.1

Download files

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

Source Distribution

okerrupdate-2.0.1.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

okerrupdate-2.0.1-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

Details for the file okerrupdate-2.0.1.tar.gz.

File metadata

  • Download URL: okerrupdate-2.0.1.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

File hashes

Hashes for okerrupdate-2.0.1.tar.gz
Algorithm Hash digest
SHA256 24714ca03d0a5465e67e1f03f449768048757b343ddf74b25650937e97d81bcf
MD5 6dfd1b1a07ee647100725e3f952e3966
BLAKE2b-256 81f56e253c530705324bcd393a694de8715340ca00a179063675caf6a5cb70a4

See more details on using hashes here.

File details

Details for the file okerrupdate-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: okerrupdate-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 42.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

File hashes

Hashes for okerrupdate-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf9ed97c6f129bbaa768a45d061c7bf244880bfcced7f0a1fd9ab1d0284003b0
MD5 cea5fb734787e3e550422cc146a35f7e
BLAKE2b-256 b27bf766d79a1f1e3332f082b7715341830c18b5ca8f8142f32c04a63f4035fc

See more details on using hashes here.

Supported by

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