RPC API Developer's Guide

Get Devices

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

LogicMonitor's RPC API enables you to programmatically retrieve details for devices in your account with the getHost and getHosts requests.

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

 

getHost

URL:
https://accountName.logicmonitor.com/santaba/rpc/getHost?c=accountName&u=user&p=password&displayName=hostDisplayName

 

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

Parameter

Type

Description

displayName String Required. The display name of the Host

 

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

displayedAs The Display Name of the added device
netflowAgentId The ID of the netflow agent of the added device. Defaults to 0 if non-netflow device
link The HTTP Link to the added device
type The Logicmonitor entity: "HOST"
alertEnable Boolean identifier if the added device has alerting enabled
id The Unique ID of the added device
autoPropsUpdatedOn The last time (epoch) properties were updated
updatedOn The last time the added device was updated (epoch)
status The status of the device, where possible status values include:
[normal | dead | alert-confirmed | alert-noconfirmed]
agentDescription The description of the Collector monitoring this device
agentId The ID of the Collector monitoring the added device
lastrawdatatime/lastdatatime The last time (epoch format) since the device got (raw) Netflow data
inSDT Boolean value that indicates the device's SDT status
properties A list of device property names and their values
createdOn The epoch time stamp when the device was added
isActive

Boolean value: 

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

autoPropsAssignedOn The assignment time (epoch) of the device properties
enableNetflow Boolean value that indicates whether netflow is enabled or not
fullPathinIDs This object contains an entry for each device Group the device belongs to, where the full path is displayed for each device group. E.g. if fullPathinIDs=[[2],[7],[2,3,4],[29,8]] the device is in groups 2, 7, 4 and 8, and we are providing you with the additional context that groups 4 and 8 are subgroups.

 

Example

Note that the lastdatatime attribute only refers to Netflow data. To retrieve the time any datasource data was collected for a host, use the getData RPC.

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/getHost?c=apiAccount&u=apiUser&p=example&displayName=MyDevice" 
Response:
{
  "status": 200,
  "data": {
    "displayedAs": "MyDevice",
    "netflowAgentId": 0,
    "relatedDeviceId": -1,
    "link": "",
    "type": "HOST",
    "alertEnable": true,
    "id": 208,
    "autoPropsUpdatedOn": 1447886531,
    "toDeleteOnMillis": 0,
    "description": "",
    "deviceType": 0,
    "name": "MyDevice",
    "hostName": "10.0.1.36",
    "autoPropsAssignedOn": 1447886410,
    "updatedOn": 1447886410,
    "status": "alert-noconfirmed",
    "agentDescription": "ip-172-31-37-162.us-west-2.compute.internal",
    "agentId": 85,
    "lastrawdatatime": 0,
    "properties": {
      "system.db.db2": "",
      "system.virtualization": "",
      "system.collectorid": "85",
      "system.devicetype": "0",
      "system.hostname": "10.0.1.36",
      "system.sysinfo": "",
      "system.categories": "",
      "system.db.mysql": "",
      "system.enablenetflow": "false",
      "system.groups": "US - LA",
      "netapp.ssl": "true",
      "system.prefcollectorid": "85",
      "system.sysoid": "",
      "snmp.community": "********",
      "system.db.mssql": "",
      "system.db.oracle": "",
      "system.ips": "10.0.1.36",
      "system.displayname": "MyDevice",
      "system.description": ""
    },
    "inSDT": false,
    "scanConfigId": 0,
    "deletedOnMillis": 0,
    "effectiveAlertEnabled": true,
    "isActive": false,
    "createdOn": 1447886410,
    "lastdatatime": 0,
    "fullPathInIds": [[29]],
    "enableNetflow": false
  },
  "errmsg": "OK"
} 

 

getHosts

URL:
https://accountName.logicmonitor.com/santaba/rpc/getHosts?c=accountName&u=user&p=password&hostGroupId=hostGroupIdNum

 

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

Parameter

Type

Description

hostGroupId String Required. The unique Id of the host group to retrieve host details from. hostGroupId values can be retrieved using getHostGroups(). Setting hostGroupId = 1 will return all hosts. 

To get a hostGroupId in the UI: navigate to the group & select the focus icon - the id is in the URL. In the new UI it is displayed in the URL as dg-##.

 

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

