-
Notifications
You must be signed in to change notification settings - Fork 142
Groups
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 (no relationship to Docker containers!), so the API refers to them this way.
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).
true
to store a history of the status values of this group orfalse
to not. - Group members (array of
MemberDefinitionInfo
objects). Explained below.
CreateContainer
returns the ID of the new group (an int).
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 defintion. 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 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 needed 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>
Putting it all together, here's a complete request body for creating our group. POST this to /SolarWinds/InformationService/v3/Json/Invoke/Orion.Container/CreateContainer
.
[
"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']"}
]
]
For a PowerShell example of this and other group-related API calls, see Groups.ps1.
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
MemberDefinitionInfo
object
[
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
MemberDefinitionInfo
objects
[
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.UpdateDefintion
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
MemberDefintionInfo
object to replace the old one
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.
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 above.) - Refresh interval in seconds (int)
- Status rollup mode (int)
- Group description (string)
- Keep status history (boolean)
See the section on creating groups for more information about these parameters.
To delete a group, invoke the Orion.Container.DeleteContainer
verb. It expects a single argument: the container ID to delete.
- About SWIS
- Connecting to SWIS
- SWQL Functions
- REST
- PowerShell
- Alerts
- Creating custom properties
- Poller Types
- Network Performance Monitor
- NetFlow Traffic Analyzer
- Network Configuration Manager
- IP Address Manager
- Server & Application Monitor
- Log Analyzer
- Schema reference