RPC API Developer's Guide

Add a Device

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

LogicMonitor's RPC API enables you to programmatically add devices to your account with the addHost request.

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

 

addHost

URL:
https://accountName.logicmonitor.com/santaba/rpc/addHost?c=accountName&u=user&p=password&hostName=uniqueHostName&displayedAs=displayName&description=optionalDescription&alertEnable=true|false&agentId=agentIdNum&hostGroupIds=hostGroupId1,hostGroupId2&propName0=property0Name&propValue0=property0Value&propName1=property1Name&propValue1=property1Value

 

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

Parameter

Type

Description

hostName String Required. The IP address or name of the device
displayedAs String Required. The display name of the device
agentId String Required. The unique id of the collector that will monitor the device. Collector Ids are displayed in your account UI (Settings | Collectors).
hostGroupIds String Optional. The unique id(s) of the Device Groups this Device will belong to, where multiple values should be separated by commas. You cannot set hostGroupIds=1, but omitting the hostGroupIds parameter will result in LogicMonitor automatically placing the device in the root group of your account OR in a dynamic group for which it fits the criteria.

 


To get a deviceGroupId in the UI: navigate to the group in the device tree, select the focus icon to focus on the group & the id is displayed at the end of the URL as dg-##.

description String Optional. The optional device description
link String Optional. The HTTP Link to the device
alertEnable Boolean Optional. true | false

true: Alerts will be enabled for the device
false: Alerts will be disabled for the device

propName{0..n} String Optional. The Device Property Name
propValue{0..n} String Required if propName is specified. The Device Property 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 includes the following:

Value

Description

allHostGroups The device Groups the added device is in
netflowAgentId The ID of the netflow agent of the added device. Defaults to 0 if non-netflow device
displayedAs The Display Name of the added device
link The HTTP Link to the added device
hgIds The device Groups the added device is in. (Does not include root group)
lastrawdatatime/lastdatatime The last time (epoch format) since the device got Netflow (raw) data
agentId The ID of the Collector monitoring the added device
id The ID of the device
createdOn The epoch time stamp when the device was added
alertEnable Boolean value that indicates whether the added device has alerting enabled
isActive

Boolean value: 

If this value is true, the device has been updated in the past hour.
If this value is false, the Host has not been updated in the past hour.

autoPropsUpdatedOn The last time (epoch) properties were updated
description The description of the added device
name The display name of the added device
hostname The hostname of the added device
autoPropsAssignedOn The assignment time (epoch) of the device properties
updatedOn The last time the added device was updated (epoch)
enableNetflow Boolean value that indicates whether netflow is enabled or not

 

Example

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/addHost?c=apiAccount&u=apiUser&p=example&hostName=10.0.1.36&displayedAs=MyDevice&agentId=85&propName0=snmp.community&propValue0=notPublic" 
Response:
{
  "status": 200,
  "data": {
    "allHostGroups": [
      1,
      29
    ],
    "relatedDeviceId": -1,
    "netflowAgentId": 0,
    "displayedAs": "MyDevice",
    "link": "",
    "hgIds": "",
    "lastrawdatatime": 0,
    "agentId": 85,
    "scanConfigId": 0,
    "deletedOnMillis": 0,
    "groupd": false,
    "id": 208,
    "createdOn": 1447886410,
    "alertEnable": true,
    "isActive": true,
    "lastdatatime": 0,
    "toDeleteOnMillis": 0,
    "autoPropsUpdatedOn": 0,
    "deviceType": 0,
    "description": "",
    "name": "MyDevice",
    "hostName": "10.0.1.36",
    "autoPropsAssignedOn": 0,
    "updatedOn": 1447886410,
    "enableNetflow": false
  },
  "errmsg": "OK"
}