監視
Edge の稼働状態を確認する標準的な手順。
REST エンドポイント
| エンドポイント | 認証 | 用途 |
|---|---|---|
GET /api/v1/system/health | 不要 | 8 コンポーネント (cassandra/redis/mqtt/node_red/opc_ua/edge_core/tse/grafana) の TCP probe + 総合 status。DEGRADED の場合 HTTP 503 — OTA / k8s probe に推奨 |
GET /api/v1/system/ready | 不要 | monitor + V5 api_client の準備状態 |
GET /api/v1/system/version | 不要 | Metadata.VERSION + BUILD_DATE + image_tag + container_mode — fleet inventory に推奨 |
GET /api/v1/edge | 必要 | Edge 識別 / バージョン / 稼働時間 / 累計送信件数 |
GET /api/v1/monitoring | 必要 | システムメトリクス (CPU / メモリ / ディスク / ネットワーク / JVM) |
GET /api/v1/opc | 必要 | OPC 別の接続状態 / スキャン状態 / point 累計数 |
GET /api/v1/opc/{opcId}/tag | 必要 | タグの最終値 / 時刻 / read status |
GET /api/v1/transfer | 必要 | 送信チャネルのヘルス (API/MQTT/Sparkplug、キュー深さ) |
Edge ヘルスの 1 行点検
curl -s http://<edge-host>/api/v1/edge | jq '{started, uptime_ms, sended_count, version}'
{
"started": true,
"uptime_ms": 124500,
"sended_count": 8063,
"version": "2025"
}
sended_count が時間とともに増加していれば、キュー → 送信パイプラインが動作中です。
OPC 別の状態
curl -s http://<edge-host>/api/v1/opc \
| jq '.data.data[] | {opc_id, opc_type, connection_status, scan_status, tag_count, point_count}'
| フィールド | 取り得る値 / 意味 |
|---|---|
connection_status | CONNECTED / DISCONNECTED / ERROR |
scan_status | START / STOP (スケジューラ状態) |
tag_count | 登録済みタグ数 |
point_count | 累計収集 Point (再起動時にリセット) |
問題のある OPC のみを素早く確認する:
curl -s http://<edge-host>/api/v1/opc \
| jq '.data.data[] | select(.connection_status != "CONNECTED")'
タグ別の最終値
curl -s http://<edge-host>/api/v1/tag/<TAG_ID>/value | jq
{
"result": "OK",
"data": {
"tag_id": "TAG_UA_0004",
"value": "28.9688",
"value_time": "2026-05-06 20:59:39.000",
"value_read_status": "SUCCESS",
"value_read_error_message": ""
}
}
value_read_status が ERROR の場合は value_read_error_message で原因を特定します。
システムメトリクス
curl -s http://<edge-host>/api/v1/monitoring | jq '.data | {cpu_usage, memory_usage, disk_usage, thread_count}'
MonitorBean の全フィールドをそのまま公開します (アプリのビルド時点のフィールドセットにより異なります)。
Sparkplug の検証
sparkplug.enable=true の場合、paho-mqtt などの外部クライアントで spBv1.0/# を購読して確認できます。
# 간단한 체크 스니펫 (참고용)
import os
import paho.mqtt.client as mqtt
def on_message(c, u, m):
print(m.topic, len(m.payload))
c = mqtt.Client()
c.username_pw_set(os.environ["MQTT_USER"], os.environ["MQTT_PASSWORD"])
c.on_message = on_message
c.connect("<edge-host>", 1883)
c.subscribe("spBv1.0/#")
c.loop_forever()
期待値:
| トピック | 頻度 |
|---|---|
spBv1.0/<group>/NBIRTH/<edge> | 起動時に 1 回 |
spBv1.0/<group>/DBIRTH/<edge>/<opc> | 起動時に OPC 数だけ |
spBv1.0/<group>/DDATA/<edge>/<opc> | 1 Point ごとに 1 件 |
spBv1.0/<group>/NDEATH/<edge> | 終了時に 1 回 (または will による自動) |
ログのキーワード
catalina.out ベースの grep パターン:
| パターン | 意味 |
|---|---|
Cassandra connected | DB OK |
MQTT connected | MQTT broker OK |
[SparkPlug] CONNECT / NBIRTH | SPB ライフサイクル |
LS connect success / LS connect failed | LS ドライバ接続 |
OPCUA connect | OPCUA ドライバ接続 |
PLC_READ_TIMEOUT_EXCEPTION | Modbus タイムアウト |
restartCollector | OPC の追加/修正/削除後の collector 再起動 |
WARN | しきい値超過 (connection_warn_ms など) |
送信統計 — /api/v1/transfer
すでに提供されているエンドポイントです。レスポンス例:
{
"queue_depth": 1234,
"queue_capacity": 10000,
"transfers": [
{ "type": "API", "status": "OK", "sent": 12345, "errors": 0 },
{ "type": "MQTT", "status": "OK", "connected": true, "topic": "/edge/point" },
{ "type": "Sparkplug", "status": "OK", "connected": true, "bdSeq": 3, "seq": 142, "devices": 10 }
]
}
追加され次第、本ページの使用例を更新します。