{"id":23015931,"url":"https://github.com/pywbem/pywbemtools","last_synced_at":"2025-08-14T07:32:19.919Z","repository":{"id":37952434,"uuid":"81960254","full_name":"pywbem/pywbemtools","owner":"pywbem","description":"A set of tools using pywbem to communicate with WBEM servers","archived":false,"fork":false,"pushed_at":"2024-11-30T10:00:51.000Z","size":5948,"stargazers_count":12,"open_issues_count":31,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-30T11:18:05.349Z","etag":null,"topics":["cim","smi-s","wbem"],"latest_commit_sha":null,"homepage":"http://pywbemtools.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pywbem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-14T15:36:36.000Z","updated_at":"2024-11-30T10:00:53.000Z","dependencies_parsed_at":"2024-01-16T15:43:27.129Z","dependency_job_id":"baa3cda9-9e05-4843-9113-158ccdad3b9c","html_url":"https://github.com/pywbem/pywbemtools","commit_stats":{"total_commits":878,"total_committers":5,"mean_commits":175.6,"dds":0.5660592255125285,"last_synced_commit":"863045d52efe0cd00cce97c8fc5b02aff6aea26e"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pywbem%2Fpywbemtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pywbem%2Fpywbemtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pywbem%2Fpywbemtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pywbem%2Fpywbemtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pywbem","download_url":"https://codeload.github.com/pywbem/pywbemtools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229810610,"owners_count":18127675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cim","smi-s","wbem"],"created_at":"2024-12-15T11:13:59.484Z","updated_at":"2025-08-14T07:32:19.906Z","avatar_url":"https://github.com/pywbem.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pywbemtools: Python tools for communicating with WBEM servers\n\n[![Version on Pypi](https://img.shields.io/pypi/v/pywbemtools.svg)](https://pypi.python.org/pypi/pywbemtools/)\n[![Test status (master)](https://github.com/pywbem/pywbemtools/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/pywbem/pywbemtools/actions/workflows/test.yml?query=branch%3Amaster)\n[![Docs status (master)](https://readthedocs.org/projects/pywbemtools/badge/?version=latest)](https://readthedocs.org/projects/pywbemtools/builds/)\n[![Test coverage (master)](https://coveralls.io/repos/github/pywbem/pywbemtools/badge.svg?branch=master)](https://coveralls.io/github/pywbem/pywbemtools?branch=master)\n[![Supported Python](https://img.shields.io/pypi/pyversions/pywbemtools.svg?color=brightgreen)](https://pypi.python.org/pypi/pywbemtools/)\n\n# Overview\n\nPywbemtools is a collection of command line tools that communicate with\nWBEM servers. The tools are written in pure Python and support Python 3.\n\nPywbemtools includes the following tools:\n\n- `pywbemcli` - A command line utility that uses the\n  [pywbem package on Pypi](https://pypi.org/project/pywbem/) to issue operations\n  to a WBEM server using the\n  [CIM/WBEM standards](https://www.dmtf.org/standards/wbem/) defined by the\n  [DMTF](https://www.dmtf.org/) to perform system management tasks.\n- `pywbemlistener` - A command line utility that manages WBEM\n  indication listeners running as background processes on the local\n  system. These listeners use the\n  [pywbem package on Pypi](https://pypi.org/project/pywbem/) to receive\n  indications sent by a WBEM server using the\n  [CIM/WBEM standards](https://www.dmtf.org/standards/wbem/) defined by the\n  [DMTF](https://www.dmtf.org/).\n\nCIM/WBEM standards are used for a wide variety of systems management\ntasks in the industry including DMTF management standards and the\n[SNIA](https://www.snia.org/) Storage Management Initiative\nSpecification\n([SMI-S](https://www.snia.org/forums/smi/tech_programs/smis_home)).\n\nPywbemcli provides access to WBEM servers from the command line. It\nprovides functionality to:\n\n- Explore the CIM data of WBEM servers. It can manage/inspect the CIM\n  model components including CIM classes, CIM instances, and CIM\n  qualifiers and execute CIM methods and queries on the WBEM server.\n- Execute specific CIM-XML operations on the WBEM server as defined in\n  [DMTF](https://www.dmtf.org/) standard\n  [DSP0200 (CIM Operations over HTTP)](https://www.dmtf.org/sites/default/files/standards/documents/DSP0200_1.4.0.pdf).\n- Inspect and manage WBEM server functionality including:\n  - CIM namespaces\n  - Advertised WBEM management profiles\n  - WBEM server brand and version information\n- Capture detailed information on CIM-XML interactions with the WBEM\n  server including time statistics and details of data flow.\n- Maintain a file with persisted WBEM connection definitions so that\n  pywbemcli can access multiple WBEM servers by name.\n- Provide both a command line mode and an interactive mode where\n  multiple pywbemcli commands can be executed within the context of a\n  WBEM server.\n- Use an integrated mock WBEM server to try out commands. The mock\n  server can be loaded with CIM objects defined in MOF files or via\n  Python scripts.\n\nPywbemlistener manages WBEM indication listeners that run on the local\nsystem as background processes. It provides functionality to:\n\n-   Start and stop listeners.\n-   List and show details of listeners.\n-   Send test indications to listeners.\n\n# Installation\n\nRequirements:\n\n1.  Python 3.8 and higher\n2.  Operating Systems: Linux, OS-X, native Windows, UNIX-like\n    environments on Windows (e.g. Cygwin)\n\nInstallation:\n\n- If not yet available, install the \"pipx\" command as described in\n  https://pipx.pypa.io/stable/installation/.\n\n- Without having any virtual Python environment active, install the CLI\n  as follows:\n\n  ``` bash\n  $ pipx install pywbemtools\n  ```\n\n  That makes the `pywbemcli` and `pywbemlistener` commands available in the PATH,\n  without having to activate any virtual Python environment.\n\nFor more details, see\n[Installation](https://pywbemtools.readthedocs.io/en/stable/introduction.html#installation).\n\n# Documentation and change history\n\nFor the latest version of pywbemtools released on Pypi:\n\n- [Documentation](https://pywbemtools.readthedocs.io/en/stable/)\n- [Change\n  history](https://pywbemtools.readthedocs.io/en/stable/changes.html)\n\n# Quickstart\n\nAll commands within any of the pywbemtools commands show help with the\n`-help` or `-h` options. For example, for the pywbemcli command:\n\n``` text\n$ pywbemcli --help\n. . .\n$ pywbemcli connection --help\n. . .\n$ pywbemcli connection save --help\n. . .\n```\n\nThe following examples build on each other and show a typical sequence\nof exploration of a WBEM server. For simplicity, they all operate\nagainst the default namespace of the server, and use a persistent\nconnection definition for the server:\n\n- Add a persistent connection definition named `conn1` for the WBEM\n  server to be used, so that the subsequent commands can refer to it:\n\n  ``` text\n  $ pywbemcli -s https://localhost --no-verify -u user -p password connection save conn1\n  ```\n\n- pywbemcli also supports mocked WBEM servers in memory, that are\n  preloaded with CIM objects defined in MOF files. Add a persistent\n  connection definition named `assoc1` to a mock server using one of\n  the MOF files provided in the repo:\n\n  ``` text\n  $ pywbemcli -m tests/unit/simple_assoc_mock_model.mof connection save assoc1\n  ```\n\n- List the persistent connection definitions:\n\n  ``` text\n  $ pywbemcli connection list\n  WBEM server connections(brief): (#: default, *: current)\n  name    server             mock-server\n  ------  -----------------  --------------------------------------\n  assoc1                     tests/unit/simple_assoc_mock_model.mof\n  conn1   https://localhost\n  ```\n\n- List the persistent connection definitions with full information:\n\n  ``` text\n  $ pywbemcli connection list --full\n  WBEM server connections(full): (#: default, *: current)\n  name    server             namespace    user      timeout  use_pull    verify    certfile    keyfile    mock-server\n  ------  -----------------  -----------  ------  ---------  ----------  --------  ----------  ---------  --------------------------------------\n  assoc1                     root/cimv2                  30              True                             tests/unit/simple_assoc_mock_model.mof\n  conn1   https://localhost  root/cimv2   user           30  True        False\n  ```\n\n- Show the class tree, using the previously added connection\n  definition `assoc1`:\n\n  ``` text\n  $ pywbemcli -n assoc1 class tree\n  root\n   +-- TST_FamilyCollection\n   +-- TST_Lineage\n   +-- TST_MemberOfFamilyCollection\n   +-- TST_Person\n       +-- TST_Personsub\n  ```\n\n- Retrieve a single class from that class tree:\n\n  ``` text\n  $ pywbemcli -n assoc1 class get TST_Person\n  class TST_Person {\n\n        [Key ( true ),\n         Description ( \"This is key prop\" )]\n     string name;\n\n     string extraProperty = \"defaultvalue\";\n\n  };\n  ```\n\n- Enumerate the instances of that class, returning only their instance\n  names by use of the `--no` option:\n\n  ``` text\n  $ pywbemcli -n assoc1 instance enumerate TST_Person --no\n  root/cimv2:TST_Person.name=\"Gabi\"\n  root/cimv2:TST_Person.name=\"Mike\"\n  root/cimv2:TST_Person.name=\"Saara\"\n  root/cimv2:TST_Person.name=\"Sofi\"\n  root/cimv2:TST_PersonSub.name=\"Gabisub\"\n  root/cimv2:TST_PersonSub.name=\"Mikesub\"\n  root/cimv2:TST_PersonSub.name=\"Saarasub\"\n  root/cimv2:TST_PersonSub.name=\"Sofisub\"\n  ```\n\n- Retrieve a single instance using one of these instance names:\n\n  ``` text\n  $ pywbemcli -n assoc1 instance get 'root/cimv2:TST_Person.name=\"Sofi\"'\n  instance of TST_Person {\n     name = \"Sofi\";\n  };\n  ```\n\n- The instance to be retrieved can also be selected interactively by\n  use of the wildcard instance key (\\\"CLASSNAME.?\\\"):\n\n  ``` text\n  $ pywbemcli -n assoc1 instance get TST_Person.?\n  Pick Instance name to process\n  0: root/cimv2:TST_Person.name=\"Saara\"\n  1: root/cimv2:TST_Person.name=\"Mike\"\n  2: root/cimv2:TST_Person.name=\"Sofi\"\n  3: root/cimv2:TST_Person.name=\"Gabi\"\n  4: root/cimv2:TST_PersonSub.name=\"Gabisub\"\n  5: root/cimv2:TST_PersonSub.name=\"Sofisub\"\n  6: root/cimv2:TST_PersonSub.name=\"Mikesub\"\n  7: root/cimv2:TST_PersonSub.name=\"Saarasub\"\n  Input integer between 0 and 7 or Ctrl-C to exit selection: 3\n  instance of TST_Person {\n     name = \"Gabi\";\n  };\n  ```\n\n- There are multiple output formats supported. The enumerated\n  instances can for example be formatted as a table of properties by\n  use of the `-o table` general option (these instances have only one\n  property \\'name\\'):\n\n  ``` text\n  $ pywbemcli -n assoc1 -o table instance enumerate TST_Person\n  Instances: TST_Person\n  +------------+\n  | name       |\n  |------------|\n  | \"Gabi\"     |\n  | \"Mike\"     |\n  | \"Saara\"    |\n  | \"Sofi\"     |\n  | \"Gabisub\"  |\n  | \"Mikesub\"  |\n  | \"Saarasub\" |\n  | \"Sofisub\"  |\n  +------------+\n  ```\n\n- Traverse all associations starting from a specific instance that is\n  selected interactively:\n\n  ``` text\n  $ pywbemcli -n assoc1 -o table instance associators TST_Person.?\n  Pick Instance name to process\n  0: root/cimv2:TST_Person.name=\"Saara\"\n  1: root/cimv2:TST_Person.name=\"Mike\"\n  2: root/cimv2:TST_Person.name=\"Sofi\"\n  3: root/cimv2:TST_Person.name=\"Gabi\"\n  4: root/cimv2:TST_PersonSub.name=\"Gabisub\"\n  5: root/cimv2:TST_PersonSub.name=\"Sofisub\"\n  6: root/cimv2:TST_PersonSub.name=\"Mikesub\"\n  7: root/cimv2:TST_PersonSub.name=\"Saarasub\"\n  Input integer between 0 and 7 or Ctrl-C to exit selection: 1\n  Instances: TST_FamilyCollection\n  +-----------+\n  | name      |\n  |-----------|\n  | \"Family2\" |\n  | \"Gabi\"    |\n  | \"Sofi\"    |\n  +-----------+\n  ```\n\nOther operations against WBEM servers include getting information on\nnamespaces, the Interop namespace, WBEM server brand information, or the\nadvertised management profiles:\n\n- Show the Interop namespace of the server:\n\n  ``` text\n  $ pywbemcli -n conn1 server interop\n  Server Interop Namespace:\n  Namespace Name\n  ----------------\n  root/PG_InterOp\n  ```\n\n- List the advertised management profiles:\n\n  ``` text\n  $ pywbemcli -n conn1 server profiles --organization DMTF\n  Advertised management profiles:\n  +----------------+----------------------+-----------+\n  | Organization   | Registered Name      | Version   |\n  |----------------+----------------------+-----------|\n  | DMTF           | CPU                  | 1.0.0     |\n  | DMTF           | Computer System      | 1.0.0     |\n  | DMTF           | Ethernet Port        | 1.0.0     |\n  | DMTF           | Fan                  | 1.0.0     |\n  | DMTF           | Indications          | 1.1.0     |\n  | DMTF           | Profile Registration | 1.0.0     |\n  +----------------+----------------------+-----------+\n  ```\n\nPywbemcli can also be executed in the interactive (REPL) mode by\nexecuting it without entering a command or by using the command `repl`.\nIn this mode the command line prompt is `pywbemcli\u003e`, the WBEM server\nconnection is maintained between commands and the general options apply\nto all commands executed:\n\n``` text\n$ pywbemcli -n conn1\nEnter 'help' for help, \u003cCTRL-D\u003e or ':q' to exit pywbemcli.\npywbemcli\u003e server brand\n\nServer Brand:\nWBEM Server Brand\n-------------------\nOpenPegasus\npywbemcli\u003e server interop\n\nServer Interop Namespace:\nNamespace Name\n----------------\nroot/PG_InterOp\npywbemcli\u003e :q\n```\n\nThe pywbemlistener command allows setting up WBEM indication listeners\non the local system. The following example starts a listener for HTTP on\nport 25000 and uses pywbemcli to set that server up for sending\nindications to the listener:\n\n``` text\n# Start OpenPegasus as a Docker container\n$ docker create keyporttech/smi-server:0.1.2 --name pegasus\n$ docker start pegasus\n\n# Define a pywbemcli named connection for that OpenPegasus\n$ pywbemcli -s https://localhost:5989 --no-verify connection save pegasus\n\n# Start a pywbem listener that appends any received indications to a file\n$ pywbemlistener start lis1 -s http -p 25000 --indi-file lis1.out\n$ pywbemlistener list\n+--------+--------+----------+-------+---------------------+\n| Name   |   Port | Scheme   |   PID | Created             |\n|--------+--------+----------+-------+---------------------|\n| lis1   |  25000 | http     |  6662 | 2022-01-02 13:28:04 |\n+--------+--------+----------+-------+---------------------+\n\n# Add our pywbem listener as a listener destination to the OpenPegasus server\n$ pywbemcli -n pegasus subscription add-destination lis1 -l http://localhost:25000\nAdded owned destination: Name=pywbemdestination:defaultpywbemcliSubMgr:lis1\n\n$ pywbemcli -n pegasus subscription list-destinations\nIndication Destinations: submgr-id=defaultpywbemcliSubMgr, svr-id=https://localhost:5989, type=all\n+-------------+------------+--------------------------------+------------------------+---------------+------------+----------------+\n| Ownership   | Identity   | Name                           | Destination            |   Persistence |   Protocol |   Subscription |\n|             |            | Property                       |                        |          Type |            |          Count |\n|-------------+------------+--------------------------------+------------------------+---------------+------------+----------------|\n| owned       | lis1       | pywbemdestination:defaultpywbe | http://localhost:25000 |             3 |          2 |              0 |\n|             |            | mcliSubMgr:lis1                |                        |               |            |                |\n+-------------+------------+--------------------------------+------------------------+---------------+------------+----------------+\n\n# Use pywbemlistener to send a test indication\n# Note: This does not utilize the OpenPegasus server but sends it directly to the listener\n$ pywbemlistener test lis1\nSending the following test indication:\ninstance of CIM_AlertIndication {\n   IndicationIdentifier = NULL;\n   AlertingElementFormat = 2;\n   AlertingManagedElement = NULL;\n   AlertType = 2;\n   Message = \"Test message\";\n   OwningEntity = \"TEST\";\n   PerceivedSeverity = 2;\n   ProbableCause = 0;\n   SystemName = NULL;\n   MessageArguments = { };\n   IndicationTime = \"20220102134842.761734+000\";\n   MessageID = \"TESTnnnn\";\n};\n\nSent test indication #1 to listener lis1 at http://localhost:25000\n\n$ cat lis1.out\n2022-01-02 13:48:43.010994+01:00 127.0.0.1 instance of CIM_AlertIndication {    IndicationIdentifier = NULL;    AlertingElementFormat = 2;\n  AlertingManagedElement = NULL;    AlertType = 2;    Message = \"Test message\";    OwningEntity = \"TEST\";    PerceivedSeverity = 2;\n  ProbableCause = 0;    SystemName = NULL;    MessageArguments = { };    IndicationTime = \"20220102134842.761734+000\";\n  MessageID = \"TEST0001\"; };\n```\n\n# Project Planning\n\nFor each upcoming release, the bugs and feature requests that are\nplanned to be addressed in that release are listed in the\n[pywbemtools issue tracker](https://github.com/pywbem/pywbemtools/issues) with\nan according milestone set that identifies the target release. The due date\non the milestone definition is the planned release date. There is\nusually also an issue that sets out the major goals for an upcoming\nrelease.\n\n# Contributing\n\nFor information on how to contribute to this project, see\n[Contributing](https://pywbemtools.readthedocs.io/en/stable/development.html#contributing).\n\n# License\n\nThe pywbemtools package is licensed under the [Apache 2.0\nLicense](https://github.com/pywbem/pywbemtools/tree/master/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpywbem%2Fpywbemtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpywbem%2Fpywbemtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpywbem%2Fpywbemtools/lists"}