漏水モニタリング用のダッシュボードを作る
SORACOM Harvest Data,Harvest Filesの有効化
対象のSIMのグループを選択
SORACOM Harvest Data設定を有効化(on)して「保存」
SORACOM Harvest Files設定を有効化(on)、HARVEST DATA連携をonして、連携対象のファイルパスに「camera_images」を入力して「保存」
料金の発生に注意
SORACOM Lagoonにアクセス
「メニュー」(左上) -> 「データ収集・蓄積・可視化」 -> 「SORACOM Lagoon」
SORACOM Lagoon3コンソールにアクセス
SORACOM Lagoon3にログイン
emailとパスワードを入力して Log in
IMSIをコピペ
以下のテンプレートをコピーし、テキストエディタに貼り付け
{
"__inputs": [
{
"name": "DS_HARVEST",
"label": "Harvest",
"description": "",
"type": "datasource",
"pluginId": "harvest-backend-datasource",
"pluginName": "harvest-backend"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "9.3.9"
},
{
"type": "datasource",
"id": "harvest-backend-datasource",
"name": "harvest-backend",
"version": "1.0.0"
},
{
"type": "panel",
"id": "soracom-dynamic-image-panel",
"name": "Soracom Dynamic Image Panel",
"version": "0.0.1"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 28,
"panels": [],
"title": "漏水センサ状況一覧",
"type": "row"
},
{
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"10": {
"color": "red",
"index": 1,
"text": "漏水検知"
},
"11": {
"color": "green",
"index": 0,
"text": "正常"
},
"20": {
"color": "red",
"index": 3,
"text": "死活監視異常検知"
},
"21": {
"color": "green",
"index": 2,
"text": "死活監視異常検知解除"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "notification_type_01"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ1"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_02"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ2"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_03"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ3"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_04"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ4"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_05"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ5"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_06"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ6"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_07"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ7"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_08"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ8"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_09"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ9"
}
]
},
{
"matcher": {
"id": "byName",
"options": "notification_type_10"
},
"properties": [
{
"id": "displayName",
"value": "漏水センサ10"
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 24,
"x": 0,
"y": 1
},
"id": 2,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.3.9",
"targets": [
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_01",
"refId": "A",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
},
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"hide": false,
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_02",
"refId": "B",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
},
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"hide": false,
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_03",
"refId": "C",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
},
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"hide": false,
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_04",
"refId": "D",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
}
],
"title": "漏水検知状況",
"type": "stat"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 7
},
"id": 4,
"panels": [],
"title": "漏水検知履歴",
"type": "row"
},
{
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"displayMode": "auto",
"inspect": false
},
"mappings": [
{
"options": {
"10": {
"index": 1,
"text": "漏水検知"
},
"11": {
"index": 0,
"text": "正常"
},
"20": {
"index": 3,
"text": "死活監視異常検知"
},
"21": {
"index": 2,
"text": "死活監視異常検知解除"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "notification_type_01"
},
"properties": [
{
"id": "custom.width",
"value": 0
}
]
},
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "custom.width",
"value": 145
}
]
}
]
},
"gridPos": {
"h": 14,
"w": 6,
"x": 0,
"y": 8
},
"id": 6,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 0,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Time"
}
]
},
"pluginVersion": "9.3.9",
"targets": [
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_01",
"refId": "A",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
}
],
"title": "センサ1",
"type": "table"
},
{
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto",
"inspect": false
},
"mappings": [
{
"options": {
"10": {
"index": 1,
"text": "漏水検知"
},
"11": {
"index": 0,
"text": "正常"
},
"20": {
"index": 3,
"text": "死活監視異常検知"
},
"21": {
"index": 2,
"text": "死活監視異常検知解除"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "custom.width",
"value": 159
}
]
}
]
},
"gridPos": {
"h": 14,
"w": 6,
"x": 6,
"y": 8
},
"id": 7,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 0,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Time"
}
]
},
"pluginVersion": "9.3.9",
"targets": [
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_02",
"refId": "A",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
}
],
"title": "センサ2",
"type": "table"
},
{
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto",
"inspect": false
},
"mappings": [
{
"options": {
"10": {
"index": 0,
"text": "漏水検知"
},
"11": {
"index": 1,
"text": "正常"
},
"20": {
"index": 2,
"text": "死活監視異常検知"
},
"21": {
"index": 3,
"text": "死活監視異常検知解除"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "custom.width",
"value": 157
}
]
}
]
},
"gridPos": {
"h": 14,
"w": 6,
"x": 12,
"y": 8
},
"id": 8,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 0,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Time"
}
]
},
"pluginVersion": "9.3.9",
"targets": [
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_03",
"refId": "A",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
}
],
"title": "センサ3",
"type": "table"
},
{
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto",
"inspect": false
},
"mappings": [
{
"options": {
"10": {
"index": 0,
"text": "漏水検知"
},
"11": {
"index": 1,
"text": "正常"
},
"20": {
"index": 2,
"text": "死活監視異常検知"
},
"21": {
"index": 3,
"text": "死活監視異常検知解除"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "custom.width",
"value": 158
}
]
}
]
},
"gridPos": {
"h": 14,
"w": 6,
"x": 18,
"y": 8
},
"id": 9,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 0,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Time"
}
]
},
"pluginVersion": "9.3.9",
"targets": [
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "standard",
"devicetype": "subscribers",
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "notification_type_04",
"refId": "A",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
}
],
"title": "センサ4",
"type": "table"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 22
},
"id": 26,
"panels": [],
"title": "現場画像",
"type": "row"
},
{
"backgroundMeta": {
"height": 1024,
"url": "/api/datasources/1/resources/proxy/v1/files/private/images/pic4_202401231421.png",
"width": 1024
},
"backgroundSize": "contain",
"basicAuth": false,
"basicAuthPassword": "",
"basicAuthUsername": "",
"bgimage": "",
"bgimageSuffix": ".png",
"bustCache": false,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"displayImage": 0,
"fixRatio": true,
"gridPos": {
"h": 13,
"w": 12,
"x": 0,
"y": 23
},
"height": "400px",
"id": 22,
"language": "english",
"mode": "harvest_files",
"series": [],
"seriesList": [],
"targets": [
{
"browser": true,
"datasource": {
"type": "harvest-backend-datasource",
"uid": "${DS_HARVEST}"
},
"datatype": "table",
"devicetype": "subscribers",
"latprop": "",
"lngprop": "",
"pro": false,
"properties": "",
"refId": "A",
"target": "${IMSI}",
"type": "timeSeriesQuery",
"withStreaming": false
}
],
"title": "Panel Title",
"type": "soracom-dynamic-image-panel",
"urlValue": "A-url",
"valueMaps": {
"A-Time": {
"name": "A-Time",
"value": 1706901887826
},
"A-keepalive_01": {
"name": "A-keepalive_01",
"value": 0
},
"A-keepalive_02": {
"name": "A-keepalive_02"
},
"A-keepalive_03": {
"name": "A-keepalive_03"
},
"A-keepalive_04": {
"name": "A-keepalive_04"
},
"A-leakage01": {
"name": "A-leakage01"
},
"A-leakage02": {
"name": "A-leakage02"
},
"A-leakage03": {
"name": "A-leakage03"
},
"A-leakage04": {
"name": "A-leakage04"
},
"A-leakage_01": {
"name": "A-leakage_01"
},
"A-leakage_02": {
"name": "A-leakage_02"
},
"A-leakage_03": {
"name": "A-leakage_03"
},
"A-leakage_04": {
"name": "A-leakage_04"
},
"A-notification_time_01": {
"name": "A-notification_time_01",
"value": "Fri, 02 Feb 2024 19:24:47 GMT"
},
"A-notification_time_02": {
"name": "A-notification_time_02"
},
"A-notification_time_03": {
"name": "A-notification_time_03"
},
"A-notification_time_04": {
"name": "A-notification_time_04"
},
"A-notification_type_01": {
"name": "A-notification_type_01",
"value": 21
},
"A-notification_type_02": {
"name": "A-notification_type_02"
},
"A-notification_type_03": {
"name": "A-notification_type_03"
},
"A-notification_type_04": {
"name": "A-notification_type_04"
},
"A-sensor_id": {
"name": "A-sensor_id",
"value": 1
}
},
"variables": [],
"width": "100px"
}
],
"refresh": "5s",
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-2d",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "漏水センサダッシュボード",
"uid": "r-MfneKSz2",
"version": 6,
"weekStart": ""
}
${IMSI}を先ほどコピーしたIMSI番号で置き換える。
sedコマンドや、テキストエディタの置換機能を利用する。
Dashboardのインポート
${IMSI}書き換え後jsonをクリップボードに貼り付け、「import vei panel json」にペーストし、「Load」
Harvestを選択して「Import」
Inport直後にエラーが出るが、左側メニューのdashboardsボタンをクリックすると、「漏水センサダッシュボード」ができている。
データが入っていない場合のダッシュボードの表示
データ送信が開始されると、ダッシュボードにデータが表示される。
Alert設定
Alert rulesの設定(漏水検知)
「Alerting」 -> 「Alert rules」
Nes alert ruleをクリック
「1 Set a query and alert condition」のAの系列は左から順番に、Air、SIM管理画面のSIMの名前、Standard、leak_01を選択する。
Bの系列は、
Function:Last
Input:A
Mode:Drop Non-numeric Values
として、Alert conditionをクリックする
「2 Alert evaluation behavior」は以下のように設定
Evaruate every :1m
for : 0m
Alert state if no data or all values are null : No Data
Alert state if execution error or timeout : Error
「3 Add details for your alert」は以下のように設定
Rule name : 漏水検知1
Folder : 「+add new」からLeakage sensor
Group : No.1
Summary : センサ1で漏水を検知しました
Dashboard UID : r-MfneKSz2
Panel ID : 2
「4 Notifications」のCustom Labelsは
LabelにSensor1と入力し、Enter
= leakを入力し、Enter
Save and exit
同様に他3つのセンサも設定を行う
Alert rulesの設定(死活監視)
Nes alert ruleをクリック
「1 Set a query and alert condition」のAの系列は左から順番に、Air、SIM管理画面のSIMの名前、Standard、dead_01を選択する。
Bの系列は、先ほどと全く同じで、
Function:Last
Input:A
Mode:Drop Non-numeric Values
として、Alert conditionをクリックする
「2 Alert evaluation behavior」の設定は先ほどと全く同じ
「3 Add details for your alert」は以下のように設定
Rule name : 死活監視1
Folder :Leakage sensor
Group : No.1
Summary : センサ1で漏水を検知しました
Dashboard UID : r-MfneKSz2
Panel ID : 2
「4 Notifications」のCustom Labelsは
LabelにSensor1を選択
= deadを入力し、Enter
Save and exit
同様に他3つのセンサも設定を行う
全部で合計8つのルールができたらOKです。
contact points(メール送付先と本文)の設定
「+ New contact point をクリック」
Name:何の配信先かわかりやすい名前
Contact point type:今回はメールなのでEmail
Addresses:セミコロン区切りで、メールアドレスを入力
subject:メールの件名(今回は、漏水検知メール)
その他は空欄(デフォルトの設定が反映される)
「Save contact point」をクリックして保存
notification policies()の設定
以下を設定
label : grafana_folder
Operator : =
Value : Leakage sensor
Contact point : 漏水検知メール配信
「Save policy」をクリック
以下のような状態になれば設定完了
Discussion