RPC API Developer's Guide

Add a Device Group

Note that LogicMonitor does have an available REST API equivalent for this API call.

Device groups are LogicMonitors way of visually and logically organizing your monitored infrastructure.  LogicMonitor's RPC API enables you to programmatically add device groups with addHostGroup.

Note: As with all our API calls, authentication is required.

 

addHostGroup

URL:
https://accountName.logicmonitor.com/santaba/rpc/addHostGroup?name=hostGroupName&description=hostGroupDescription&dGroup=trueOrFalse&appliesTo=appliesTo&alertEnable=trueOrFalse&propName0=property0name&propValue0=property0value&propName1=property1name&propValue1=property1value0&parentId=1

 

Request Parameters: You can include the following as query parameters in an addHostGroup request:

Parameter

Type

Description

name String Required. The name of the device group.
description String Optional. The long text description of the device group.
dGroup Boolean Optional. true | false (default) true: Enable dynamic grouping for the device group false: Disable dynamic grouping for the device group
appliesTo String Optional. The string defining the dynamic grouping if dGroup set to true. Defaults to empty. When defining this string, use URL encoding. For example, use %3D to represent the equals (=) sign.
alertEnable Boolean Optional. true (default) | false true: Enable alerting for devices belonging to the device group. false: Disable alerting for the devices belonging to the device group.
propName{0..n} String Optional. The name of the property to be set for the device group.
propValue{0..n} String Optional. The value corresponding to the propName
parentId Integer Optional. The Id of the parent device group. Defaults to 1 (top level).

 

All outputs will be in the format: { [status], [data], [errmsg] }, where status is the status of the response, errmsg is the error message associated with the response and the data object incldues the following:

Value

Description

numOfHosts The count of the devices in the created group. Will usually be 0 unless the group is dynamic.
Status The status of the device group.
inSDT If the host group is currently placed in SDT
type If the group is a host group or dynamic group
id The Id of the newly created host group.
createdOn The unix time (epoch) that this host group was created
alertEnabled Whether or not alerting is enabled for this host group.
parentId The id of the parent host group.
description The long text description of the host group.
name The name of the host group.
appliesTo The definition of the hosts that will be dynamically added to this group. Empty unless dynamic group. When defining this string, use URL encoding. For example, use %3D to represent the equals (=) sign.
fullPath A string representing the path to the group

 

Example

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/addHostGroup?c=apiAccount&u=apiUser&p=example&name=MyDeviceGroup&propName0=snmp.community&propValue0=notPublic" 
Response:
{
  "status": 200,
  "data": {
    "groupType": 0,
    "numOfHosts": 0,
    "status": "normal",
    "extra": "",
    "signaled": false,
    "inSDT": false,
    "type": "HOSTGROUP",
    "inNSP": false,
    "effectiveAlertEnabled": true,
    "id": 53,
    "createdOn": 1447953230,
    "alertEnable": true,
    "parentId": 1,
    "description": "",
    "name": "MyDeviceGroup",
    "appliesTo": "",
    "fullPath": "MyDeviceGroup"
  },
  "errmsg": "OK"
}