Skip to content

Commit

Permalink
ログ送信前の確認を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
helenwangjia committed Jun 5, 2024
1 parent c3010e2 commit f1b2af4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import requests
import zstandard as zstd
import serial
from common.common_config import (
ALLOWED_LOG_EXT, # BACNET_SHELL_COMMAND,
ALLOWED_PCAP_EXT,
Expand Down Expand Up @@ -146,7 +147,17 @@ def handle(self, *args, **options):
# logger.info("sleep " + str(sleep_time) + "s")

try:
send_server(tar_list)
# コア網チェック
with serial.Serial('/dev/ttyUSB1', baudrate=115200, timeout=1) as sara:
sara.write(b'at\r\n')
b=sara.read(16)
cnum=b.decode().split("\n")

if "OK\r" in cnum:
# ログ送信
send_server(tar_list)
else:
logger.error("can not send compressed file. Unable to connect to closed network. ")
except Exception as e:
logger.error("can not send compressed file. " + str(e))

Expand Down
2 changes: 2 additions & 0 deletions osect_sensor/docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ services:
edge_cron:
image: cron:revxxx
build: "./Infrastructure/edge_cron/"
devices:
- "/dev/ttyUSB1:/dev/ttyUSB1"
volumes:
- ./Application/edge_cron:/opt/edge_cron
- pcap-logs-volume:/opt/edge_cron/paper/sc_src/input/pcap/complete/
Expand Down

0 comments on commit f1b2af4

Please sign in to comment.