מדריך ה‑API של ניטורים

ערכים אפשריים לשדות

מיקום הניטור

ערךתיאור
US_EAST_1צפון וירג׳יניה
CA_CENTRAL_1קנדה (מונטריאול)
EU_CENTRAL_1פרנקפורט
AP_NORTHEAST_1טוקיו

סוגי התראות ניטור

ערךתיאור
INCIDENTהתראת תקרית
EMAILהתראת אימייל
SMSהתראת SMS
SLACKהתראת Slack
DISCORDהתראת Discord
MICROSOFT_TEAMSהתראת Microsoft Teams
PHONE_CALLהתראה בשיחת טלפון
WEBHOOKהתראת Webhook
GOOGLE_CHATהתראת Google Chat
WHATSAPPהתראת WhatsApp

סטטוס הניטור

ערךתיאור
UPהניטור פועל כרגיל
DOWNהניטור נכשל
DEGRADEDהניטור חווה תקלות
UNKNOWNלא ניתן לקבוע את מצב הניטור

קבלת ניטורים

אפשר להשתמש בנקודת הקצה הזו כדי למצוא ולעבור על רשימה של כל הניטורים הקיימים.

נקודת קצה:

GET /:page_id/monitors

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
pagenumber1מספר העמוד לשליפה.
limitnumber100מספר הניטורים בכל עמוד.
searchstringnullמונח חיפוש לסינון התוצאות.
statusenumnullסינון לפי סטטוס ('UP', 'DOWN', 'UNKNOWN', 'DEGRADED').

דוגמת בקשה

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

דוגמת תשובה

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

יצירת ניטור

נקודת קצה:

POST /monitors

דוגמת בקשה

{
"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
}
}

דוגמת תשובה

{
"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"
}

עדכון ניטור

נקודת קצה:

PUT /monitors/:id

דוגמת בקשה

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

דוגמת תשובה

{
"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"
}

מחיקת ניטור

נקודת קצה:

DELETE /monitors/:id

דוגמת בקשה

DELETE /monitors/monitor-id-1

דוגמת תשובה

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

קבלת יומני הניטור

נקודת קצה:

GET /monitors/:id/logs

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
limitnumber100מספר הפריטים בכל עמוד. אינו יכול לעלות על 1000.
pagenumber1מספר העמוד לשליפה.
monitorIdstring-מזהה הניטור.
locationstringnullמיקום הניטור.
createdAtstring | object | numbernullתאריך היצירה. יכול להיות מחרוזת, מספר או אובייקט עם השדות gte ו‑lte.
isSuccessfulbooleannullהאם הבדיקה הצליחה.
isSSLCheckbooleannullהאם הבדיקה היא בדיקת SSL.
httpStatusCodestringnullקוד סטטוס ה‑HTTP של התשובה.
status('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')nullסטטוס הניטור.
dnsTimestring | number | objectnullהזמן שנדרש לפענוח ה‑DNS.
tcpTimestring | number | objectnullהזמן שנדרש לחיבור ה‑TCP.
tlsTimestring | number | objectnullהזמן שנדרש ללחיצת היד של TLS.
firstByteTimestring | number | objectnullהזמן שנדרש לקבלת הבייט הראשון.
downloadTimestring | number | objectnullהזמן שנדרש להורדה.
responseTimestring | number | objectnullזמן התגובה הכולל.
performanceTimestring | number | objectnullזמן הביצועים.
accessabilityScorestring | number | objectnullציון הנגישות.
seoScorestring | number | objectnullציון ה‑SEO.
bestPracticesScorestring | number | objectnullציון שיטות העבודה המומלצות.
successfulAssertionsstring | number | objectnullמספר הבדיקות שהצליחו.
sortstringכרונולוגיהשדה שלפיו ממיינים.

דוגמת בקשה

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

דוגמת תשובה

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

הרצת בדיקת ניטור לפי מזהה

נקודת קצה:

GET /monitors/:id/run

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
location'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'-מיקום הניטור. חייב להיות אחד מהערכים המצוינים.
retrybooleanfalseמציין אם יש לנסות את הפעולה שוב. אופציונלי.
monitorLogIdstringnullהמזהה הייחודי של יומן הניטור. אופציונלי.

דוגמת בקשה

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

דוגמת תשובה

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

יצירת התראת ניטור

נקודת קצה:

POST /monitor-alerts

דוגמת בקשה

{
"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"
}

דוגמת תשובה

{
"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"
}

עדכון התראת ניטור

נקודת קצה:

PUT /monitor-alerts/:id

דוגמת בקשה

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

דוגמת תשובה

{
"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."
}

קבלת התראות ניטור

נקודת קצה:

GET /:page_id/monitor-alerts

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
limitnumber100מספר הפריטים בכל עמוד.
pagenumber1מספר העמוד לשליפה.

דוגמת בקשה

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

דוגמת תשובה

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

מחיקת התראת ניטור

נקודת קצה:

DELETE /monitor-alerts/:id

דוגמת בקשה

DELETE /monitor-alerts/alert-id-1

דוגמת תשובה

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

יצירת קבוצת ניטורים

נקודת קצה:

POST /monitors-groups

דוגמת בקשה

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

דוגמת תשובה

{
"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."
}

עדכון קבוצת ניטורים

נקודת קצה:

PUT /monitors-groups/:id

דוגמת בקשה

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

דוגמת תשובה

{
"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."
}

