pw group
To view group information, run the following command: pw group
Example:
Because the child group name is duplicated, if you want to edit, list, or delete the child group that is under the parent group, you must specify the path as /parent/child.
If the group name is unique, you need to specify only the group name to edit, list, or delete the group. For example, to edit the test group in the example, you only need to specify test because the test group name is unique.
The following are the available pw group commands:
- pw group add
- pw group delete
- pw group device_add
- pw group device_delete
- pw-group-list
- pw group add_subgroup
- pw group delete_subgroup
- pw group add_rule_based groups
- pw group edit_rule_based groups
- pw-group-add_monitor
- pw-group-delete_monitor
pw group add
The pw group add command adds a group to the Group Matrix folder. If required, add a description for the group that you are creating.
pw group add <group_name>
To add a group test1, with a description testing and tag value new_groups, run the following command:
<group_description>—Description of the group that you create
<tag value> — The tag value specified are associated with the group being created
pw group delete
The pw group delete command deletes the group specified from the Group Matrix folder and the rule-based groups.
To delete a group, run the following command:
pw group delete <group name>
Example: pw group delete test
The command deletes a group called "test."
pw group device_add
Use the pw group device_add command to add a device to an existing group in the Infrastructure Management system.
Device_name is the actual name of the device used in Infrastructure Management. The IP address of the device cannot be used as device_name. If the group specified does not exist, the system returns a bad status code and an appropriate message. Adding the device causes all monitors under that device to be added to the group (and the device).
pw group device_add <group name> <device Name1> [device Name2]...[device NameN]
For example, to add devices "test1" and "test2" to a group called "test," run the following command:
pw group device_delete
The pw group device_delete command deletes devices from the group specified. Deleting a device causes all monitors under that device to be deleted from the group, including the device.
pw group device_delete <group name> <device Name1> [device Name2]...[device NameN]
For example, to delete devices "test1" and "test2" from a group called "test," run the following command:
pw group device_delete test test1 test2
pw group add_subgroup
The pw group add_subgroup command adds the specified group as a subgroup to the specified parent group.
Adding subgroups to an existing parent group is allowed if the parent group contains other groups or if the parent group is empty.
pw group add_subgroup -p <parent_group>[-d <group_description>] -c <child_group1>[-c <child_group2> -c <child_group3>]
For example:
- To add a subgroup named "child" to an existing parent group named "parent," run the following command:
pw group add_subgroup -p parent -c child - To add a set of subgroups called as "child1," "child2," and "child3" to a parent group "parent," run the following command:
Use the [-d <group_description>] option only when you are creating a parent group.
pw group delete_subgroup
The pw group delete_subgroup command deletes the group specified from the parent.
For example: To delete subgroup1 from parent1, run the following command:
pw group delete_subgroup -p <parent_group> -c <child_group>
When more than one group have same subgroup name, you must specify the full path. For example, if group1 and group2 have the same subgroup name "child", then you must specify the following path:
group1/parent1/child and group1/parent2/child.
The following scenarios exists for the subgroups with the same name in more than one group:
- If the subgroup has same group instance (same ID) under two different parent groups, then the pw group delete_subgroup -p /group1/parent1 -c child command will work and the following message is displayed:
Successfully removed subgroup "child" from parent "/group1/parent1" - If the subgroup has different group instances (different IDs) under two different parent groups, then the pw group delete_subgroup -p /group1/parent1 -c child command will not work and the following message is displayed:
Multiple instances of Group Name, use full path for Group Name
The pw group delete_subgroup command does not delete the group. The command only removes the parent-child relationship. When removing subgroups from parent groups after all the parent groups are removed, the subgroup will be at the top-level group.
To delete a group at the top level or at the child node, you must run the following pw group delete command:
pw group delete /group1/parent1/child
pw group delete /group1/parent/child
This command deletes the group from the database
pw group add_rule_based groups
Groups can also be created by specifying rules; these groups are known as rule-based groups. Rule-based groups are dynamic groups. Run the following command to add rule based groups:
pw group add_ rule_based <groupName>[-d <description>][-tag <tag_value>]-configuration <group|device|monitor> -name_pattern "<pattern_string>" -tag_pattern "<pattern_string>"[-p <parent group name> -dp <description for parent group>][-mtype <mtype_name1>-mtype<mtype_name2> ...... -mtype <mtype_nameN>]
pw group edit_rule_based groups
Run the following command to edit rule-based groups:
pw group edit_ rule_based <groupName>[-d <description>][-tag <tag_value>] -configuration < group|device|monitor > -name_pattern "<pattern_string>" -tag_pattern "<pattern_string>" [-p <parent group name> -dp <description for parent group> -add_mtype <mtype_name1> -add_mtype <mtype_nameN> -add_mtype all|-remove_mtype <mtype_name1> -remove_mtype <mtype_nameN> -remove_mtype all ]
<groupName>—This option allows you specify a name (maximum length of 60 characters with no spaces) for the new group.
<group|device>—This option allows you to choose between group name or device name. This option is mandatory.
Tag <pattern_string>—This option allows you to specify multiple name-value pairs, text, or both (name-value pair and text) and allows you specify group objects in different forms. Special characters &"/<>' in the tag field are not allowed.
Name <pattern_string>—Instances belonging to any of the matching groups or devices will automatically be included as the members of this group. This supports all the Java Regular Expression pattern matches.
<mtype_nameN>—This option allows you to specify the monitor types that must be associated with the group. If the -mtype option is not present, by default, all monitor types will be considered.
Tag <tag_value>—This option allows you to provide a tag value to the group.
-p <parent group name>—This option allows you to add a rule-based group as a subgroup of another group. If the parent group does not exist and if it is not a subgroup itself, then the parent group will be created and the rule based group will be added to it. Provide the absolute path separated by a slash in case of hierarchical parent group. If the rule based group is to be added to a hierarchical parent group, then that hierarchical parent group must exist.
dp <description for parent group>—This option allows you to add a description to the parent group. The description will be added only if the parent group does not exist.
-add_mtype <mtype_nameN>—This option is valid only for editing a rule based group. This option allows you to add new monitor types that have instances. This option also accepts all as the value, which selects all monitor types that have instances present in the computer.
-remove_mtype <mtype_nameN>—This option is valid only for editing a rule based group. This option allows you to remove existing monitor types from the group. This option also accepts all as the value, which removes all the existing monitor types from a group.