Openlmi Documentation Release Latest
Total Page:16
File Type:pdf, Size:1020Kb
OpenLMI Documentation Release latest OpenLMI authors October 08, 2014 Contents 1 Client components 3 1.1 LMI metacommand ............................................3 1.2 LMIShell .................................................3 2 Server components 5 3 Table of Contents 7 3.1 OpenLMI client components.......................................7 3.2 OpenLMI server components...................................... 194 Python Module Index 299 i ii OpenLMI Documentation, Release latest OpenLMI = Open Linux Management Infrastructure. OpenLMI is open-source project aiming to improve management of Linux systems using WBEM standards. We reuse many already available open-source WBEM components, adding the missing ones and integrating them into one system management solution. In short, WBEM can be described as a remote API for system management. See WBEM overview for details. Contents 1 OpenLMI Documentation, Release latest 2 Contents CHAPTER 1 Client components There are many already existing tools and libraries to manage WBEM-enabled hosts. see WBEM overview for details. OpenLMI project adds LMI metacommand and LMIShell. 1.1 LMI metacommand A command line utility to perform discovery and operations on remote managed systems. For example, it can start a printing service on remote system: /usr/bin/lmi -h my.server.org service start cups LMI metacommand users do not need to know anything about WBEM, all the complexity is hidden inside. 1.2 LMIShell A high-level python-based WBEM client, that can be used for scripting or as an interactive shell to manage remote systems. For example, one can write a script to start a service: c= connect("my.server.org","root","opensesame") cups=c.root.cimv2.LMI_Service.first_instance({"Name":"cups.service"}) cups.StartService() LMIShell users do not need to know anything about WBEM transport protocols, however some knowledge about the aforementioned remote API becomes necessary. In the example above, the script author must know that system ser- vices are exposed as instances of LMI_Service class with property Name (the service name) and method StartService() that starts the service. 3 OpenLMI Documentation, Release latest 4 Chapter 1. Client components CHAPTER 2 Server components OpenLMI focuses on implementation of missing providers for networking, storage, system services, packages and so on. 5 OpenLMI Documentation, Release latest 6 Chapter 2. Server components CHAPTER 3 Table of Contents 3.1 OpenLMI client components They consist of several client-side python utilities and libraries. We refer to them as OpenLMI Tools and ship them under obvious name openlmi-tools. Currently they contain LMI metacommand and LMIShell. 3.1.1 LMI metacommand Is a command line interface for OpenLMI Providers sitting on top of LMIShell. It provides an easy to use interface for system management through modular commands. These dynamically extend the functionality of LMI metacommand. Short example: $ lmi -h myhost.example.org storage fs create --label=opt-root ext4 /dev/vda5 Usage LMI metacommand is a command line utility build on top of client-side libraries. It can not do much on its own. Its functionality is extended by commands that are installed separately. Each command operates on a set of providers that need to be installed on managed machine. Commands can be invoked directly from shell or within interactive mode. Running from command line It can run single command given on command line like this: lmi -h ${hostname} service list --all Getting help For detailed help run: lmi --help To get a list of available commands with short descriptions: 7 OpenLMI Documentation, Release latest lmi help For help on a particular registered command: lmi help service Interactive mode Or it can be run in interactive mode when command is omitted: $ lmi -h ${hostname} lmi> help ... lmi> sw search django ... lmi> sw install python-django ... lmi> exit help command is always your good friend. Following two lines gets you the same help message: lmi> help storage raid ... lmi> storage raid --help ... Built-in commands Interactive mode comes with few special commands not available from command line. To get their list, type: lmi> : help They are prefixed with : and optional space. Currently only namespace nesting commands are supported. Those are :cd, :.. and :pwd. They work as expected: lmi> :pwd # top-level namespace /lmi lmi> :cd storage # you can do storage specific stuff here >storage> :pwd /lmi/storage >storage> :cd raid # we don’t care about anything but raid >>raid> :pwd /lmi/storage/raid >>raid> :cd /lmi/sw # let’s manage packages now >sw> :.. lmi> Static commands Aren’t prepended with : and except for help are again available only in interactive mode. EOF Same as hitting ^D. If some nested into some command’s namespace, it will map to :cd .. and parent namespace will become active. If the top-level namespace is active, program will exit. exit Exits immediately. It accepts optional exit code as an argument. help Lists available commands. Accepts command path as an optional argument. 8 Chapter 3. Table of Contents OpenLMI Documentation, Release latest Extending metacommand In order to make the LMI metacommand useful, you’ll need to install some commands. If you run Fedora, the easiest way to get them is with your favorite package manager: sudo dnf install ’openlmi-scripts-*’ Note: On RHEL you’ll need to add EPEL to your repositories before installing them with yum. They will be automatically discovered by LMI metacommand. You can ensure their presence with this simple test: $ lmi help Commands: file - File and directory management functions. group - POSIX group information and management. help - Print the list of supported commands with short description. hwinfo - Display hardware information. journald - Test for provider version requirements locale - System locale management. net - Networking service management. power - System power state management. service - System service management. sssd - SSSD system service management. storage - Basic storage device information. sw - System software management. system - Display general system information. user - POSIX user information and management. For more informations about particular command type: help <command> As Python eggs They may be installed on any distribution. Go for them also if you want to be more up to date. They are available for download from PyPI. The easiest way to install them is with pip (shipped with python-pip package): pip search openlmi-scripts pip install --user openlmi-scripts-{hardware,system,service,storage} Bleeding edge Commands are available from our git repository. Follow instructions there to install the most up to date versions. Documentation Check out documentation of currently implemented commands. • Account command line reference • Hardware command line reference • Journald command line reference • Locale command line reference • Logical File command line reference • Networking command line reference • Power Management command line reference • Realmd command line reference 3.1. OpenLMI client components 9 OpenLMI Documentation, Release latest • Service command line reference • Software command line reference • SSSD command line reference • Storage command line reference • System command line reference Configuration LMI metacommand has the main configuration file located in: /etc/openlmi/scripts/lmi.conf User can have his own configuration file taking precedence over anything in global one above: $HOME/.lmirc Configuration is written in INI-like configuration files. Please refer to ConfigParser‘s documentation for details. Follows a list of sections with their list of options. Most of the options listed here can be overridden with command line parameters. See also: configuration Section [Main] CommandNamespace [string] Python namespace, where command entry points will be searched for. Defaults to lmi.scripts.cmd. Trace [boolean] Whether the exceptions should be logged with tracebacks. Defaults to False. Can be overridden with --trace and --notrace options on command-line. Note: For most exceptions generated by scripts a Verbosity option needs to be highest as well for tracebacks to be printed. Verbosity: integer A number within range -1 to 2 saying, how verbose the output shall be. This differs from log_level, which controls the logging messages written to file. If logging to console is enabled it sets the minimum severity level. -1 Suppresses all messages except for errors. 0 shows warnings, 1 info messages and 2 enables debug messages. This option also affects the verbosity of commands, making them print more information to stdout. Defaults to 0. Can be overridden with -v and -q flags on command-line. Section [CIM] Namespace [string] Allows to override default CIM namespace, which will be passed to script library functions. Defaults to root/cimv2. 10 Chapter 3. Table of Contents OpenLMI Documentation, Release latest Section [SSL] VerifyServerCertificate [boolean] Whether to verify server-side certificate, when making secured connection over https. Defaults to True. Can be overridden with -n | --noverify flag on command-line. Section [Format] HumanFriendly [boolean] Whether to print values in human readable forms (e.g. with units). Defaults to False. Can be overridden with -H | --human-frienly flag on command-line. ListerFormat [one of {csv, table}] What format to use, when listing tabular data. csv format allows for easy machine parsing, the second one is more human friendly. Defaults to table. Can be overridden with -L | --lister-format option on command line. NoHeadings