Groups - solarwinds/OrionSDK GitHub Wiki
Orion Groups allow you to create arbitrary collections of managed entities. Once created, a group tracks the aggregate status of its members. A group is itself a managed entity, which means that groups can be nested.
Entities can be added to a group either statically or dynamically. A static group rule is a reference to a specific entity. A dynamic group rule is a pattern that is continuously reevaluated to determine which entities match and are therefore considered group members.
Orion Groups can be fully managed through the API. Within Orion, Groups are a specific type of the more general "container" system, so the API refers to them this way.
For a PowerShell example of group-related API calls, see Groups.ps1.
Groups are created using the Orion.Container.CreateContainer verb, which expects 7 arguments:
- Group name (string)
- Owner (string). This is not the user the group belongs to (groups do not have an owner in this sense), but rather the system component that manages the group. For our purposes, this should always be
Core. - Refresh interval in seconds (int). This is how often the group's status is recalculated. 60 is a reasonable value.
- Status rollup mode (int). 0 means "Mixed status shows warning", 1 means "Show worst status", and 2 means "Show best status". For more information about these modes, see the product documentation on that topic.
- Group description (string)
- Keep status history (boolean).
trueto store a history of the status values of this group orfalseto skip storing history. - Group members (array of
MemberDefinitionInfoobjects). See MemberDefinitionInfo below.
CreateContainer returns the ID of the new group (int).
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/CreateContainer
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
"Sample API group",
"Core",
60,
0,
"Group created by REST API request",
true,
[
{"Name": "Node 42", "Definition": "swis://my-orion-instance/Orion/Orion.Nodes/NodeID=42"},
{"Name": "Cisco gear", "Definition": "filter:/Orion.Nodes[Vendor='Cisco']"},
{"Name": "ATX", "Definition": "filter:/Orion.Nodes[CustomProperties.City='Austin']"}
]
]A MemberDefinitionInfo object is a simple object with two string properties: Name and Definition. Name is just a label and can be whatever you want. Definition must take one of two forms: a URI or a filter.
To create a static group member, use the SWIS URI of the entity as the definition. For example, to put the node with NodeID 42 in a group, use swis://my-orion-instance/Orion/Orion.Nodes/NodeID=42 as the definition. You can find the URI for any object in SWIS by querying to get its Uri property.
To create a dynamic group membership rule, specify a filter. These take the form:
filter:/entity type name[property=value]
When the value is a string, wrap it in single quotes, just as you would in a SWQL query. For example, to include all Cisco nodes in a group, use this filter rule:
filter:/Orion.Nodes[Vendor='Cisco']
You can use navigation properties in the filter rule. This is helpful for things like custom properties. To include all nodes in Austin in a group, use this filter rule:
filter:/Orion.Nodes[CustomProperties.City='Austin']
This is pretty simple in JSON. Here's what the three examples above look like:
[
{"Name": "Node 42", "Definition": "swis://my-orion-instance/Orion/Orion.Nodes/NodeID=42"},
{"Name": "Cisco gear", "Definition": "filter:/Orion.Nodes[Vendor='Cisco']"},
{"Name": "ATX", "Definition": "filter:/Orion.Nodes[CustomProperties.City='Austin']"}
]It's a bit more complex in XML. This is only necessary if you are working in PowerShell.
<ArrayOfMemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>
<MemberDefinitionInfo>
<Name>Node 42</Name>
<Definition>swis://my-orion-instance/Orion/Orion.Nodes/NodeID=42</Definition>
</MemberDefinitionInfo>
<MemberDefinitionInfo>
<Name>Cisco gear</Name>
<Definition>filter:/Orion.Nodes[Vendor='Cisco']</Definition>
</MemberDefinitionInfo>
<MemberDefinitionInfo>
<Name>ATX</Name>
<Definition>filter:/Orion.Nodes[CustomProperties.City='Austin']</Definition>
</MemberDefinitionInfo>
</ArrayOfMemberDefinitionInfo>To add a single member to an existing group, invoke the Orion.Container.AddDefinition verb. It expects two arguments:
- The container ID (int)
- A single
MemberDefinitionInfoobject
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/AddDefinition
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
13,
{ "Name": "Down applications", "Definition": "filter:/Orion.APM.Application[Status=2]" }
]To add multiple members to an existing group in a single operation, invoke the Orion.Container.AddDefinitions verb. It expects two arguments:
- The container ID (int)
- An array of
MemberDefinitionInfoobjects
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/AddDefinitions
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
13,
[
{ "Name": "A subgroup", "Definition": "swis://my-orion-instance/Orion/Orion.Groups/ContainerID=9" },
{ "Name": "Another subgroup", "Definition": "swis://my-orion-instance/Orion/Orion.Groups/ContainerID=10" }
]
]You can replace a group member definition using the Orion.Container.UpdateDefinition verb. It expects two arguments:
- The DefinitionID of the definition to update. You can find this with a SWQL query like
SELECT DefinitionID FROM Orion.ContainerMemberDefinition WHERE ContainerID=@containerID AND Name=@name. - A
MemberDefinitionInfoobject to replace the old one
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/UpdateDefinition
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
701,
{ "Name": "Austin nodes", "Definition": "filter:/Orion.Nodes[CustomProperties.City='Austin']" }
]To remove an existing group member definition from a group, invoke the Orion.Container.DeleteDefinition verb. It expects only one argument: the DefinitionID to remove.
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/DeleteDefinition
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
701
]To replace the entire set of group members in one operation, invoke the Orion.Container.SetDefinitions verb. It expects two arguments:
- The container ID (int)
- An array of
MemberDefinitionInfoobjects (the complete new membership list). All previous member definitions are discarded.
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/SetDefinitions
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
13,
[
{ "Name": "Austin Up Devices", "Definition": "filter:/Orion.Nodes[CustomProperties.City='Austin' AND Status=1]" },
{ "Name": "Critical Apps", "Definition": "filter:/Orion.APM.Application[Status=14]" }
]
]Note: This operation replaces the entire membership list. Any members not listed in the new array are removed from the group.
To change the properties of the group, invoke the Orion.Container.UpdateContainer verb. It expects 7 arguments:
- The container ID to modify
- Group name (string)
- Owner (string). Always use
Core(See Creating Groups). - Refresh interval in seconds (int)
- Status rollup mode (int)
- Group description (string)
- Keep status history (boolean)
See Creating Groups for more information about these parameters.
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/UpdateContainer
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
13,
"New Group Name",
"Core",
120,
1,
"Updated description text",
true
]To delete a group, invoke the Orion.Container.DeleteContainer verb. It expects a single argument: the container ID to delete.
https://{IP}:17774/SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/DeleteContainer
Headers
Authorization: Basic <base64(username:password)>
Content-Type: application/json
Body
[
13
]