diff --git a/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py b/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py old mode 100644 new mode 100755 index 8097b22..2e1c933 --- a/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py +++ b/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py @@ -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, @@ -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)) diff --git a/osect_sensor/docker-compose.yml b/osect_sensor/docker-compose.yml old mode 100644 new mode 100755 index 51be15d..5612731 --- a/osect_sensor/docker-compose.yml +++ b/osect_sensor/docker-compose.yml @@ -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/