首页
/ Openwsman 技术文档

Openwsman 技术文档

2024-12-28 11:21:15作者:裴锟轩Denise

1. 安装指南

1.1 环境准备

在编译 openwsman 之前,确保安装以下依赖包:

  • libxml2
  • sblim-sfcc(来自 sblim 项目)
  • swig 和 python(用于 python 绑定支持)
  • 其他开发包,如 cmake、gcc 等

1.2 编译与安装

  1. 从 git 仓库检出项目后,创建一个构建目录:

    mkdir build
    
  2. 切换到构建目录,执行以下命令:

    cd build
    cmake ..
    make
    
  3. 若要运行 cmake 的 'release' 模式,请参考 package/openwsman.spec.in 文件。

  4. 根据您的操作系统发行版,可能需要安装一些额外的包。

  5. 预编译(RPM)包可以在 openSUSE 构建服务 上找到。

2. 项目使用说明

openwsman 是一个 WS-Management 服务器的实现。以下是如何使用该服务器的简要说明:

2.1 服务器运行

服务器可以作为守护进程运行,这需要 root 权限;或者在前台运行,并打印调试信息到 stdout。

  • 以调试模式在前台启动服务器:

    /usr/sbin/openwsmand -d
    
  • 可以使用 -c 选项指定配置文件:

    /usr/sbin/openwsmand -c /path/to/config/file
    

2.2 配置文件

从版本 0.1.1 开始,需要一个配置文件。可以在 ./etc 目录找到一个示例。配置文件具有以下语法:

[server]
port = 5985
ssl_port = 5986
ssl_cert_file = /etc/openwsman/servercert.pem
ssl_key_file = /etc/openwsman/serverkey.pem
basic_password_file = /etc/openwsman/simple_auth.passwd
enum_idle_timeout = 5000
max_threads = 1

3. 项目 API 使用文档

openwsman 提供了丰富的命令行工具,用于与服务器进行交互。以下是一些基本的命令和使用方法:

3.1 客户端连接

连接到服务器可以使用以下命令:

wsman identify -h <hostname> --port 5988 -u wsman --password secret

3.2 获取信息

获取服务器信息:

wsman enumerate --resource-uri http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Win32_OperatingSystem

3.3 创建和更新资源

创建或更新资源:

wsman create --resource-uri http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Win32_Process --input process.xml
wsman put --resource-uri http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Win32_Process --input process.xml

3.4 删除资源

删除资源:

wsman delete --resource-uri http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Win32_Process --uuid <uuid>

4. 项目安装方式

openwsman 可以通过以下方式安装:

  • 使用预编译的 RPM 包,可在 openSUSE 构建服务 上找到。
  • 从源代码编译,按照上述的编译指南进行操作。

请确保安装所有必要的依赖包,并根据您的系统环境进行适当的配置。

登录后查看全文
热门项目推荐