红鱼公用事业

redfish-utilities的Python项目详细描述


红鱼图钉板

版权所有2019 DMTF。保留所有权利。

关于

redfish tacklebox包含一组python实用程序,用于对redfish服务执行常见的管理操作。 这些实用程序可以用作更大的管理应用程序的一部分,也可以用作独立的命令行工具。

安装

pip安装redfish实用程序

从源头建设

python setup.py sdist --formats=zip
cd dist
pip install redfish_utilities-x.x.x.zip

要求

外部模块:

  • 红鱼:https://pypi.python.org/pypi/redfish rel="nofollow">https://pypi.python.org/pypi/redfish

您可以通过运行以下命令安装外部模块:

pip install-r requirements.txt

实用程序

传感器列表

usage: rf_sensor_list.py [-h] --user USER --password PASSWORD --rhost RHOST

A tool to walk a Redfish service and list sensor info

required arguments:
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)

optional arguments:
  -h, --help            show this help message and exit

示例:rf_sensor_list.py-u root-p root-r https://192.168.1.100

该工具将使用用户密码参数提供的凭据登录到rhost参数指定的服务。 然后,它遍历服务的机箱集合,并读取它们各自的电源和热量资源。 利用这些资源中的信息,它将构建一个传感器表并打印收集的信息。

系统库存

usage: rf_sys_inventory.py [-h] --user USER --password PASSWORD --rhost RHOST
                           [--details] [--noabsent]

A tool to walk a Redfish service and list component information

required arguments:
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)

optional arguments:
  -h, --help            show this help message and exit
  --details, -details   Indicates if the full details of each component should
                        be shown
  --noabsent, -noabsent
                        Indicates if absent devices should be skipped

示例:rf_sys_inventory.py-u root-p root-r https://192.168.1.100-详细信息

该工具将使用用户密码参数提供的凭据登录到rhost参数指定的服务。 然后,它遍历服务的机箱集合,并收集处理器、内存、驱动器、PCIEdevices、网络适配器和存储控制器的组件信息。 使用收集的信息,它将建立一个库存表并打印信息。

电源/复位

usage: rf_power_reset.py [-h] --user USER --password PASSWORD --rhost RHOST
                         [--system SYSTEM] [--type TYPE]

A tool to perform a power/reset operation of a system

required arguments:
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)

optional arguments:
  -h, --help            show this help message and exit
  --system SYSTEM, -s SYSTEM
                        The ID of the system perform the operation
  --type TYPE, -t TYPE  The type of power/reset operation to perform

示例:rf_power_reset.py-u root-p root-r https://192.168.1.100-t gracefulrestart

该工具将使用用户密码参数提供的凭据登录到rhost参数指定的服务。 然后,它遍历服务的系统集合,以找到由system参数指定的匹配系统。 它将使用type参数中指定的重置类型执行重置操作。

  • 如果未指定系统,并且服务只有一个系统,则它将在一个系统上执行操作。
  • 如果未指定类型,它将尝试正常重新启动。

启动覆盖

usage: rf_boot_override.py [-h] --user USER --password PASSWORD --rhost RHOST
                           [--system SYSTEM] [--target TARGET] [--uefi UEFI]
                           [--reset]

A tool to perform a one time boot override of a system

required arguments:
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)

optional arguments:
  -h, --help            show this help message and exit
  --system SYSTEM, -s SYSTEM
                        The ID of the system to set
  --target TARGET, -t TARGET
                        The target boot device; if not provided the tool will
                        display the current boot settings
  --uefi UEFI, -uefi UEFI
                        If target is 'UefiTarget', the UEFI Device Path of the
                        device to boot. If target is 'UefiBootNext', the UEFI
                        Boot Option string of the device to boot.
  --reset, -reset       Signifies that the system is reset after the boot
                        override is set

示例:rf_boot_override.py-u root-p root-r https://192.168.1.100-t pxe-reset

该工具将使用用户密码参数提供的凭据登录到rhost参数指定的服务。 然后,它遍历服务的系统集合,以找到由system参数指定的匹配系统。

  • 如果未指定系统,并且服务只有一个系统,则它将在一个系统上执行操作。

然后,该工具将对匹配系统中的引导对象执行操作。

  • 如果指定了target,它将更新引导对象以将引导覆盖设置为target
    • 如果提供了reset,它将在更新引导对象后重置系统。
  • 如果未指定目标,它将显示系统的当前引导覆盖设置。