displayedAs The Display Name of the added device
netflowAgentId The ID of the netflow agent of the added device. Defaults to 0 if non-netflow device
link The HTTP Link to the added device
type The Logicmonitor entity: "HOST"
alertEnable Boolean identifier if the added device has alerting enabled
id The Unique ID of the added device
autoPropsUpdatedOn The last time (epoch) properties were updated
updatedOn The last time the added device was updated (epoch)
status The status of the device, where possible status values include:
[normal | dead | alert-confirmed | alert-noconfirmed]
agentDescription The description of the Collector monitoring this device
agentId The ID of the Collector monitoring the added device
lastrawdatatime/lastdatatime The last time (epoch format) since the device got (raw) Netflow data
inSDT Boolean value that indicates the device's SDT status
properties A list of device property names and their values
createdOn The epoch time stamp when the device was added
isActive

Boolean value: 

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

autoPropsAssignedOn The assignment time (epoch) of the device properties
enableNetflow Boolean value that indicates whether netflow is enabled or not
fullPathinIDs The device Groups this device belongs to

 

Example

Request:
curl "https://apiAccount.logicmonitor.com/santaba/rpc/getHosts?c=apiAccount&u=apiUser&p=example&hostGroupId=38" 
Response:
{
  "status": 200,
  "data": {
    "hostgroup": {
      "alertEnable": true,
      "createdOn": 1441044919,
      "groupType": 0,
      "id": 38,
      "parentId": 1,
      "extra": "",
      "description": "",
      "appliesTo": "system.aws.tagProject=~\"LogicMonitor\"",
      "name": "CloudFormation",
      "properties": {
        "system.categories": "",
        "netapp.ssl": "true"
      },
      "fullPath": "CloudFormation"
    },
    "hosts": [
      {
        "displayedAs": "US-W2:SuperKittenBalancer",
        "netflowAgentId": 0,
        "relatedDeviceId": -1,
        "link": "",
        "type": "HOST",
        "alertEnable": true,
        "id": 184,
        "autoPropsUpdatedOn": 1447807408,
        "toDeleteOnMillis": 0,
        "description": "Discovered by Cloud Collector",
        "deviceType": 2,
        "name": "US-W2:SuperKittenBalancer",
        "hostName": "us-west-2:elb:SuperKittenBalancer-42",
        "autoPropsAssignedOn": 1447807390,
        "updatedOn": 1441992700,
        "status": "normal",
        "agentDescription": "ip-172-31-37-162.us-west-2.compute.internal",
        "agentId": 85,
        "lastrawdatatime": 0,
        "properties": {
          "system.aws.region": "us-west-2",
          "system.aws.resourceid": "SuperKittenBalancer",
          "system.db.db2": "",
          "aws.accesskey": "******",
          "system.aws.listenerDescriptions": "[{\"protocol\":\"HTTP\",\"loadBalancerPort\":80,\"instanceProtocol\":\"HTTP\",\"instancePort\":80}]",
          "system.aws.createdTime": "1434142405010",
          "system.aws.dNSName": "SuperKittenBalancer-1346143187.us-west-2.elb.amazonaws.com",
          "system.aws.interval": "30",
          "system.aws.endpoint": "elasticloadbalancing.us-west-2.amazonaws.com",
          "system.aws.target": "HTTP:80/morekittens.html",
          "system.devicetype": "2",
          "system.collectorid": "85",
          "system.sysinfo": "",
          "system.enablenetflow": "false",
          "system.aws.subnets": "[[\"subnet-3be73862\",\"subnet-8b5fe7fc\",\"subnet-d4a832b1\"]]",
          "system.prefcollectorid": "85",
          "system.groups": "AWS/Load Balancers,CloudFormation,US - LA",
          "system.db.mssql": "",
          "system.aws.availabilityZones": "[[\"us-west-2a\",\"us-west-2b\",\"us-west-2c\"]]",
          "system.db.oracle": "",
          "system.ips": "",
          "system.description": "Discovered by Cloud Collector",
          "system.aws.scheme": "internet-facing",
          "system.aws.unhealthyThreshold": "2",
          "system.virtualization": "",
          "system.aws.canonicalHostedZoneName": "SuperKittenBalancer-1346143187.us-west-2.elb.amazonaws.com",
          "system.hostname": "us-west-2:elb:SuperKittenBalancer-42",
          "system.aws.instances": "[\"i-12bbc3e4\",\"i-b3611945\",\"i-ca784b3c\"]",
          "system.aws.monitoringstate": "1",
          "aws.accesskeyid": "AKIAI7LRHIS7N33P5YTA",
          "aws.accountid": "000466242064",
          "system.categories": "AWS/ELB",
          "system.aws.tag.Project": "LogicMonitor",
          "system.db.mysql": "",
          "system.aws.healthyThreshold": "10",
          "netapp.ssl": "true",
          "system.aws.canonicalHostedZoneNameID": "Z33MTJ483KN6FU",
          "system.sysoid": "",
          "system.aws.vPCId": "vpc-1992107c",
          "system.aws.timeout": "5",
          "system.displayname": "US-W2:SuperKittenBalancer"
        },
        "inSDT": false,
        "scanConfigId": 18,
        "deletedOnMillis": 0,
        "effectiveAlertEnabled": true,
        "isActive": false,
        "createdOn": 1441992700,
        "lastdatatime": 0,
        "fullPathInIds": [
          [
            39,
            42
          ],
          [38],
          [29]
        ],
        "enableNetflow": false
      },
      {
        "displayedAs": "US-W2:i-b3611945",
        "netflowAgentId": 0,
        "relatedDeviceId": -1,
        "link": "",
        "type": "HOST",
        "alertEnable": true,
        "id": 190,
        "autoPropsUpdatedOn": 1447883008,
        "toDeleteOnMillis": 0,
        "description": "Discovered by Cloud Collector",
        "deviceType": 2,
        "name": "US-W2:i-b3611945",
        "hostName": "us-west-2:ec2:i-b3611945-41",
        "autoPropsAssignedOn": 1447882989,
        "updatedOn": 1441992700,
        "status": "normal",
        "agentDescription": "ip-172-31-37-162.us-west-2.compute.internal",
        "agentId": 85,
        "lastrawdatatime": 0,
        "properties": {
          "system.aws.resourceid": "i-b3611945",
          "system.aws.vpcId": "vpc-1992107c",
          "system.aws.publicIpAddress": "52.24.214.157",
          "system.aws.instanceType": "t2.micro",
          "system.aws.endpoint": "ec2.us-west-2.amazonaws.com",
          "system.aws.privateIpAddress": "172.31.37.162",
          "system.aws.ebsOptimized": "false",
          "system.aws.architecture": "x86_64",
          "system.sysinfo": "",
          "system.aws.amiLaunchIndex": "0",
          "system.enablenetflow": "false",
          "system.groups": "AWS/EC2,CloudFormation,US - LA",
          "system.prefcollectorid": "85",
          "system.aws.availabilityZone": "us-west-2b",
          "system.aws.securityGroups": "[{\"groupId\":\"sg-eb425e8e\",\"groupName\":\"Web Webinar\"}]",
          "system.ips": "",
          "system.aws.subnetId": "subnet-8b6fe7fc",
          "system.virtualization": "",
          "system.aws.monitoring": "disabled",
          "system.aws.blockDeviceMappings": "[{\"volumeId\":\"vol-bdd2aeaf\",\"deviceName\":\"/dev/xvda\",\"status\":\"attached\",\"attachTime\":1431535860000,\"deleteOnTermination\":false}]",
          "aws.accesskeyid": "AKIAI7DDHIS7N35P5YTA",
          "system.aws.privateDnsName": "ip-172-31-37-162.us-west-2.compute.internal",
          "system.aws.stateName": "running",
          "system.aws.region": "us-west-2",
          "system.db.db2": "",
          "aws.accesskey": "******",
          "system.devicetype": "2",
          "system.collectorid": "85",
          "system.aws.imageId": "ami-e7527ed7",
          "system.aws.sourceDestCheck": "true",
          "system.aws.keyName": "AWSWebinar",
          "system.aws.publicDnsName": "ec2-52-24-214-157.us-west-2.compute.amazonaws.com",
          "system.aws.hypervisor": "xen",
          "system.db.mssql": "",
          "system.db.oracle": "",
          "system.description": "Discovered by Cloud Collector",
          "system.aws.rootDeviceName": "/dev/xvda",
          "system.aws.launchTime": "1431535856000",
          "system.aws.rootDeviceType": "ebs",
          "system.hostname": "us-west-2:ec2:i-b3611945-41",
          "system.aws.virtualizationType": "hvm",
          "system.aws.monitoringstate": "1",
          "aws.accountid": "000466233364",
          "system.categories": "AWS/EC2",
          "system.aws.tag.Project": "LogicMonitor",
          "system.db.mysql": "",
          "netapp.ssl": "true",
          "system.aws.stateCode": "16",
          "system.sysoid": "",
          "system.displayname": "US-W2:i-b3611945"
        },
        "inSDT": false,
        "scanConfigId": 17,
        "deletedOnMillis": 0,
        "effectiveAlertEnabled": true,
        "isActive": false,
        "createdOn": 1441992700,
        "lastdatatime": 0,
        "fullPathInIds": [
          [
            39,
            41
          ],
          [38],
          [29]
        ],
        "enableNetflow": false
      }
    ]
  },
  "errmsg": "OK"
}