API-Referenz für Monitore

Mögliche Werte für Felder

Monitorstandort

WertBeschreibung
US_EAST_1Nord-Virginia
CA_CENTRAL_1Kanada (Montreal)
EU_CENTRAL_1Frankfurt
AP_NORTHEAST_1Tokio

Monitor-Alarmtypen

WertBeschreibung
INCIDENTVorfallsalarm
EMAILE-Mail-Alarm
SMSSMS-Alarm
SLACKSlack-Alarm
DISCORDDiscord-Alarm
MICROSOFT_TEAMSMicrosoft-Teams-Alarm
PHONE_CALLTelefonanruf-Alarm
WEBHOOKWebhook-Alarm
GOOGLE_CHATGoogle-Chat-Alarm
WHATSAPPWhatsApp-Alarm

Monitorstatus

WertBeschreibung
UPMonitor läuft normal
DOWNMonitor ist ausgefallen
DEGRADEDMonitor hat Probleme
UNKNOWNMonitorzustand nicht bestimmbar

Monitore abrufen

Über diesen Endpunkt finden und durchblättern Sie eine Liste aller vorhandenen Monitore.

Endpunkt:

GET /:page_id/monitors

Query-Parameter

ParameterTypStandardwertBeschreibung
pagenumber1Die abzurufende Seitennummer.
limitnumber100Anzahl der Monitore pro Seite.
searchstringnullSuchbegriff zum Filtern der Ergebnisse.
statusenumnullStatusfilter ('UP', 'DOWN', 'UNKNOWN', 'DEGRADED').

Beispielanfrage

GET /1/monitors?limit=3&page=2&status=DOWN

Beispielantwort

{
"monitors": [{ "...": "monitor objects" }],
"total": 10,
"page": 3,
"totalPages": 5,
"limit": 2
}

Einen Monitor erstellen

Endpunkt:

POST /monitors

Beispielanfrage

{
"pageId": "page123",
"url": "https://example.com",
"httpMethod": "GET",
"body": null,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
"queryParams": {
"search": "test",
"limit": "10"
},
"basicAuth": {
"username": "user",
"password": "password"
},
"type": "HTTP",
"assertions": [
{
"type": "STATUSCODE",
"comparison": "EQUALS",
"selector": null,
"target": "200"
}
],
"alerts": ["alert-id-1", "alert-id-2"],
"name": "Example Monitor",
"locations": "US_EAST_1",
"checksInterval": 300,
"createComponent": true,
"createMetric": true,
"onFail": {
"createIncident": true,
"createOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
}
}

Beispielantwort

