Monitoring API disini menggunakan beberapa services seperti Grafana (Visualiasi & Anomali Detector), Prometheus (Database), Blackbox Exporter (Sensor Pengumpul Data) dan Hermes (Send Notification ke Broker). Poin inti dari Monitoring API ini adalah :
- API Status
- API Response Time dan Latency
- Mengembalikan response yang tidak sesuai
Beberapa services tersebut dijalankan diatas docker dan berikut file konfigurasi yang perlu disiapkan.
1. Example konfigurasi Blacbox Exporter untuk method GET API (blackbox_expoter.yml).
modules: http-2xx-get-token: prober: http timeout: 15s http: valid_http_versions: ["HTTP/1.1", "HTTP/2"] valid_status_codes: [200] method: GET headers: Authorization: Bearer <Token> no_follow_redirects: false fail_if_ssl: false fail_if_not_ssl: false tls_config: insecure_skip_verify: false preferred_ip_protocol: "ip4"
2. Example konfigurasi Prometheus sebagai Data Source (prometheus.yml) dan service docker compose disini.
global: scrape_interval: 15s evaluation_interval: 15sscrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] - job_name: 'exporter-get' scrape_interval: 1m metrics_path: /probe params: module: [http-2xx-get-token] static_configs: - targets: - <URL API yang dijadikan target monitoring> relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: blackbox-exporter:9115
Link Referensi :
https://medium.com/@haidlir/monitoring-rest-api-rakit-sendiri-stack-nya-7da12f845adb
https://sysadmins.co.za/install-blackbox-exporter-to-monitor-websites-with-prometheus
https://devconnected.com/how-to-install-and-configure-blackbox-exporter-for-prometheus