帐户

usage: rf_accounts.py [-h] --user USER --password PASSWORD --rhost RHOST
                      [--add name password role] [--delete DELETE]
                      [--setname old_name new_name]
                      [--setpassword name new_password]
                      [--setrole name new_role] [--enable ENABLE]
                      [--disable DISABLE] [--unlock UNLOCK]

A tool to manage user accounts on a Redfish service

required arguments:
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)

optional arguments:
  -h, --help            show this help message and exit
  --add name password role, -add name password role
                        Adds a new user account
  --delete DELETE, -delete DELETE
                        Deletes a user account with the given name
  --setname old_name new_name, -setname old_name new_name
                        Sets a user account to a new name
  --setpassword name new_password, -setpassword name new_password
                        Sets a user account to a new password
  --setrole name new_role, -setrole name new_role
                        Sets a user account to a new role
  --enable ENABLE, -enable ENABLE
                        Enables a user account with the given name
  --disable DISABLE, -disable DISABLE
                        Disabled a user account with the given name
  --unlock UNLOCK, -unlock UNLOCK
                        Unlocks a user account with the given name

该工具将使用用户密码参数提供的凭据登录到rhost参数指定的服务。 根据参数,它将显示、添加、删除或修改用户帐户。

  • add参数用于创建新的用户帐户
    • 示例:rf_acounts.py-u root-p root-r https://192.168.1.100-添加新名称新密码新角色
  • delete参数用于根据给定的用户名删除用户帐户
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-delete user_to_delete
  • setname参数用于更改用户帐户的名称
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-setname user_to_change new_name
  • setpassword参数用于更改用户帐户的密码
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-setpassword user_to_change new_password
  • setrole参数用于更改用户帐户的角色
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-setrole user_to_change new_role
  • enable参数用于启用用户帐户
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-启用用户更改
  • disable参数用于禁用用户帐户
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-禁用用户更改
  • unlock参数用于解锁用户帐户
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100-unlock user_to_change
  • 如果以上参数均未给出,则提供用户帐户表
    • 示例:rf_accounts.py-u root-p root-r https://192.168.1.100

更新

usage: rf_update.py [-h] --user USER --password PASSWORD --rhost RHOST --image
                    IMAGE [--target TARGET]

A tool to perform an update with a Redfish service

required arguments:
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)
  --image IMAGE, -i IMAGE
                        The URI or filepath of the image

optional arguments:
  -h, --help            show this help message and exit
  --target TARGET, -t TARGET
                        The target resource to apply the image

示例:rf_update.py-u root-p root-r https://192.168.1.100-i image.bin

该工具将使用用户密码参数提供的凭据登录到rhost参数指定的服务。 然后,它构建一个请求负载,使用image参数指定的映像对更新服务执行一个简单的更新操作。 如果尝试更新特定的系统、设备、管理器或其他资源,则在请求中使用可选的target参数。 请求简单更新后,它将监视更新的进度,并在更新完成后显示服务报告的有关更新的响应消息。

释放过程

  1. 使用自上次发布以来的更改列表更新changelog.md
  2. 更新setup.py以反映新版本
  3. 将更改推送到github并创建新版本
  4. 将新工具版本推送到pypi.org
    • python setup.py sdist
    • 捆绳上传距离/*

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
ArrayList Java中的搜索字符串   另一个web应用程序的java访问会话   另一个应用程序中的活动和服务之间的java通信   java根据Json字符串类型将Json字符串转换为对象   eclipse如何解决java中的错误异常。lang.NoSuchMethodError:'java。字符串javax。摆动JOptionPane。showInputDialog(java.lang.String)'   线程“main”java中的安卓异常。lang.NoClassDefFoundError:org/codehaus/jackson/JsonParseException   java如何在安卓 emulator上显示Mat图像?使用NDK   Java在本地读取测试源文件,但在服务器上读取失败   java dowhile循环用于计算输入数字中的数字。故障排除代码   JAva初学者在编写获取成本的方法时遇到困难   java是shell游戏。我如何让物体移动,特别是在特定的曲线上,但顺序是随机的?   java如何区分两个同名的JButton   java为什么我在Spring Boot中需要一个接口?   java将文件路径插入数据库将删除\   使用InterfaceType初始化java对象   java如何部署一个分为Angular、Spring Boot和MySQL的项目?   java如何使用Symja解决不等式?