{
"monitor": {
"pageId": "page123",
"url": "https://example.com",
"httpMethod": "GET",
"body": null,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
"queryParams": {
"search": "test",
"limit": "10"
},
"basicAuth": {
"username": "user",
"password": "password"
},
"type": "HTTP",
"assertions": [
{
"id": "assertion1",
"type": "STATUSCODE",
"comparison": "EQUALS",
"selector": null,
"target": "200"
}
],
"alerts": ["alert1", "alert2"],
"name": "Example Monitor",
"locations": "US_EAST_1",
"checksInterval": 300,
"createComponent": true,
"createMetric": true,
"onFail": {
"createIncident": true,
"createOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z"
},
"message": "Monitor created successfully"
}

Einen Monitor aktualisieren

Endpunkt:

PUT /monitors/:id

Beispielanfrage

{
"url": "https://updated.com",
"name": "Updated Monitor Name"
}

Beispielantwort

{
"monitor": {
"pageId": "page123",
"url": "https://updated.com",
"httpMethod": "GET",
"body": null,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
"queryParams": {
"search": "test",
"limit": "10"
},
"basicAuth": {
"username": "user",
"password": "password"
},
"type": "HTTP",
"assertions": [
{
"id": "assertion1",
"type": "STATUSCODE",
"comparison": "EQUALS",
"selector": null,
"value": "200"
}
],
"alerts": ["alert1", "alert2"],
"name": "Updated Monitor Name",
"locations": "US_EAST_1",
"checksInterval": 300,
"createComponent": true,
"createMetric": true,
"onFail": {
"createIncident": true,
"createOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z"
},
"message": "Monitor updated successfully"
}

Einen Monitor löschen

Endpunkt:

DELETE /monitors/:id

Beispielanfrage

DELETE /monitors/monitor-id-1

Beispielantwort

{
"message": "Monitor deleted successfully."
}

Monitor-Logs abrufen

Endpunkt:

GET /monitors/:id/logs

Query-Parameter

ParameterTypStandardwertBeschreibung
limitnumber100Anzahl der Einträge pro Seite. Darf 1000 nicht überschreiten.
pagenumber1Die abzurufende Seitennummer.
monitorIdstring-Die ID des Monitors.
locationstringnullDer Standort des Monitors.
createdAtstring | object | numbernullDas Erstellungsdatum. String, Zahl oder Objekt mit den Feldern gte und lte.
isSuccessfulbooleannullOb die Prüfung erfolgreich war.
isSSLCheckbooleannullOb die Prüfung eine SSL-Prüfung ist.
httpStatusCodestringnullDer HTTP-Statuscode der Antwort.
status('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')nullDer Status des Monitors.
dnsTimestring | number | objectnullDauer der DNS-Auflösung.
tcpTimestring | number | objectnullDauer des TCP-Verbindungsaufbaus.
tlsTimestring | number | objectnullDauer des TLS-Handshakes.
firstByteTimestring | number | objectnullDauer bis zum Empfang des ersten Bytes.
downloadTimestring | number | objectnullDauer des Downloads.
responseTimestring | number | objectnullGesamte Antwortzeit.
performanceTimestring | number | objectnullPerformance-Zeit.
accessabilityScorestring | number | objectnullBarrierefreiheits-Score.
seoScorestring | number | objectnullSEO-Score.
bestPracticesScorestring | number | objectnullBest-Practices-Score.
successfulAssertionsstring | number | objectnullAnzahl erfolgreicher Prüfungen.
sortstringchronologischFeld, nach dem sortiert wird.

Beispielanfrage

GET /monitors/monitor-id-1/logs?limit=100&page=1

Beispielantwort

{
"monitorLogs": [
// {monitor log object},
// {monitor log object 2}
],
"total": 478,
"page": 1,
"totalPages": 5,
"limit": 100
}

Monitorprüfung per ID ausführen

Endpunkt:

GET /monitors/:id/run

Query-Parameter

ParameterTypStandardwertBeschreibung
location'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'-Der Standort des Monitors. Muss einer der genannten Werte sein.
retrybooleanfalseGibt an, ob der Vorgang wiederholt werden soll. Optional.
monitorLogIdstringnullDie eindeutige Kennung des Monitor-Logs. Optional.

Beispielanfrage

GET /monitors/monitor-id-1/run?monitorId=abc123&location=US_EAST_1&retry=true&monitorLogId=log456

Beispielantwort

{
"status": "success",
"message": "Monitor check run successfully."
}

Monitor-Alarm erstellen

Endpunkt:

POST /monitor-alerts

Beispielanfrage

{
"type": "EMAIL",
"pageId": "page123",
"recipient": "user@example.com",
"recipientWorkspace": "workspace123",
"whenFails": true,
"whenRecovers": true,
"whenDegrades": false,
"whenSslExpires": true,
"sslExpiresInDays": 30,
"monitors": ["monitor1", "monitor2"],
"metadata": "Additional information about the alert"
}

Beispielantwort

{
"monitor": {
"id": "alert123",
"siteId": "site123",
"type": "EMAIL",
"recipient": "user@example.com",
"whenFails": true,
"whenRecovers": true,
"whenDegrades": false,
"whenSslExpires": true,
"sslExpiresInDays": 30,
"monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z",
"metadata": "Additional information about the alert"
},
"message": "Monitor Alert created successfully"
}

Monitor-Alarm aktualisieren

Endpunkt:

PUT /monitor-alerts/:id

Beispielanfrage

{
"type": "EMAIL",
"monitors": ["monitor-1-id", "monitor-2-id", "monitor-3-id"]
}

Beispielantwort

{
"monitor": {
"type": "EMAIL",
"pageId": "page123",
"recipient": "user@example.com",
"recipientWorkspace": "workspace123",
"whenFails": true,
"whenRecovers": true,
"whenDegrades": false,
"whenSslExpires": true,
"sslExpiresInDays": 30,
"monitors": ["monitor-1-id", "monitor-2-id"],
"metadata": "Additional information about the alert"
},
"message": "Monitor alert updated successfully."
}

Monitor-Alarme abrufen

Endpunkt:

GET /:page_id/monitor-alerts

Query-Parameter

ParameterTypStandardwertBeschreibung
limitnumber100Anzahl der Einträge pro Seite.
pagenumber1Die abzurufende Seitennummer.

Beispielanfrage

GET /1/monitor-alerts?limit=2&page=3

Beispielantwort

{
"monitorAlerts": [
{...monitor alert objects}
],
"total": 27,
"page": 3,
"totalPages": 14,
"limit": 2
}

Monitor-Alarm löschen

Endpunkt:

DELETE /monitor-alerts/:id

Beispielanfrage

DELETE /monitor-alerts/alert-id-1

Beispielantwort

{
"message": "Monitor alert deleted successfully."
}

Monitorgruppe erstellen

Endpunkt:

POST /monitors-groups

Beispielanfrage

{
"pageId": "page123",
"name": "Example Name",
"childId": "child456"
}

Beispielantwort

{
"monitor": {
"id": "group123",
"name": "Example Name",
"siteId": "site123",
"collapsed": false,
"monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
"groupId": "parentGroup123",
"children": [
{ "id": "childGroup1", "name": "Child Group 1" },
{ "id": "childGroup2", "name": "Child Group 2" }
],
"order": 1,
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z",
"parents": ["parent1", "parent2"],
"componentId": "component123"
},
"message": "Monitor group created successfully."
}

Monitorgruppe aktualisieren

Endpunkt:

PUT /monitors-groups/:id

Beispielanfrage

{
"name": "Updated Monitor Group Name"
}

Beispielantwort

{
"monitor": {
"id": "group123",
"name": "Updated Monitor Group Name",
"siteId": "site123",
"collapsed": true,
"monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
"groupId": "parentGroup123",
"children": [
{ "id": "childGroup1", "name": "Child Group 1" },
{ "id": "childGroup2", "name": "Child Group 2" }
],
"order": 1,
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z",
"parents": ["parent1", "parent2"],
"componentId": "component123"
},
"message": "Monitor group updated successfully."
}

Monitorgruppe löschen

Endpunkt:

DELETE /monitors-groups/:id

Beispielanfrage

DELETE /monitors-groups/group-id-1

Beispielantwort

{
"message": "Monitor group deleted successfully."
}

Monitore zu einer Gruppe hinzufügen

Endpunkt:

POST /monitors-groups/:id/monitors

Beispielanfrage

{
"monitors": ["monitor1", "monitor2", "monitor3"]
}

Beispielantwort

{
"message": "Monitors added to the group successfully."
}

Prüfung einer Monitorgruppe ausführen

Endpunkt:

GET /monitors-groups/:id/run

Query-Parameter

ParameterTypStandardwertBeschreibung
location'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'-Der Standort des Monitors. Muss einer der genannten Werte sein.
retrybooleanfalseGibt an, ob der Vorgang wiederholt werden soll. Optional.
monitorLogIdstringnullDie eindeutige Kennung des Monitor-Logs. Optional.

Beispielanfrage

GET /monitors-groups/group-id-1/run

Beispielantwort

{
"result": "OK",
"monitorLogId": "monitor-log-id-1"
}

Cron-Monitore

Cron-Monitore verfolgen geplante Jobs über HTTP-Pings. Zur Einrichtung im Produkt und zur Nutzung im Dashboard siehe Cron-Monitoring.

Mögliche Werte für Felder

Status des Cron-Monitors

WertBeschreibung
UPMonitor läuft normal
DOWNMonitor ist ausgefallen
DEGRADEDMonitor hat Probleme
UNKNOWNMonitorzustand nicht bestimmbar

Zustand des Cron-Monitors

WertBeschreibung
ACTIVEMonitor wird aktiv geprüft
PAUSEDMonitorprüfungen sind pausiert
MUTEDMonitor ist stummgeschaltet (keine Benachrichtigungen)

Log-Status des Cron-Monitors

WertBeschreibung
SUCCESSJob wurde erfolgreich abgeschlossen
FAILUREJob hat ausdrücklich einen Fehler gemeldet
MISSEDJob hat nicht im erwarteten Fenster gepingt
LATEJob pingte nach dem Zeitraum, aber in der Karenzzeit
STARTEDJob hat seinen Start gemeldet (Ausführungszeit)

Zeitraum und Karenzzeit

period und grace werden beide in Sekunden angegeben. period gibt an, wie oft der Job laufen soll; grace ist die zusätzliche Zeit, bevor der Monitor als ausgefallen markiert wird.

Cron-Monitore abrufen

Endpunkt:

GET /:page_id/monitors/cron

Query-Parameter

ParameterTypStandardwertBeschreibung
limitnumber100Anzahl der Cron-Monitore pro Seite. Maximal 100.
pagenumber1Die Seitennummer.
searchstringnullSuchbegriff zum Filtern der Ergebnisse nach Name.
statusenumnullStatusfilter ('UP', 'DOWN', 'UNKNOWN', 'DEGRADED').

Beispielanfrage

GET /page123/monitors/cron?limit=10&page=1&status=DOWN

Beispielantwort

{
"cronMonitors": [
{
"id": "cron-abc123",
"name": "Daily backup",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 86400,
"grace": 3600,
"status": "UP",
"state": "ACTIVE",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": true,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-15T08:00:00.000Z"
}
],
"total": 1,
"page": 1,
"totalPages": 1,
"limit": 10
}

Einen Cron-Monitor erstellen

Endpunkt:

POST /monitors/cron

Beispielanfrage

{
"pageId": "page123",
"name": "Daily backup",
"period": 86400,
"grace": 3600,
"alerts": ["alert-id-1", "alert-id-2"],
"createComponent": true,
"onFail": {
"createIncident": true,
"createOutageDuration": false,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": false,
"publishIncident": true,
"notifySubscribers": true
}
}

Beispielantwort

{
"cronMonitor": {
"id": "cron-abc123",
"name": "Daily backup",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 86400,
"grace": 3600,
"status": "UP",
"state": "ACTIVE",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": true,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-15T08:00:00.000Z"
},
"message": "Cron monitor created successfully."
}

Die Antwort enthält einen slug. Damit bauen Sie die Ping-URLs für Ihren Job. Der erste erfolgreiche Ping plant den Hintergrund-Prüfjob ein.

Einen Cron-Monitor aktualisieren

Endpunkt:

PUT /monitors/cron/:id

Beispielanfrage

{
"name": "Daily backup (updated)",
"period": 43200,
"grace": 1800,
"state": "PAUSED",
"alerts": ["alert-id-1"],
"onFail": {
"notifySubscribers": false
}
}

Beispielantwort

{
"cronMonitor": {
"id": "cron-abc123",
"name": "Daily backup (updated)",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 43200,
"grace": 1800,
"status": "UP",
"state": "PAUSED",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": false,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"alerts": [
{
"id": "alert-id-1",
"type": "EMAIL",
"recipient": "ops@example.com"
}
],
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-16T10:30:00.000Z"
},
"message": "Cron monitor updated successfully."
}

Einen Cron-Monitor löschen

Endpunkt:

DELETE /monitors/cron/:id

Beispielanfrage

DELETE /monitors/cron/cron-abc123

Beispielantwort

{
"cronMonitor": {
"id": "cron-abc123",
"name": "Daily backup",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 86400,
"grace": 3600,
"status": "UP",
"state": "ACTIVE",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": true,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-15T08:00:00.000Z"
},
"message": "Cron monitor deleted successfully."
}

Logs eines Cron-Monitors abrufen

Endpunkt:

GET /monitors/cron/:id/logs

Query-Parameter

ParameterTypStandardwertBeschreibung
limitnumber100Anzahl der Logs pro Seite. Maximal 127.
pagenumber1Die Seitennummer. Maximal 1000.
startDatestringvor 1 JahrISO-8601-Startdatum für den Log-Zeitraum.
endDatestringjetztISO-8601-Enddatum für den Log-Zeitraum.
importanceenumnullLogs nach Wichtigkeit filtern ('all', 'important').

Beispielanfrage

GET /monitors/cron/cron-abc123/logs?limit=50&page=1&importance=important

Beispielantwort

{
"logs": [
{
"id": "log-xyz789",
"monitorId": "cron-abc123",
"status": "SUCCESS",
"requestType": "GET",
"agent": "curl/8.4.0",
"ipAddress": "203.0.113.10",
"createdAt": "2024-01-16T06:00:00.000Z",
"startedAt": "2024-01-16T05:59:58.000Z"
}
],
"page": 1
}

Zusammenfassung eines Cron-Monitors abrufen

Endpunkt:

GET /monitors/cron/:id/summary

Beispielanfrage

GET /monitors/cron/cron-abc123/summary

Beispielantwort

{
"summary": {
"totalLogs": 120,
"totalFailedLogs": 3,
"availability": 97.5,
"oneDayAvailability": 100,
"previousDayAvailability": 100,
"sevenDayAvailability": 98.2,
"previousSevenDayAvailability": 96.1,
"thirtyDayAvailability": 97.5,
"previousThirtyDayAvailability": 95.8,
"lastSuccess": "2024-01-16T06:00:00.000Z",
"lastFailure": "2024-01-10T06:00:00.000Z",
"lastStarted": null,
"upSince": "2024-01-10T07:00:00.000Z",
"downSince": null
}
}

Ping-Endpunkte

Diese Endpunkte erfordern keine Authentifizierung. Der slug des Monitors dient als Secret.

Sie können über die Basis-URL der API oder über den dedizierten Cron-Host pingen:

  • Erfolg: https://cron.instatus.com/{slug} oder GET / POST / HEAD /monitors/cron/{slug}
  • Fehler: https://cron.instatus.com/{slug}/fail oder GET / POST / HEAD /monitors/cron/{slug}/fail
  • Start: https://cron.instatus.com/{slug}/start oder GET / POST / HEAD /monitors/cron/{slug}/start

Senden Sie jedes Mal einen Erfolgs-Ping, wenn Ihr Job planmäßig abschließt. Senden Sie vor dem Lauf einen Start-Ping und danach einen Erfolgs- oder Fehler-Ping, um die Ausführungszeit zu erfassen.

Beispiel für einen Erfolgs-Ping

curl https://cron.instatus.com/my-page-x7k2m9n4p1q8w3e5

Beispielantwort

{
"id": "log-xyz789",
"monitorId": "cron-abc123",
"status": "SUCCESS",
"requestType": "GET",
"agent": "curl/8.4.0",
"ipAddress": "203.0.113.10",
"createdAt": "2024-01-16T06:00:00.000Z"
}

Ist der Slug ungültig, lautet die Antwort:

{
"message": "Monitor not found"
}