RPC API Developer's Guide

Update 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 update device groups with updateHostGroup.

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

 

updateHostGroup

URL:
https://accountName.logicmonitor.com/santaba/rpc/updateHostGroup?id=175&name=test&description=test&alertEnable=true&parentId=1&propName0=property0name&propValue0=property0Value
 

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

Parameter

Type

Description

id Integer Required. The Id of the host group.
name String Required. The unique name of the host group
parentId Integer Optional. The Id of the host group that this host group should be a child of. The parentId is set to 1 for top level groups. This value defaults to 1.
opType String Optional. add|replace|refresh (default) add: Add a property with the given value to the host group. If the property already exists, no action is taken. (The value will not be changed.) replace: Add a property with the specified value if it does not exist, or update the property's value if it does exist. refresh: Replace all properties of the host group (including group membership) with the properties and values provided in the updateHostGroup call. Any properties not present in the refresh call will be deleted. (Inherited properties are not affected.)

Note: The opType parameter dictates how host group properties are changed. Add and Replace opType values refer only to the custom host group properties set by the propName, propValue fields (e.g. snmp.community, esx.user, jdbc.mssql.pass). Host Group properties such as name, description, alertEnable, and appliesTo must be specified in the request. If these are omitted they will be reset to a default or blank value.

description String Optional. The long text description
alertEnable Boolean Optional. true | false true: Enable alerts for hosts belonging to this host group false: Disable alerts for hosts belonging to this host group
propName{0..n} String Optional. The host group property name
propValue{0..n} String Required if propName is specified. The value corresponding to the property name

 

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/updateHostGroup?c=apiAccount&u=apiUser&p=example&id=53&name=MyDeviceGroup&opType=add&propName0=location&propValue0=12%20E%20Carrillo" 
Response:
{
  "status": 200,
  "data": {
    "alertEnable": true,
    "createdOn": 1447953230,
    "groupType": 0,
    "id": 53,
    "parentId": 1,
    "extra": "",
    "description": "",
    "appliesTo": "",
    "name": "MyDeviceGroup",
    "fullPath": "MyDeviceGroup",
    "effectiveAlertEnabled": true
  },
  "errmsg": "OK"
}