Skip to main content

Tool to manage remote systems and services

Project description

Build Status Code Coverage Code Health

python-rrmngmnt

Remote Resources MaNaGeMeNT

Intro

This tool helps you manage remote machines and services running on that. It is targeted to Linux based machines. All is done via SSH connection, that means SSH server must be running there already.

from rrmngmnt import Host, RootUser

h = Host("10.11.12.13")
h.users.append(RootUser('123456'))
exec = h.executor()
print exec.run_cmd(['echo', 'Hello World'])

Features

List of provided interfaces to manage resources on machine, and examples.

Filesystem

Basic file operations, you can find there subset of python ‘os’ module related to files.

print h.fs.exists("/path/to/file")
h.fs.chown("/path/to/file", "root", "root")
h.fs.chmod("/path/to/file", "644")
h.fs.unlink("/path/to/file")

In additional there are methods to fetch / put file from / to remote system to / from local system.

h.fs.get("/path/to/remote/file", "/path/to/local/file/or/target/dir")
h.fs.put("/path/to/local/file", "/path/to/remote/file/or/target/dir")

There is one special method which allows transfer file between hosts.

h1.fs.transfer(
    "/path/to/file/on/h1",
    h2, "/path/to/file/on/h2/or/target/dir",
)

You can also mount devices.

with h.fs.mount_point(
    '//example.com/share', opts='ro,guest',
    fstype='cifs', target='/mnt/netdisk'
) as mp:
    h.fs.listdir(mp.target) # list mounted directory
    mp.remount('rw,sync,guest') # remount with different options
    h.fs.touch('%s/new_file' % mp.target) # touch file

Network

It allows to manage network configuration.

print h.network.hostname
h.network.hostname = "my.machine.org"
print h.network.all_interfaces()
print h.network.list_bridges()

Package Management

It encapsulates various package managements. It is able to determine which package management to use. You can still specify package management explicitly.

Implemented managements:

  • APT

  • YUM

  • DNF

  • RPM

# install htop package using implicit management
h.package_management.install('htop')
# remove htop package using rpm explicitly
h.package_management('rpm').remove('htop')

System Services

You can toggle system services, it encapsulates various service managements. It is able to determine which service management to use in most cases.

Implemented managements:

  • Systemd

  • SysVinit

  • InitCtl

if h.service('httpd').status():
    h.service('httpd').stop()
if h.service('httpd').is_enabled():
    h.service('httpd').disable()

Operating System Info

Host provide os attribute which allows obtain basic operating system info. Note that os.release_info depends on systemd init system.

print h.os.distribution
# Distribution(distname='Fedora', version='23', id='Twenty Three')

print h.os.release_info
# {'HOME_URL': 'https://fedoraproject.org/',
#  'ID': 'fedora',
#  'NAME': 'Fedora',
#  'PRETTY_NAME': 'Fedora 23 (Workstation Edition)',
#  'VARIANT': 'Workstation Edition',
#  'VARIANT_ID': 'workstation',
#  'VERSION': '23 (Workstation Edition)',
#  'VERSION_ID': '23',
#  ...
# }

print h.os.release_str
# Fedora release 23 (Twenty Three)

Storage Management

It is in PROGRESS state. Planed are NFS & LVM services.

Power Management

Give you possibility to control host power state, you can restart, poweron, poweroff host and get host power status.

Implemented managements:

  • SSH

  • IPMI

ipmi_user = User(pm_user, pm_password)
ipmi_params = {
    'pm_if_type': 'lan',
    'pm_address': 'test-mgmt.testdomain',
    'user': ipmi_user
}
h.add_power_manager(
    power_manager.IPMI_TYPE, **ipmi_params
)
# restart host via ipmitool
h.power_manager.restart()

Requires

  • paramiko

  • netaddr

  • six

Install

python setup.py devop

Test

tox

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

python-rrmngmnt-0.1.5.zip (60.5 kB view details)

Uploaded Source

python-rrmngmnt-0.1.5.tar.gz (44.2 kB view details)

Uploaded Source

Built Distributions

python_rrmngmnt-0.1.5-py2.7.egg (74.4 kB view details)

Uploaded Source

python-rrmngmnt-0.1.5-1.src.rpm (57.5 kB view details)

Uploaded Source

python-rrmngmnt-0.1.5-1.noarch.rpm (66.6 kB view details)

Uploaded Source

File details

Details for the file python-rrmngmnt-0.1.5.zip.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.5.zip
Algorithm Hash digest
SHA256 02d2946629fd5147a1899c392375fe4da14419143075fc0ba4de92b5b2069e0f
MD5 fc3183d6a1b83790645e199867f60c1e
BLAKE2b-256 eb65675faf4ecac3ef34b2a1588b833b95b676af1ca06a8ced74672ae91f562d

See more details on using hashes here.

File details

Details for the file python-rrmngmnt-0.1.5.tar.gz.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b9df32b2d16cd389900173516b65dd527b4c2f49936822f497d1a7eaf628c101
MD5 5c0ad586943d5d7995164ac2f361dd07
BLAKE2b-256 2130bb50d8d6f6d98637ded094453a93ea8d542f24c90e88dc9835e7d0c4bcf4

See more details on using hashes here.

File details

Details for the file python_rrmngmnt-0.1.5-py2.7.egg.

File metadata

File hashes

Hashes for python_rrmngmnt-0.1.5-py2.7.egg
Algorithm Hash digest
SHA256 1fa41536bec778fbbcb0eb366df7afe45e99fa95e427bedcdd4dd90e018ffa12
MD5 a36bbc7dd3903b9c6fbeeb70ebf8d068
BLAKE2b-256 8d6d4aa6e243a84547ebae97d758044e296ba1e8608361e59cb17b02f2c39804

See more details on using hashes here.

File details

Details for the file python-rrmngmnt-0.1.5-1.src.rpm.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.5-1.src.rpm
Algorithm Hash digest
SHA256 98a10cbd09b25406f7b924c9a9a5730bd673877d90ea1e743814063972e26502
MD5 1da3bb5bda0e73609d1418be6ae573d9
BLAKE2b-256 81d3d7895223520b1d1e7b1829ae749b375b62fd647b0d86e4a6e812593880e1

See more details on using hashes here.

File details

Details for the file python-rrmngmnt-0.1.5-1.noarch.rpm.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.5-1.noarch.rpm
Algorithm Hash digest
SHA256 3d5de6574053d1f9173be1da929297db524646f22fb81e29ec5b8e3890b12630
MD5 5e8fd3b9b0c296181335ed2ea19423a6
BLAKE2b-256 767e5059241af8c52c02fd5fdea5eb92d76adb591ad680228c7cd844ea7683d7

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