Skip to main content

HTTP

Health CheckPlaybookScraper

Mission Control integrates with HTTP endpoints to monitor APIs and web services.


Health Check

Use cases:

  • Monitor API availability and response times
  • Validate JSON/XML response content against expected values
  • Check SSL certificate expiration before services fail
  • Authenticate with Basic Auth, OAuth2, or NTLM

Basic Availability Check

Monitor HTTP endpoints with comprehensive validation options.

http-availability-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: api-health
spec:
interval: 30
http:
- name: api-endpoint
url: https://api.example.com/health
responseCodes:
- 200
JSON Response Validation
http-json-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: api-status
spec:
interval: 60
http:
- name: api-status
url: https://api.example.com/status
responseCodes:
- 200
responseContent:
jsonPath:
path: $.status
value: healthy
SSL Certificate Check
http-ssl-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: ssl-expiry
spec:
interval: 3600
http:
- name: ssl-check
url: https://example.com
maxSSLExpiry: 720 # Alert if cert expires within 30 days (720 hours)
Response Time Threshold
http-latency-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: api-latency
spec:
interval: 30
http:
- name: api-response-time
url: https://api.example.com/data
thresholdMillis: 500 # Alert if response takes > 500ms
Authentication
http-auth-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: authenticated-api
spec:
interval: 60
http:
- name: secure-api
url: https://api.example.com/secure
authentication:
username:
valueFrom:
secretKeyRef:
name: api-credentials
key: username
password:
valueFrom:
secretKeyRef:
name: api-credentials
key: password
Request Chaining

Chain multiple HTTP requests together using dependsOn. This is useful for authentication flows where you need to login first and use the token in subsequent requests.

http-depends-on.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: http-depends-on
spec:
schedule: "@every 5m"
http:
- name: getUuid
url: https://httpbin.flanksource.com/uuid
test:
expr: "code == 200 && json.uuid != ''"

- name: useUuid
url: https://httpbin.flanksource.com/get
dependsOn:
- getUuid
test:
# Verify we can access the output from the previous check
expr: "code == 200 && outputs.getUuid.json.uuid != ''"

See Request Chaining for more details.


Playbook

Use cases:

  • Execute HTTP requests from playbooks for webhooks and API calls
  • Trigger external systems in response to events
http-playbook-action.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: notify-external
spec:
on:
canary:
- name: critical-service
failed: true
actions:
- name: webhook-notification
http:
url: https://hooks.example.com/incident
method: POST
headers:
Content-Type: application/json
body: |
{
"service": "{{.check.name}}",
"status": "{{.check.status}}",
"message": "{{.check.message}}"
}

Scraper

Use cases:

  • Scrape configuration data from REST APIs
  • Import data from external systems into the catalog
http-scraper.yaml
apiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: api-config
spec:
schedule: "@every 1h"
http:
- url: https://api.example.com/config
headers:
Authorization: Bearer ${API_TOKEN}
items:
- type: API::Config
id: .id
name: .name

Next Steps