RPC API Developer's Guide

Add SDTs

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

Scheduled Down Time (SDT) allows you to suppress alert notifications for a specific time period: daily, weekly, or monthly. LogicMonitor's RPC API allows you to programmatically manage SDTs for:

  • Devices
  • Device Groups
  • Device Datasources
  • Device Datasource Instances
  • Device Datasource Instance Groups
  • Collectors

You can use setSDT to add an SDT for one of the above entities.

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

 

URL:
https://accountName.logicmonitor.com/santaba/rpc/set{Entity}SDT?agentId=agentIdNum&id=0&type=typeNum1&year=startYear&month=startMonth&day=startDay&hour=startHour&minute=startMinute&endYear=endYear&endMonth=endMonth&endDay=endDay&endHour=endHour&endMinute=endMinute

where {Entity} must be:

  • Host
  • HostGroup
  • HostDataSource
  • DataSourceInstance
  • HostDataSourceInstanceGroup
  • Agent

 

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

Parameter

Type

Description

hostGroupId Integer Required for setHostGroupSDT. Sets a SDT for a specific host group.
To get a hostGroupId in the UI: navigate to the group & the id is in the URL. In the new UI it is displayed in the URL as dg/##.

hostId Integer One of host and hostId are required for setHostSDT. Sets a SDT for a specific host. To get a hostId in the UI: navigate to the group & the id is in the URL. In the new UI it is displayed in the URL as d/##.
host String One of host and hostId are required for setHostSDT. Sets a SDT for a specific host.
hostDataSourceId Integer
Required for setHostDataSourceSDT and setDataSourceInstanceGroupSDT. Sets a SDT for all instances of a datasource on one host.
dataSourceInstanceId Integer
Required for set setDataSourceInstanceSDT. Sets a SDT for an instance. The dataSourceInstance Id can be retrieved with getDataSourceInstances() (see information below this table).
dataSourceInstanceGroupID Integer
Required for setDataSourceInstanceGroupSDT. Sets a SDT for an instance group. This value can be retrieved with getDataSourceInstanceGroup() (see information below this table.)
agentId Integer Required for setAgentSDT. Sets a SDT for a specific collector. Collector Ids can be found in your account UI (Settings | Collectors).
id Integer Optional. An id of 0 indicates a new SDT. A non-zero id can be specified to update an existing SDT. The id value will default to 0 if it is not specified.
type Integer Required. The type of SDT
1 = One Time, 2 = Weekly, 3 = Monthly, 4=Daily
year Integer Required if type=1. The year to start SDT.
month Integer Required if type=1. The month to start SDT.
*Note that January = 0, December = 11
day Integer Required if type=1. The day to start SDT.
hour Integer Required.The hour to start SDT.
minute Integer Required. The minute to start SDT. Required for all SDT types.
endYear Integer Required if type=1. The year to end SDT.
endMonth Integer Required if type=1. The month to end SDT.
*Note that January = 0, December = 11
endDay Integer Required if type=1. The day to end SDT.
endHour Integer Required. The hour to end SDT Required for all SDT types.
endMinute Integer Required. The minute to end SDT.
weekDay Integer Required if type=2. The day of the week to start SDT.
*Note Sunday = 1, Saturday = 7
monthDay Integer Required if type=3. The day of the month to start SDT.
*Note that valid range = 01-31
comment String Optional.Set SDT comment

 

getDataSourceInstances:

https://accountName.logicmonitor.com/santaba/rpc/getDataSourceInstances?hostId=hostIdNum&dataSource=dataSourceName

getDataSourceInstanceGroup:

https://accountName.logicmonitor.com/santaba/rpc/getDataSourceInstanceGroup?hostName=hostName&dataSourceName=dataSourceName&dataSourceInstanceGroupName=dataSourceInstanceGroupName

 

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

startDateTime Includes start time information
- minute Includes start time information
- weekDay Day of the week (1 = Sunday, 2 = Monday, etc)
- month Month of the year (0 = January)
- year Year for the SDT
- hour Hour for the SDT, on a 00 - 24 hour schedule
- day Date (01-31)
weekDay Day of the week to start SDT
monthDay Date (01-31) to start SDT
endMinute Based duration, the minute the SDT will end
hour Hour of the day to start SDT
type 1= One Time, 2 = Weekly, 3 = Monthly, 4=Daily
endDateTime Same fields as startDateTime
endHour Based on duration, the hour the SDT will end
id ID of the SDT
minute Minute of the hour to start SDT
category Includes information about the type of SDT requested
duration Length in minutes of SDT
admin User who created SDT
isEffective True if current time is within SDT
comment SDT Comment added, empty if unspecified
sdtType 1 = One Time, 2 = Weekly, 3 = Monthly

 

Example

Set a "Weekly" SDT for a specific device:

Request:
curl "https://company.logicmonitor.com/santaba/rpc/setHostSDT?hostId=237&type=2&weekDay=1&hour=1&minute=1&endHour=2&endMinute=2" 
Response:
{
  "status": 200,
  "data": {
    "startDateTime": {
      "minute": 2,
      "weekDay": 4,
      "month": 10,
      "year": 2014,
      "hour": 22,
      "day": 22
    },
    "weekDay": 1,
    "monthDay": 0,
    "endMinute": 2,
    "hostId": 237,
    "hour": 1,
    "type": "weekly",
    "endDateTime": {
      "minute": 2,
      "weekDay": 4,
      "month": 10,
      "year": 2014,
      "hour": 22,
      "day": 22
    },
    "endHour": 2,
    "id": 23,
    "minute": 1,
    "category": {"name": "HostSDT"},
    "duration": 0,
    "sdtType": 2,
    "admin": "steve",
    "isEffective": false,
    "comment": ""
  },
  "errmsg": "OK"
}