מחיקת קבוצת ניטורים

נקודת קצה:

DELETE /monitors-groups/:id

דוגמת בקשה

DELETE /monitors-groups/group-id-1

דוגמת תשובה

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

הוספת ניטורים לקבוצה

נקודת קצה:

POST /monitors-groups/:id/monitors

דוגמת בקשה

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

דוגמת תשובה

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

הרצת בדיקה לקבוצת ניטורים

נקודת קצה:

GET /monitors-groups/:id/run

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
location'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'-מיקום הניטור. חייב להיות אחד מהערכים המצוינים.
retrybooleanfalseמציין אם יש לנסות את הפעולה שוב. אופציונלי.
monitorLogIdstringnullהמזהה הייחודי של יומן הניטור. אופציונלי.

דוגמת בקשה

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

דוגמת תשובה

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

ניטורי Cron

ניטורי Cron עוקבים אחר משימות מתוזמנות באמצעות פינגים ב‑HTTP. להגדרה במוצר ולשימוש בדאשבורד, ראו ניטור Cron.

ערכים אפשריים לשדות

סטטוס ניטור Cron

ערךתיאור
UPהניטור פועל כרגיל
DOWNהניטור נכשל
DEGRADEDהניטור חווה תקלות
UNKNOWNלא ניתן לקבוע את מצב הניטור

מצב ניטור Cron

ערךתיאור
ACTIVEהניטור נבדק באופן פעיל
PAUSEDבדיקות הניטור מושהות
MUTEDהניטור מושתק (ללא התראות)

סטטוס יומן ניטור Cron

ערךתיאור
SUCCESSהמשימה הושלמה בהצלחה
FAILUREהמשימה דיווחה במפורש על כישלון
MISSEDהמשימה לא שלחה פינג בחלון הזמן הצפוי
LATEהמשימה שלחה פינג אחרי המחזור אך בתוך זמן החסד
STARTEDהמשימה דיווחה שהתחילה (מדידת זמן ריצה)

מחזור וחסד

גם period וגם grace מצוינים בשניות. period הוא התדירות שבה המשימה אמורה לרוץ; grace הוא זמן נוסף שמותר לפני שהניטור מסומן כמושבת.

קבלת ניטורי Cron

נקודת קצה:

GET /:page_id/monitors/cron

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
limitnumber100מספר ניטורי ה‑Cron בכל עמוד. המקסימום הוא 100.
pagenumber1מספר העמוד.
searchstringnullמונח חיפוש לסינון התוצאות לפי שם.
statusenumnullסינון לפי סטטוס ('UP', 'DOWN', 'UNKNOWN', 'DEGRADED').

דוגמת בקשה

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

דוגמת תשובה

{
"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
}

יצירת ניטור Cron

נקודת קצה:

POST /monitors/cron

דוגמת בקשה

{
"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
}
}

דוגמת תשובה

{
"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."
}

התשובה כוללת slug. השתמשו בו כדי לבנות כתובות פינג עבור המשימה שלכם. הפינג המוצלח הראשון מתזמן את משימת הבדיקה ברקע.

עדכון ניטור Cron

נקודת קצה:

PUT /monitors/cron/:id

דוגמת בקשה

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

דוגמת תשובה

{
"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."
}

מחיקת ניטור Cron

נקודת קצה:

DELETE /monitors/cron/:id

דוגמת בקשה

DELETE /monitors/cron/cron-abc123

דוגמת תשובה

{
"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."
}

קבלת יומני ניטור Cron

נקודת קצה:

GET /monitors/cron/:id/logs

פרמטרי שאילתה

פרמטרסוגברירת מחדלתיאור
limitnumber100מספר היומנים בכל עמוד. המקסימום הוא 127.
pagenumber1מספר העמוד. המקסימום הוא 1000.
startDatestringלפני שנהתאריך התחלה בפורמט ISO 8601 לטווח היומנים.
endDatestringעכשיותאריך סיום בפורמט ISO 8601 לטווח היומנים.
importanceenumnullסינון היומנים לפי חשיבות ('all', 'important').

דוגמת בקשה

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

דוגמת תשובה

{
"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
}

קבלת סיכום ניטור Cron

נקודת קצה:

GET /monitors/cron/:id/summary

דוגמת בקשה

GET /monitors/cron/cron-abc123/summary

דוגמת תשובה

{
"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
}
}

נקודות קצה לפינג

נקודות הקצה האלה אינן דורשות אימות. ה‑slug של הניטור משמש כסוד.

אפשר לשלוח פינג דרך כתובת הבסיס של ה‑API או דרך שרת ה‑cron הייעודי:

  • הצלחה: https://cron.instatus.com/{slug} או GET / POST / HEAD /monitors/cron/{slug}
  • כישלון: https://cron.instatus.com/{slug}/fail או GET / POST / HEAD /monitors/cron/{slug}/fail
  • התחלה: https://cron.instatus.com/{slug}/start או GET / POST / HEAD /monitors/cron/{slug}/start

שלחו פינג הצלחה בכל פעם שהמשימה שלכם מסתיימת בזמן. שלחו פינג התחלה לפני שהמשימה רצה ופינג הצלחה או כישלון בסיומה כדי לתעד את זמן הריצה.

דוגמה לפינג הצלחה

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

דוגמת תשובה

{
"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"
}

אם ה‑slug אינו תקין, התשובה היא:

{
"message": "Monitor not found"
}