Skip to main content

Pack and unpack Check_MK mkp files

Project description

python-mkp

ci release

Pack or unpack Check_MK mkp files.

The purpose of this library is to generate mkp files from source without having to set up a complete Check_MK instance. It is not intended for installing mkp files to a Check_MK site.

Installation

pip install mkp

Usage

Automatically pack mkp package

Create a executable script in the the top directory, e.g. dist.py

#!/usr/bin/env python

from mkp import dist

dist({
    'author': 'John Doe',
    'description': 'Test the automatic creation of packages',
    'download_url': 'http://example.com/',
    'name': 'test',
    'title': 'Test',
    'version': '1.0',
    'version.min_required': '1.2.3',
})

Create a directory structure as follows:

├── agents/
├── checkman/
├── checks/
├── doc/
├── inventory/
├── notifications/
├── pnp-templates/
├── web/
└── dist.py

Empty directories can be omitted. Running dist.py will pack all files in the directories listed above to a mkp package with the canonical name and the specified metadata. The mkp file will be written to the dist directory.

Extract mkp package

import mkp

package = mkp.load_file('foo-1.0.mkp')
print(package.info)
package.extract_files('path/to/somewhere')

Pack files to mkp package

In contrast to dist, this provides the possibility to manually select the files by replacing find_files. It is also possible to choose a different output filename.

import mkp

info = {
  'author': 'tom-mi',
  'description': 'Test the system',
  'download_url': 'http://example.com/',
  'files': mkp.find_files('path/to/files'),
  'name': 'test',
  'title': 'Test',
  'version': '1.0',
  'version.min_required': '1.2.3',
}
mkp.pack_to_file(info, 'path/to/files', 'test-1.0.mkp')

License

This software is licensed under GPLv2.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mkp-0.5-py2.py3-none-any.whl (11.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mkp-0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: mkp-0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for mkp-0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 17187799bec23db56485a09dab8452a07321f6a74aae1ebe76c13d7c27e448a1
MD5 a9e12156cd8ed910b1dd37bb0071eb5c
BLAKE2b-256 1788fd105d995d1cdd994bb4c542b44c20dc4b28116125351055f760565553ff

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