RPC API Developer's Guide

Get Device Groups

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 view details for device groups with getHostGroup, getHostGroups and getHostGroupChildren.

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

 

getHostGroup

URL:
https://accountName.logicmonitor.com/santaba/rpc/getHostGroup?hostGroupId=175&onlyOwnProperties=trueOrFalse

 

Request Parameters: You can include the following as query parameters in a getHostGroup request:

Parameter

Type

Description

hostGroupId Integer Required. The Id number of the host group.
onlyOwnProperties Boolean Optional. true | false (default) true: Properties inherited from the parent group(s), including properties set at the global level, will not be returned in the results. false: Inherited properties will be returned in the results.

 

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

alertEnable Whether alerting is enabled on the host group. Please note: when alerting is disabled at a parent group, alerting will be effectively turned off but not shown in this field.
createdOn The unix timestamp of the creation of this host group
id The host group id. This should match with the id in the request.
parentId The Id of this groups parent group. If the group is at the top level the parentId will be 1.
description The long text description of the group.
appliesTo Will be empty unless this group is a dynamic group. Defines the hosts that will be added to a dynamic group. When defining this string, use URL encoding. For example, use %3D to represent the equals (=) sign.
name The group name as it appears in your LogicMonitor account.
properties A JSON list of the properties set on the host group. If onlyOwnProperties is set to true, this list will ignore any inherited properties.
fullPath The full path of the host group according to the host tree structure in your LogicMonitor account.

 

Example

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/getHostGroup?c=apiAccount&u=apiUser&p=example&hostGroupId=53&onlyOwnProperties=true"
Response:
  {
  "status": 200,
  "data": {
    "alertEnable": true,
    "createdOn": 1447953230,
    "groupType": 0,
    "id": 53,
    "parentId": 1,
    "extra": "",
    "description": "",
    "appliesTo": "",
    "name": "MyDeviceGroup",
    "properties": [{
      "name": "snmp.community",
      "value": "********"
    }],
    "fullPath": "MyDeviceGroup"
  },
  "errmsg": "OK"
} 

 

getHostGroups

URL:
https://accountName.logicmonitor.com/santaba/rpc/getHostGroups

 

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 includes:

Value

Description

alertEnable Whether alerting is enabled on the host group. Please note: when alerting is disabled at a parent group, alerting will be effectively turned off but not shown in this field.
createdOn The unix timestamp of the creation of this host group
id The host group id. This should match with the id in the request.
parentId The Id of this groups parent group. If the group is at the top level the parentId will be 1.
description The long text description of the group.
appliesTo Will be empty unless this group is a dynamic group. Defines the hosts that will be added to a dynamic group. When defining this string, use URL encoding. For example, use %3D to represent the equals (=) sign.
name The group name as it appears in your LogicMonitor account.
fullPath The full path of the host group according to the host tree structure in your LogicMonitor account.

 

Example

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/getHostGroups?c=apiAccount&u=apiUser&p=example"
Response:
  {
  "status": 200,
  "data": [
    {
      "alertEnable": true,
      "createdOn": 1424127893,
      "groupType": 0,
      "id": 2,
      "parentId": 1,
      "description": "",
      "appliesTo": "",
      "name": "Production",
      "fullPath": "Production"
    },
    {
      "alertEnable": true,
      "createdOn": 1424127904,
      "groupType": 0,
      "id": 3,
      "parentId": 2,
      "description": "",
      "appliesTo": "",
      "name": "Network",
      "fullPath": "Production/Network"
    },.........
    ...........
    ........... {
      "alertEnable": true,
      "createdOn": 1445892875,
      "groupType": 0,
      "id": 52,
      "parentId": 1,
      "extra": "",
      "description": "",
      "appliesTo": "",
      "name": "XYZ Co.",
      "fullPath": "XYZ Co."
    },
    {
      "alertEnable": true,
      "createdOn": 1434657446,
      "groupType": 0,
      "id": 29,
      "parentId": 1,
      "extra": "",
      "description": "",
      "appliesTo": "!system.sysinfo && !system.sysoid && !(system.categories =~ \"AWS\")",
      "name": "US - LA",
      "fullPath": "US - LA"
    }
  ],
  "errmsg": "OK"
}

 

getHostGroupChildren

URL:
https://accountName.logicmonitor.com/santaba/rpc/getHostGroupChildren?hostGroupId=175

 

Request Parameters: You can include the following as query parameters in a getHostGroupChildren request:

Parameter

Type

Description

hostGroupId Integer Required. The Id number of the host group.

 

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 includes an object items and an object group.  The items object lists the child groups & the group object contains information about the requested device groups.

Example

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/getHostGroupChildred?c=apiAccount&u=apiUser&p=example&hostGroupId=2"
Response:
  {
  "status": 200,
  "data": {
    "items": [
      {
        "groupType": 0,
        "numOfHosts": 1,
        "status": "alert-noconfirmed",
        "extra": "",
        "signaled": true,
        "inSDT": false,
        "type": "HOSTGROUP",
        "inNSP": false,
        "effectiveAlertEnabled": true,
        "id": 33,
        "createdOn": 1435879779,
        "alertEnable": true,
        "parentId": 2,
        "description": "",
        "name": "Databases",
        "appliesTo": "",
        "fullPath": "Production/Databases"
      },
      {
        "alertEnable": true,
        "createdOn": 1424127904,
        "groupType": 0,
        "id": 3,
        "parentId": 2,
        "numOfHosts": 1,
        "status": "alert-noconfirmed",
        "description": "",
        "appliesTo": "",
        "name": "Network",
        "signaled": true,
        "inSDT": false,
        "fullPath": "Production/Network",
        "type": "HOSTGROUP",
        "inNSP": false,
        "effectiveAlertEnabled": true
      },
      {
        "alertEnable": true,
        "createdOn": 1424128239,
        "groupType": 0,
        "id": 4,
        "parentId": 2,
        "numOfHosts": 5,
        "status": "normal",
        "description": "",
        "appliesTo": "",
        "name": "Servers",
        "signaled": false,
        "inSDT": false,
        "fullPath": "Production/Servers",
        "type": "HOSTGROUP",
        "inNSP": false,
        "effectiveAlertEnabled": true
      }
    ],
    "group": {
      "alertEnable": true,
      "createdOn": 1424127893,
      "groupType": 0,
      "id": 2,
      "parentId": 1,
      "numOfHosts": 7,
      "status": "alert-noconfirmed",
      "description": "",
      "appliesTo": "",
      "name": "Production",
      "signaled": true,
      "inSDT": false,
      "fullPath": "Production",
      "type": "HOSTGROUP",
      "inNSP": false,
      "effectiveAlertEnabled": true
    }
  },
  "errmsg": "OK"
}