{ "openapi": "3.1.0", "info": { "title": "nmon API (M3 contract)", "version": "0.3.0-contract", "description": "Hand-encoded from docs/milestones/M3-graphs-and-ui.md \"API contract for M3\". Superseded by the generated ../openapi.json." }, "paths": { "/api/v1/devices": { "get": { "operationId": "list-devices", "tags": [ "devices" ], "summary": "List devices", "parameters": [ { "name": "site", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "role", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "kind", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "network", "vm", "container", "check_only" ] } }, { "name": "q", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "state", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "up", "down", "warning", "unknown", "maintenance" ] } }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1, "default": 1 } }, { "name": "per_page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1, "maximum": 1000, "default": 100 } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceList" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } }, "post": { "operationId": "add-device", "tags": [ "devices" ], "summary": "Add a device", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddDeviceBody" } } } }, "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceView" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/devices/{slug}": { "parameters": [ { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } } ], "get": { "operationId": "get-device", "tags": [ "devices" ], "summary": "Get a device and its interfaces", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceView" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } }, "put": { "operationId": "put-device", "tags": [ "devices" ], "summary": "Edit a device", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PutDeviceBody" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceView" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/devices/facets": { "get": { "operationId": "get-device-facets", "tags": [ "devices" ], "summary": "Distinct sites, roles and kinds for the filters", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceFacets" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/interfaces": { "get": { "operationId": "list-interfaces", "tags": [ "interfaces" ], "summary": "Search interfaces by ifName and ifAlias", "parameters": [ { "name": "q", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1, "default": 1 } }, { "name": "per_page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1, "maximum": 1000, "default": 100 } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InterfaceList" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/graph": { "get": { "operationId": "get-graph", "tags": [ "graph" ], "summary": "In/out rate series for an interface", "parameters": [ { "name": "iface", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "dir", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "in", "out" ] } }, { "name": "from", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "to", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "step", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1 } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GraphResponse" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/poller/health": { "get": { "operationId": "get-poller-health", "tags": [ "poller" ], "summary": "Poller health", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PollerHealth" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/identity-reviews": { "get": { "operationId": "list-identity-reviews", "tags": [ "identity" ], "summary": "Identity reviews", "parameters": [ { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1, "default": 1 } }, { "name": "per_page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 1, "maximum": 1000, "default": 100 } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IdentityReviewList" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/identity-reviews/{id}/resolve": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "post": { "operationId": "resolve-identity-review", "tags": [ "identity" ], "summary": "Resolve an identity review", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResolveBody" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IdentityReview" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/query": { "get": { "operationId": "query", "tags": [ "query" ], "summary": "Instant MetricsQL query", "parameters": [ { "name": "q", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "time", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/QueryResult" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/query_range": { "get": { "operationId": "query-range", "tags": [ "query" ], "summary": "Range MetricsQL query", "parameters": [ { "name": "q", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "from", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "to", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "step", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/QueryResult" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } }, "/api/v1/meta": { "get": { "operationId": "get-meta", "tags": [ "meta" ], "summary": "Version and retention", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Meta" } } } }, "default": { "description": "RFC 9457 problem details", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } }, "components": { "schemas": { "Problem": { "type": "object", "properties": { "type": { "type": "string" }, "title": { "type": "string" }, "status": { "type": "integer", "format": "int64" }, "detail": { "type": "string" }, "instance": { "type": "string" }, "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "location": { "type": "string" }, "value": {} }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "title", "status" ], "additionalProperties": true }, "DeviceSummary": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string", "enum": [ "network", "vm", "container", "check_only" ] }, "site": { "type": "string" }, "role": { "type": "string" }, "mgmt_ip": { "type": "string" }, "profile": { "type": "string" }, "reachability": { "type": "string", "enum": [ "up", "down", "warning", "unknown", "maintenance" ] }, "poll_state": { "type": "string", "enum": [ "ok", "degraded", "backoff" ] }, "last_seen": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "interfaces_total": { "type": "integer", "format": "int64" }, "interfaces_down": { "type": "integer", "format": "int64" }, "warnings": { "type": "array", "items": { "type": "string" } } }, "required": [ "slug", "name", "kind", "site", "role", "mgmt_ip", "profile", "reachability", "poll_state", "last_seen", "interfaces_total", "interfaces_down", "warnings" ], "additionalProperties": false }, "DeviceList": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/DeviceSummary" } }, "page": { "type": "integer", "format": "int64" }, "per_page": { "type": "integer", "format": "int64" }, "total": { "type": "integer", "format": "int64" } }, "required": [ "items", "page", "per_page", "total" ], "additionalProperties": false }, "DeviceFacets": { "type": "object", "properties": { "sites": { "type": "array", "items": { "type": "string" } }, "roles": { "type": "array", "items": { "type": "string" } }, "kinds": { "type": "array", "items": { "type": "string" } } }, "required": [ "sites", "roles", "kinds" ], "additionalProperties": false }, "InterfaceView": { "type": "object", "properties": { "id": { "type": "string", "description": "Immutable ULID." }, "ifindex": { "type": "integer", "format": "int64" }, "ifname": { "type": "string" }, "ifdescr": { "type": "string" }, "ifalias": { "type": "string" }, "ifphysaddr": { "type": "string" }, "ifspeed": { "type": "integer", "format": "int64", "description": "bits per second" }, "ifhighspeed": { "type": "integer", "format": "int64", "description": "megabits per second" }, "iftype": { "type": "integer", "format": "int64" }, "admin_status": { "type": "integer", "format": "int64", "description": "ifAdminStatus: 1 up, 2 down, 3 testing" }, "oper_status": { "type": "integer", "format": "int64", "description": "ifOperStatus: 1 up, 2 down, 3 testing, 4 unknown, 5 dormant, 6 notPresent, 7 lowerLayerDown" }, "has_hc_counters": { "type": "boolean" }, "excluded": { "type": "boolean" }, "first_seen": { "type": "string", "format": "date-time" }, "last_discovered": { "type": "string", "format": "date-time" }, "unreliable": { "type": "boolean" }, "retired_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "in_bps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "out_bps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "in_errors_ps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "out_errors_ps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] } }, "required": [ "id", "ifindex", "ifname", "ifdescr", "ifalias", "ifphysaddr", "ifspeed", "ifhighspeed", "iftype", "admin_status", "oper_status", "has_hc_counters", "excluded", "first_seen", "last_discovered", "unreliable", "retired_at", "in_bps", "out_bps", "in_errors_ps", "out_errors_ps" ], "additionalProperties": false }, "DeviceView": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "site": { "type": "string" }, "role": { "type": "string" }, "profile": { "type": "string" }, "enabled": { "type": "boolean" }, "mgmt_ip": { "type": "string" }, "addresses": { "type": "array", "items": { "type": "string" } }, "snmp_version": { "type": "string" }, "sys_name": { "type": "string" }, "sys_object_id": { "type": "string" }, "sys_descr": { "type": "string" }, "hw_serial": { "type": "string" }, "uptime_seconds": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reachability": { "type": "string", "enum": [ "up", "down", "warning", "unknown", "maintenance" ] }, "poll_state": { "type": "string", "enum": [ "ok", "degraded", "backoff" ] }, "warnings": { "type": "array", "items": { "type": "string" } }, "last_seen": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "created_at": { "type": "string", "format": "date-time" }, "retired_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "parents": { "type": "array", "items": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" } }, "required": [ "slug", "name" ], "additionalProperties": false } }, "groups": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string", "enum": [ "site", "customer", "role", "custom" ] } }, "required": [ "id", "name", "kind" ], "additionalProperties": false } }, "interfaces": { "type": "array", "items": { "$ref": "#/components/schemas/InterfaceView" } } }, "required": [ "slug", "name", "kind", "site", "role", "profile", "enabled", "mgmt_ip", "addresses", "sys_name", "sys_object_id", "sys_descr", "hw_serial", "uptime_seconds", "reachability", "poll_state", "warnings", "created_at", "parents", "groups", "interfaces" ], "additionalProperties": false }, "SNMPBody": { "type": "object", "properties": { "version": { "type": "string", "enum": [ "v1", "v2c", "v3" ] }, "community": { "type": "string" }, "v3_user": { "type": "string" }, "v3_auth_proto": { "type": "string" }, "v3_auth_pass": { "type": "string" }, "v3_priv_proto": { "type": "string" }, "v3_priv_pass": { "type": "string" }, "v3_context": { "type": "string" }, "port": { "type": "integer", "format": "int64", "minimum": 1, "maximum": 65535 } }, "required": [ "version" ], "additionalProperties": false }, "AddDeviceBody": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "addresses": { "type": "array", "items": { "type": "string" } }, "kind": { "type": "string", "enum": [ "network", "vm", "container", "check_only" ] }, "site": { "type": "string" }, "role": { "type": "string" }, "snmp": { "$ref": "#/components/schemas/SNMPBody" }, "reattach": { "type": "string" }, "create_new": { "type": "boolean" } }, "required": [ "name", "addresses" ], "additionalProperties": false }, "PutDeviceBody": { "type": "object", "properties": { "name": { "type": "string" }, "site": { "type": "string" }, "role": { "type": "string" }, "enabled": { "type": "boolean" }, "parents": { "type": "array", "items": { "type": "string" } }, "snmp": { "$ref": "#/components/schemas/SNMPBody" } }, "required": [], "additionalProperties": false }, "InterfaceHit": { "type": "object", "properties": { "id": { "type": "string" }, "device": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" } }, "required": [ "slug", "name" ], "additionalProperties": false }, "ifname": { "type": "string" }, "ifalias": { "type": "string" }, "ifdescr": { "type": "string" }, "oper_status": { "type": "integer", "format": "int64" }, "admin_status": { "type": "integer", "format": "int64" }, "speed_bps": { "type": "integer", "format": "int64" }, "in_bps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "out_bps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] } }, "required": [ "id", "device", "ifname", "ifalias", "ifdescr", "oper_status", "admin_status", "speed_bps", "in_bps", "out_bps" ], "additionalProperties": false }, "InterfaceList": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/InterfaceHit" } }, "page": { "type": "integer", "format": "int64" }, "per_page": { "type": "integer", "format": "int64" }, "total": { "type": "integer", "format": "int64" } }, "required": [ "items", "page", "per_page", "total" ], "additionalProperties": false }, "Point": { "type": "array", "prefixItems": [ { "type": "number", "description": "unix seconds" }, { "anyOf": [ { "type": "number", "description": "bits per second" }, { "type": "null" } ] } ], "minItems": 2, "maxItems": 2 }, "GraphResponse": { "type": "object", "properties": { "iface": { "type": "object", "properties": { "id": { "type": "string" }, "ifname": { "type": "string" }, "ifalias": { "type": "string" }, "speed_bps": { "type": "integer", "format": "int64" }, "device": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" } }, "required": [ "slug", "name" ], "additionalProperties": false } }, "required": [ "id", "ifname", "ifalias", "speed_bps", "device" ], "additionalProperties": false }, "step_seconds": { "type": "integer", "format": "int64", "description": "Step of the newest tier." }, "tier": { "type": "string", "enum": [ "raw", "1h" ] }, "stitched_at": { "type": "string", "format": "date-time" }, "tiers": { "type": "array", "items": { "type": "object", "properties": { "from": { "type": "string", "format": "date-time" }, "to": { "type": "string", "format": "date-time" }, "tier": { "type": "string", "enum": [ "raw", "1h" ] }, "step_seconds": { "type": "integer", "format": "int64" } }, "required": [ "from", "to", "tier", "step_seconds" ], "additionalProperties": false } }, "unreliable_reason": { "type": "string" }, "partial": { "type": "array", "items": { "type": "object", "properties": { "from": { "type": "string", "format": "date-time" }, "to": { "type": "string", "format": "date-time" } }, "required": [ "from", "to" ], "additionalProperties": false } }, "unreliable": { "type": "boolean" }, "series": { "type": "object", "properties": { "in": { "type": "array", "items": { "$ref": "#/components/schemas/Point" } }, "out": { "type": "array", "items": { "$ref": "#/components/schemas/Point" } }, "in_max": { "type": "array", "items": { "$ref": "#/components/schemas/Point" } }, "out_max": { "type": "array", "items": { "$ref": "#/components/schemas/Point" } } }, "required": [ "in", "out" ], "additionalProperties": false }, "p95": { "type": "object", "properties": { "in_bps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "out_bps": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "source": { "type": "string", "enum": [ "materialised", "live" ] }, "coverage": { "type": "number" } }, "required": [ "in_bps", "out_bps", "source", "coverage" ], "additionalProperties": false } }, "required": [ "iface", "step_seconds", "tier", "partial", "unreliable", "series" ], "additionalProperties": false }, "PollerHealth": { "type": "object", "properties": { "devices": { "type": "array", "items": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" }, "state": { "type": "string", "enum": [ "ok", "degraded", "backoff" ] }, "varbinds": { "type": "integer", "format": "int64" }, "interval_s": { "type": "integer", "format": "int64" }, "base_interval_s": { "type": "integer", "format": "int64" }, "last_cycle_s": { "type": "number" }, "missed_deadlines": { "type": "integer", "format": "int64" }, "consecutive_failures": { "type": "integer", "format": "int64" }, "last_error": { "type": "string" }, "next_cycle": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] } }, "required": [ "slug", "name", "state", "varbinds", "interval_s", "base_interval_s", "last_cycle_s", "missed_deadlines", "consecutive_failures", "last_error", "next_cycle" ], "additionalProperties": false } }, "totals": { "type": "object", "properties": { "pdus_per_min": { "type": "number" }, "timeouts_per_min": { "type": "number" }, "deadline_misses_per_min": { "type": "number" }, "write_queue_depth": { "type": "integer", "format": "int64" }, "write_queue_capacity": { "type": "integer", "format": "int64" }, "devices_degraded": { "type": "integer", "format": "int64" } }, "required": [ "pdus_per_min", "timeouts_per_min", "deadline_misses_per_min", "write_queue_depth", "write_queue_capacity", "devices_degraded" ], "additionalProperties": false } }, "required": [ "devices", "totals" ], "additionalProperties": false }, "Meta": { "type": "object", "properties": { "version": { "type": "string" }, "build": { "type": "string" }, "retention": { "type": "object", "properties": { "hot": { "type": "string" }, "fiveminute": { "type": "string" }, "long": { "type": "string" } }, "required": [ "hot", "fiveminute", "long" ], "additionalProperties": false }, "now": { "type": "string", "format": "date-time" } }, "required": [ "version", "build", "retention", "now" ], "additionalProperties": false }, "IdentityReview": { "type": "object", "properties": { "id": { "type": "string" }, "kind": { "type": "string", "enum": [ "ambiguous_match", "hardware_replaced", "reattach_candidate" ] }, "device": { "type": "object", "properties": { "slug": { "type": "string" }, "name": { "type": "string" } }, "required": [ "slug", "name" ], "additionalProperties": false }, "candidates": { "type": "array", "items": { "type": "object", "properties": { "iface_id": { "type": "string" }, "ifname": { "type": "string" }, "score": { "type": "number" } }, "required": [ "iface_id" ], "additionalProperties": false } }, "evidence": { "type": "array", "items": { "type": "string" } }, "created_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "kind", "device", "candidates", "evidence" ], "additionalProperties": false }, "IdentityReviewList": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/IdentityReview" } }, "page": { "type": "integer", "format": "int64" }, "per_page": { "type": "integer", "format": "int64" }, "total": { "type": "integer", "format": "int64" } }, "required": [ "items", "page", "per_page", "total" ], "additionalProperties": false }, "ResolveBody": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "merge", "keep_both" ] }, "keep": { "type": "string" } }, "required": [ "action" ], "additionalProperties": false }, "QueryResult": { "type": "object", "additionalProperties": true } } } }