Compare commits
18 Commits
main
...
e3be103de6
| Author | SHA1 | Date | |
|---|---|---|---|
| e3be103de6 | |||
| 60b658e837 | |||
| f17e6ef863 | |||
| 71880fc66b | |||
| d37fbb64a1 | |||
| 438523a811 | |||
| 530755db90 | |||
| 2b6af1ca7a | |||
| fcdd94c94b | |||
| 3ff8edfd3a | |||
| 4acfbb80dd | |||
| 0d34d7cb0d | |||
| 8aad6a6936 | |||
| 021b7e70af | |||
| 676918e686 | |||
| b346279b04 | |||
| 08020ef3ce | |||
| 25536e0842 |
19
docker/build.sh
Executable file
19
docker/build.sh
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
GIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
docker-compose stop routermon
|
||||||
|
docker-compose stop upsmon
|
||||||
|
docker container prune
|
||||||
|
|
||||||
|
echo "Building UPSmon"
|
||||||
|
cp ../pyutils/utils.py ../upsmon/
|
||||||
|
docker build --build-arg BUILD_VER=${GIT_HASH} -f ../upsmon/upsmon.Dockerfile -t upsmon:influx3 ../upsmon
|
||||||
|
rm ../upsmon/utils.py
|
||||||
|
|
||||||
|
echo "Building Routermon"
|
||||||
|
cp ../pyutils/utils.py ../routermon/
|
||||||
|
docker build --build-arg BUILD_VER=${GIT_HASH} -f ../routermon/routermon.Dockerfile -t routermon:influx3 ../routermon
|
||||||
|
rm ../routermon/utils.py
|
||||||
|
|
||||||
|
docker-compose up -d
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
GIT_HASH=$(git rev-parse --short HEAD)
|
|
||||||
|
|
||||||
cp ../pyutils/utils.py ../upsmon/
|
|
||||||
cp ../pyutils/utils.py ../routermon/
|
|
||||||
|
|
||||||
docker compose build --build-arg BUILD_VER=${GIT_HASH}
|
|
||||||
|
|
||||||
rm ../upsmon/utils.py
|
|
||||||
rm ../routermon/utils.py
|
|
||||||
|
|
||||||
docker compose up -d
|
|
||||||
@@ -3,10 +3,6 @@ services:
|
|||||||
image: influxdb:3-core
|
image: influxdb:3-core
|
||||||
container_name: edx-influxdb3
|
container_name: edx-influxdb3
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ulimits:
|
|
||||||
nofile:
|
|
||||||
soft: 65536
|
|
||||||
hard: 65536
|
|
||||||
ports:
|
ports:
|
||||||
- 8181:8181
|
- 8181:8181
|
||||||
command:
|
command:
|
||||||
@@ -42,12 +38,7 @@ services:
|
|||||||
max-file: "5"
|
max-file: "5"
|
||||||
|
|
||||||
upsmon:
|
upsmon:
|
||||||
build:
|
image: upsmon:influx3
|
||||||
context: ../upsmon
|
|
||||||
dockerfile: ../upsmon/upsmon.Dockerfile
|
|
||||||
args:
|
|
||||||
BUILD_VER:
|
|
||||||
#image: upsmon:influx3
|
|
||||||
container_name: edx-upsmon
|
container_name: edx-upsmon
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -63,7 +54,7 @@ services:
|
|||||||
- INTERVAL=5
|
- INTERVAL=5
|
||||||
- INFLUXDB_TOKEN=apiv3_tbEpA8JmIRTfr8Wbw9npD79BcMlFsnV4_jhdt-CdUP53Mos61KBODGaggl2g5oKZZvZrZu3e6mpob6zorhEdbg
|
- INFLUXDB_TOKEN=apiv3_tbEpA8JmIRTfr8Wbw9npD79BcMlFsnV4_jhdt-CdUP53Mos61KBODGaggl2g5oKZZvZrZu3e6mpob6zorhEdbg
|
||||||
- INFLUXDB_URL=http://influxdb3:8181
|
- INFLUXDB_URL=http://influxdb3:8181
|
||||||
- INFLUXDB_DATABASE=edelweiss30d
|
- INFLUXDB_DATABASE=edelweiss
|
||||||
- PORT=/dev/ttyS0
|
- PORT=/dev/ttyS0
|
||||||
- BAUD=2400
|
- BAUD=2400
|
||||||
- LOG_FILE=/tmp/upsmon.log
|
- LOG_FILE=/tmp/upsmon.log
|
||||||
@@ -71,12 +62,7 @@ services:
|
|||||||
- LOG_CLI_LVL=INFO
|
- LOG_CLI_LVL=INFO
|
||||||
|
|
||||||
routermon:
|
routermon:
|
||||||
build:
|
image: routermon:influx3
|
||||||
context: ../routermon
|
|
||||||
dockerfile: ../routermon/routermon.Dockerfile
|
|
||||||
args:
|
|
||||||
BUILD_VER:
|
|
||||||
#image: routermon:influx3
|
|
||||||
container_name: edx-routermon
|
container_name: edx-routermon
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -90,7 +76,7 @@ services:
|
|||||||
- INTERVAL=5
|
- INTERVAL=5
|
||||||
- INFLUXDB_TOKEN=apiv3_tbEpA8JmIRTfr8Wbw9npD79BcMlFsnV4_jhdt-CdUP53Mos61KBODGaggl2g5oKZZvZrZu3e6mpob6zorhEdbg
|
- INFLUXDB_TOKEN=apiv3_tbEpA8JmIRTfr8Wbw9npD79BcMlFsnV4_jhdt-CdUP53Mos61KBODGaggl2g5oKZZvZrZu3e6mpob6zorhEdbg
|
||||||
- INFLUXDB_URL=http://influxdb3:8181
|
- INFLUXDB_URL=http://influxdb3:8181
|
||||||
- INFLUXDB_DATABASE=edelweiss30d
|
- INFLUXDB_DATABASE=edelweiss
|
||||||
- MIKROTIK_IP=192.168.31.1
|
- MIKROTIK_IP=192.168.31.1
|
||||||
- MIKROTIK_USER=service
|
- MIKROTIK_USER=service
|
||||||
- MIKROTIK_PASSWORD=dataservice
|
- MIKROTIK_PASSWORD=dataservice
|
||||||
|
|||||||
@@ -65,10 +65,7 @@ def main() -> int:
|
|||||||
if_stats_old = if_stats
|
if_stats_old = if_stats
|
||||||
LOGGER.debug(f"\nInterfaces: {json.dumps(if_stats, indent = 2)}")
|
LOGGER.debug(f"\nInterfaces: {json.dumps(if_stats, indent = 2)}")
|
||||||
LOGGER.debug(f"\nResources: {json.dumps(hw_stats, indent = 2)}")
|
LOGGER.debug(f"\nResources: {json.dumps(hw_stats, indent = 2)}")
|
||||||
last: float = time.time()
|
time.sleep(INTERVAL-(last-now))
|
||||||
cycle_time: float = last - now
|
|
||||||
LOGGER.debug(f"Cycle Time: {cycle_time:4.3f}")
|
|
||||||
time.sleep(INTERVAL-cycle_time)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Unexpected exception: [{e}]")
|
print(f"Unexpected exception: [{e}]")
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user