Compare commits
3 Commits
e3be103de6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a54c8e566b | |||
| db9e2bf87a | |||
| 493cfb1b88 |
@@ -1,19 +0,0 @@
|
|||||||
#!/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
|
|
||||||
13
docker/deploy.sh
Executable file
13
docker/deploy.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/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,6 +3,10 @@ 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:
|
||||||
@@ -38,7 +42,12 @@ services:
|
|||||||
max-file: "5"
|
max-file: "5"
|
||||||
|
|
||||||
upsmon:
|
upsmon:
|
||||||
image: upsmon:influx3
|
build:
|
||||||
|
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:
|
||||||
@@ -54,7 +63,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=edelweiss
|
- INFLUXDB_DATABASE=edelweiss30d
|
||||||
- PORT=/dev/ttyS0
|
- PORT=/dev/ttyS0
|
||||||
- BAUD=2400
|
- BAUD=2400
|
||||||
- LOG_FILE=/tmp/upsmon.log
|
- LOG_FILE=/tmp/upsmon.log
|
||||||
@@ -62,7 +71,12 @@ services:
|
|||||||
- LOG_CLI_LVL=INFO
|
- LOG_CLI_LVL=INFO
|
||||||
|
|
||||||
routermon:
|
routermon:
|
||||||
image: routermon:influx3
|
build:
|
||||||
|
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:
|
||||||
@@ -76,7 +90,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=edelweiss
|
- INFLUXDB_DATABASE=edelweiss30d
|
||||||
- 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,7 +65,10 @@ 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)}")
|
||||||
time.sleep(INTERVAL-(last-now))
|
last: float = time.time()
|
||||||
|
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