22
33# Monitor Service
44
5- Manage HTTP, TCP, and DNS monitors. The Monitor Service provides 14 RPC methods
5+ Manage HTTP, TCP, and DNS monitors. The Monitor Service provides 15 RPC methods
66for creating, updating, listing, triggering, deleting, querying monitor status
77and metrics, and inspecting HTTP response logs.
88
@@ -80,7 +80,7 @@ Updates are partial — only include the fields you want to change.
8080
8181``` typescript
8282const { monitor } = await client .monitor .v1 .MonitorService .updateHTTPMonitor ({
83- id: " mon_123 " ,
83+ id: " 123456 " ,
8484 monitor: {
8585 name: " Updated API Monitor" ,
8686 active: false ,
@@ -141,7 +141,7 @@ const { monitor } = await client.monitor.v1.MonitorService.createTCPMonitor({
141141
142142``` typescript
143143const { monitor } = await client .monitor .v1 .MonitorService .updateTCPMonitor ({
144- id: " mon_123 " ,
144+ id: " 123456 " ,
145145 monitor: {
146146 name: " Updated Database Monitor" ,
147147 },
@@ -207,7 +207,7 @@ const { monitor } = await client.monitor.v1.MonitorService.createDNSMonitor({
207207
208208``` typescript
209209const { monitor } = await client .monitor .v1 .MonitorService .updateDNSMonitor ({
210- id: " mon_123 " ,
210+ id: " 123456 " ,
211211 monitor: {
212212 name: " Updated DNS Check" ,
213213 },
@@ -263,7 +263,7 @@ contains one of HTTP, TCP, or DNS configuration.
263263
264264``` typescript
265265const { monitor } = await client .monitor .v1 .MonitorService .getMonitor ({
266- id: " mon_123 " ,
266+ id: " 123456 " ,
267267});
268268
269269if (monitor ?.config .case === " http" ) {
@@ -287,7 +287,7 @@ Trigger an immediate check for a monitor.
287287
288288``` typescript
289289const { success } = await client .monitor .v1 .MonitorService .triggerMonitor ({
290- id: " mon_123 " ,
290+ id: " 123456 " ,
291291});
292292
293293console .log (` Trigger successful: ${success } ` );
@@ -297,7 +297,7 @@ console.log(`Trigger successful: ${success}`);
297297
298298``` typescript
299299const { success } = await client .monitor .v1 .MonitorService .deleteMonitor ({
300- id: " mon_123 " ,
300+ id: " 123456 " ,
301301});
302302```
303303
@@ -317,7 +317,7 @@ const client = createOpenStatusClient({
317317});
318318
319319const { id, regions } = await client .monitor .v1 .MonitorService .getMonitorStatus (
320- { id: " mon_123 " },
320+ { id: " 123456 " },
321321);
322322
323323for (const { region, status } of regions ) {
@@ -337,7 +337,7 @@ const client = createOpenStatusClient({
337337});
338338
339339const summary = await client .monitor .v1 .MonitorService .getMonitorSummary ({
340- id: " mon_123 " ,
340+ id: " 123456 " ,
341341 timeRange: TimeRange .TIME_RANGE_7D ,
342342 regions: [],
343343});
@@ -358,11 +358,61 @@ The latency fields (`p50`, `p75`, `p90`, `p95`, `p99`) and count fields
358358` regions ` parameter is optional — pass an empty array to get metrics across all
359359regions.
360360
361+ ` getMonitorSummary ` returns a single aggregate over the window and ` TimeRange `
362+ caps at 14 days. For a per-day series (e.g. to render status bars), use
363+ ` getMonitorDailySummary ` below.
364+
365+ ## Get Monitor Daily Summary
366+
367+ Get per-day status buckets for one or more monitors over the last N days (max
368+ 45). Each bucket is tagged with its ` monitorId ` , so you can render a status bar
369+ per monitor.
370+
371+ ``` typescript
372+ import { createOpenStatusClient } from " @openstatus/sdk-node" ;
373+
374+ const client = createOpenStatusClient ({
375+ apiKey: process .env .OPENSTATUS_API_KEY ,
376+ });
377+
378+ const { dailyStats } = await client .monitor .v1 .MonitorService
379+ .getMonitorDailySummary ({
380+ monitorIds: [" 123456" , " 123457" ],
381+ days: 45 ,
382+ });
383+
384+ for (const stat of dailyStats ) {
385+ console .log (
386+ ` [${stat .monitorId }] ${stat .day }: ` +
387+ ` ${stat .ok }/${stat .count } ok, ${stat .degraded } degraded, ${stat .error } error ` ,
388+ );
389+ }
390+ ```
391+
392+ Request parameters:
393+
394+ | Parameter | Type | Description |
395+ | ------------ | ----------------- | ---------------------------------------------------- |
396+ | ` monitorIds ` | string[ ] | One or more monitor IDs (1–50, required) |
397+ | ` days ` | number (optional) | Days to return (1–45, default 45; values >45 reject) |
398+
399+ Each ` MonitorDailyStat ` has ` monitorId ` , ` day ` (RFC 3339, UTC midnight), and the
400+ ` bigint ` counts ` count ` , ` ok ` , ` degraded ` , ` error ` . Days with no checks are
401+ omitted — fill gaps client-side. Daily data is retained for 45 days.
402+
403+ > The REST endpoint ` GET /v1/monitor/{id}/summary ` also returns a daily series,
404+ > but only ` { ok, count, day } ` for a single monitor. Prefer
405+ > ` getMonitorDailySummary ` — it is multi-monitor and includes
406+ > ` degraded ` /` error ` .
407+
361408## List Monitor HTTP Response Logs
362409
363410List HTTP response logs for a monitor within the 14-day retention window.
364411Supports time-window filtering and offset-based pagination.
365412
413+ > Response logs are a paid feature. On the free plan these methods return
414+ > ` permission_denied ` ("Upgrade for response logs").
415+
366416``` typescript
367417import {
368418 createOpenStatusClient ,
@@ -377,7 +427,7 @@ const client = createOpenStatusClient({
377427
378428const { logs, pagination } = await client .monitor .v1 .MonitorService
379429 .listMonitorHTTPResponseLogs ({
380- id: " mon_123 " ,
430+ id: " 123456 " ,
381431 fromTimestamp: BigInt (Date .now () - 24 * 60 * 60 * 1000 ),
382432 toTimestamp: BigInt (Date .now ()),
383433 limit: 25 ,
@@ -421,7 +471,7 @@ redacted response headers, error message, and serialized assertions.
421471``` typescript
422472const { log } = await client .monitor .v1 .MonitorService
423473 .getMonitorHTTPResponseLog ({
424- id: " mon_123 " ,
474+ id: " 123456 " ,
425475 logId: " log_456" ,
426476 });
427477
0 commit comments