{ "openapi": "3.0.1", "info": { "version": "1.2.1", "title": "PANIC API", "description": "Endpoints to query Redis and Mongodb for Alerts and Metrics.", "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" } }, "servers": [ { "url": "/", "description": "Local Dev" } ], "tags": [ { "name": "Mongo", "description": "Endpoints that retrieve data from Mongodb." }, { "name": "Redis", "description": "Endpoints that retrieve data from Redis." } ], "paths": { "/server/mongo/monitorablesInfo": { "post": { "tags": [ "Mongo" ], "summary": "Returns a list of all the monitorable sources.", "requestBody": { "description": "baseChains object, which is a list of network types. Accepted inputs: general, cosmos, substrate, chainlink.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/baseChains" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/monitorablesInfo" } } } }, "532": { "description": "Error: Missing key(s) in request body." }, "535": { "description": "Error: Mongo client not initialised." }, "536": { "description": "Error: Could not retrieve data from Mongo." }, "537": { "description": "Error: Invalid base chain(s)." } } } }, "/server/mongo/alerts": { "post": { "tags": [ "Mongo" ], "summary": "Returns a list of alerts for the requested chains, sources and severities between a time period sorted by most recent. A number limit of alerts can also be specified.", "requestBody": { "description": "Specify the chains, severities, sources, minimum/maximum timestamp (Range of time), and number of alerts to be retrieved.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/mongoAlerts" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/mongoAlertsResult" } } } }, "532": { "description": "Error: Missing key(s) in request body." }, "535": { "description": "Error: Mongo client not initialised." }, "536": { "description": "Error: Could not retrieve data from Mongo." }, "539": { "description": "Error: An invalid value was given to the parameter." } } } }, "/server/mongo/metrics": { "post": { "tags": [ "Mongo" ], "summary": "Returns a list of metrics for the requested chains, and systems between a time period sorted by most recent. A number limit of metrics per source is specified.", "requestBody": { "description": "Specify the chains, systems, minimum/maximum timestamp (Range of time), and number of metrics per source to be retrieved.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/mongoMetrics" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/mongoMetricsOverview" } } } }, "532": { "description": "Error: Missing key(s) in request body." }, "535": { "description": "Error: Mongo client not initialised." }, "536": { "description": "Error: Could not retrieve data from Mongo." }, "539": { "description": "Error: An invalid value was given to the parameter." } } } }, "/server/redis/alertsOverview": { "post": { "tags": [ "Redis" ], "summary": "Returns a counter of all the metric states in alert form per chain.", "requestBody": { "description": "Unique chains ids, lists of the sources being monitored per type, and whether to include chain-sourced alerts.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/chainSourcesNew" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/alertsOverview" } } } }, "532": { "description": "Error: Missing key(s) in request body." }, "533": { "description": "Error: Redis client not initialised." }, "534": { "description": "Error: Could not retrieve data from Redis." }, "538": { "description": "Error: JSON does not obey the required schema. " } } } }, "/server/redis/metrics": { "post": { "tags": [ "Redis" ], "summary": "Returns the values for the requested sources of the requested chains.", "requestBody": { "description": "Unique chains ids and lists of the sources being monitored per type.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/chainSources" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/redisMetricsOverview" } } } }, "532": { "description": "Error: Missing key(s) in request body." }, "533": { "description": "Error: Redis client not initialised." }, "534": { "description": "Error: Could not retrieve data from Redis." }, "538": { "description": "Error: JSON does not obey the required schema. " } } } } }, "components": { "schemas": { "baseChains": { "type": "object", "properties": { "baseChains": { "type": "array", "items": { "type": "object" }, "example": [ "cosmos", "general", "chainlink", "substrate" ] } } }, "monitorablesInfo": { "type": "object", "properties": { "result": { "type": "object", "properties": { "cosmos": { "$ref": "#/components/schemas/monitorable" }, "chainlink": { "$ref": "#/components/schemas/monitorable" }, "substrate": { "$ref": "#/components/schemas/monitorable" }, "general": { "$ref": "#/components/schemas/monitorable" } } } } }, "monitorable": { "type": "object", "properties": { "chain_name": { "type": "object", "properties": { "parent_id": { "type": "string" }, "monitored": { "type": "object", "properties": { "systems": { "$ref": "#/components/schemas/systems" }, "nodes": { "$ref": "#/components/schemas/nodes" }, "github_repos": { "$ref": "#/components/schemas/github_repos" }, "dockerhub_repos": { "$ref": "#/components/schemas/dockerhub_repos" }, "chains": { "$ref": "#/components/schemas/chains" } } } } } } }, "systems": { "type": "array", "items": { "type": "object", "properties": { "system_id": { "type": "string" } } } }, "nodes": { "type": "array", "items": { "type": "object", "properties": { "node_id": { "type": "string" } } } }, "github_repos": { "type": "array", "items": { "type": "object", "properties": { "github_repo_id": { "type": "string" } } } }, "dockerhub_repos": { "type": "array", "items": { "type": "object", "properties": { "dockerhub_repo_id": { "type": "string" } } } }, "chains": { "type": "array", "items": { "type": "object", "properties": { "chain_id": { "type": "string" } } } }, "chainSources": { "type": "object", "properties": { "parentIds": { "type": "object", "properties": { "unique_chain_id": { "type": "object", "properties": { "systems": { "type": "array", "items": { "type": "object" }, "example": [ "system_5330c562-368b-4192-bbaf-db6638307783", "system_d2a0a05e-c0ec-4b39-a101-d3cb5f47bc03" ] }, "repos": { "type": "array", "items": { "type": "object" }, "example": [ "repo_4ca781b6-154e-4bd0-8418-0c5debc07e54", "repo_fc4dfda7-2e97-433d-98ba-8af626a989b0" ] } } } } } } }, "chainSourcesNew": { "type": "object", "properties": { "parentIds": { "type": "object", "properties": { "unique_chain_id": { "type": "object", "properties": { "include_chain_sourced_alerts": { "type": "boolean", "example": true }, "systems": { "type": "array", "items": { "type": "object" }, "example": [ "system_5330c562-368b-4192-bbaf-db6638307783", "system_d2a0a05e-c0ec-4b39-a101-d3cb5f47bc03" ] }, "nodes": { "type": "array", "items": { "type": "object" }, "example": [ "node_9b7dfa8b-5cd8-47cb-b0ac-e8440c4038a9", "node_d9acff91-e435-4be9-bc6e-927ee5f0f8c6" ] }, "github_repos": { "type": "array", "items": { "type": "object" }, "example": [ "repo_4ca781b6-154e-4bd0-8418-0c5debc07e54", "repo_fc4dfda7-2e97-433d-98ba-8af626a989b0" ] }, "dockerhub_repos": { "type": "array", "items": { "type": "object" }, "example": [ "docker_4a9072d6-4cad-44e0-99dd-334333f86390", "docker_2c61ce5b-c1c7-429d-a2a4-5700ecdd4413" ] } } } } } } }, "alertsOverview": { "type": "object", "properties": { "result": { "type": "object", "properties": { "unique_chain_id": { "type": "object", "properties": { "info": { "type": "integer", "format": "int64" }, "critical": { "type": "integer", "format": "int64" }, "warning": { "type": "integer", "format": "int64" }, "error": { "type": "integer", "format": "int64" }, "problems": { "type": "object" }, "releases": { "type": "object" }, "tags": { "type": "object" } } } } } } }, "mongoMetricsOverview": { "type": "object", "properties": { "result": { "type": "object", "properties": { "metrics": { "type": "object", "properties": { "unique_source_id": { "type": "array", "items": { "$ref": "#/components/schemas/system_metrics_mongo" } } } } } } } }, "redisMetricsOverview": { "type": "object", "properties": { "result": { "type": "object", "properties": { "unique_chain_id": { "type": "object", "properties": { "system": { "type": "object", "properties": { "unique_system_id": { "$ref": "#/components/schemas/system_metrics" } } }, "github": { "type": "object", "properties": { "unique_github_id": { "$ref": "#/components/schemas/github_metrics" } } } } } } } } }, "system_metrics": { "type": "object", "properties": { "s1": { "type": "string" }, "s2": { "type": "string" }, "s3": { "type": "string" }, "s4": { "type": "string" }, "s5": { "type": "string" }, "s6": { "type": "string" }, "s7": { "type": "string" }, "s8": { "type": "string" }, "s9": { "type": "string" }, "s10": { "type": "string" }, "s11": { "type": "string" }, "s12": { "type": "string" }, "s13": { "type": "string" }, "s14": { "type": "string" }, "s15": { "type": "string" } } }, "github_metrics": { "type": "object", "properties": { "gh1": { "type": "string" }, "gh2": { "type": "string" } } }, "system_metrics_mongo": { "type": "object", "properties": { "process_cpu_seconds_total": { "type": "string" }, "process_memory_usage": { "type": "string" }, "virtual_memory_usage": { "type": "string" }, "open_file_descriptors": { "type": "string" }, "system_cpu_usage": { "type": "string" }, "system_ram_usage": { "type": "string" }, "system_storage_usage": { "type": "string" }, "network_transmit_bytes_per_second": { "type": "string" }, "network_receive_bytes_per_second": { "type": "string" }, "network_receive_bytes_total": { "type": "string" }, "network_transmit_bytes_total": { "type": "string" }, "disk_io_time_seconds_total": { "type": "string" }, "disk_io_time_seconds_in_interval": { "type": "string" }, "went_down_at": { "type": "string" }, "timestamp": { "type": "number" } } }, "mongoAlerts": { "type": "object", "properties": { "chains": { "type": "array", "items": { "type": "object" }, "example": [ "chain_name_51383ec9-b49e-4d03-8068-d60f5f3c9285", "GENERAL" ] }, "severities": { "type": "array", "items": { "type": "object" }, "example": [ "INFO", "WARNING", "CRITICAL", "ERROR" ] }, "sources": { "type": "array", "items": { "type": "object" }, "example": [ "system_2a8b23ee-cab6-439c-85ca-d2ba5a45c934", "node_9b7dfa8b-5cd8-47cb-b0ac-e8440c4038a9", "repo_fc4dfda7-2e97-433d-98ba-8af626a989b0", "docker_2c61ce5b-c1c7-429d-a2a4-5700ecdd4413", "system_d2a0a05e-c0ec-4b39-a101-d3cb5f47bc03", "repo_4ca781b6-154e-4bd0-8418-0c5debc07e54", "node_d54a177c-c7f9-4a30-92c6-12dda8f8a71a", "chain_name_51383ec9-b49e-4d03-8068-d60f5f3c9285" ] }, "minTimestamp": { "type": "integer", "example": 0 }, "maxTimestamp": { "type": "integer", "example": 2625677273 }, "noOfAlerts": { "type": "integer", "example": 100 } } }, "mongoAlertsResult": { "type": "object", "properties": { "result": { "type": "object", "properties": { "alerts": { "type": "array", "items": { "$ref": "#/components/schemas/alert" } } } } } }, "alert": { "type": "object", "properties": { "origin": { "type": "string", "example": "system_2a8b23ee-cab6-439c-85ca-d2ba5a45c934" }, "alert_name": { "type": "string", "example": "SystemRAMUsageIncreasedAboveThresholdAlert" }, "severity": { "type": "string", "example": "CRITICAL" }, "message": { "type": "string", "example": "arbitrum system RAM usage INCREASED above CRITICAL Threshold. Current value: 56.13%." }, "metric": { "type": "string", "example": "system_ram_usage" }, "timestamp": { "type": "integer", "example": 1625758847.87753 } } }, "mongoMetrics": { "type": "object", "properties": { "chains": { "type": "array", "items": { "type": "object" }, "example": [ "chain_name_51383ec9-b49e-4d03-8068-d60f5f3c9285", "GENERAL" ] }, "systems": { "type": "array", "items": { "type": "object" }, "example": [ "system_2a8b23ee-cab6-439c-85ca-d2ba5a45c934", "system_5330c562-368b-4192-bbaf-db6638307783", "system_d2a0a05e-c0ec-4b39-a101-d3cb5f47bc03" ] }, "minTimestamp": { "type": "integer", "example": 0 }, "maxTimestamp": { "type": "integer", "example": 2625677273 }, "noOfMetricsPerSource": { "type": "integer", "example": 100 } } } } } }