Skip to content

Commit d0519da

Browse files
authored
Merge pull request #17 from lux4rd0/2.0.06
2.0.06
2 parents c9f0cd8 + f490e03 commit d0519da

File tree

7 files changed

+1292
-435
lines changed

7 files changed

+1292
-435
lines changed

Dockerfile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
# Use an official Python runtime as a parent image
2-
FROM python:3.10.8-slim
2+
FROM python:3.12.3-slim
33

44
# Set the working directory in the container
55
WORKDIR /app
66

7-
# Copy the current directory contents into the container at /usr/src/app
7+
# Copy the current directory contents into the container at /app
88
COPY sense-collector.py .
99
COPY storage.py .
1010
COPY requirements.txt .
1111

12-
# Install any needed packages specified in requirements.txt
13-
14-
RUN apt-get update && \
15-
apt-get install -y gcc python3-dev python3-pip && \
16-
rm -rf /var/lib/apt/lists/*
17-
12+
# Install pip and the Python packages
1813
RUN python3 -m pip install --no-cache-dir --upgrade pip \
19-
&& python3 -m pip install --no-cache-dir -r /app/requirements.txt
14+
&& python3 -m pip install --no-cache-dir -r requirements.txt
2015

21-
# Run script.py when the container launches
16+
# Run sense-collector.py when the container launches
2217
CMD ["python3", "./sense-collector.py"]

LICENSE

Lines changed: 661 additions & 201 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The project is deployed as a Docker container.
2323

2424
Use the following [Docker container](https://hub.docker.com/r/lux4rd0/sense-collector):
2525

26-
lux4rd0/sense-collector:2.0.03
26+
lux4rd0/sense-collector:2.0.06
2727
lux4rd0/sense-collector:latest
2828

2929
Correct environmental variables are required for the container to function.
@@ -47,55 +47,40 @@ To start the docker container, simply update this example compose.yaml file:
4747
container_name: sense-collector-53997
4848
environment:
4949
SENSE_COLLECTOR_API_PASSWORD: CHANGEME
50-
SENSE_COLLECTOR_API_USERNAME: dave@pulpfree.org
50+
SENSE_COLLECTOR_API_USERNAME: dave@lux4rd0.com
5151
SENSE_COLLECTOR_HOST_HOSTNAME: sense-collector.lux4rd0.com
5252
SENSE_COLLECTOR_INFLUXDB_BUCKET: sense
53-
SENSE_COLLECTOR_INFLUXDB_ORG: Tylephony
53+
SENSE_COLLECTOR_INFLUXDB_ORG: Lux4rd0
5454
SENSE_COLLECTOR_INFLUXDB_TOKEN: TOKEN
5555
SENSE_COLLECTOR_INFLUXDB_URL: http://sense-collector.lux4rd0.com:8086
56-
SENSE_COLLECTOR_LOG_LEVEL_API: CRITICAL
57-
SENSE_COLLECTOR_LOG_LEVEL_GENERAL: INFO
58-
SENSE_COLLECTOR_LOG_LEVEL_STORAGE: CRITICAL
59-
SENSE_COLLECTOR_SENSE_API_RECEIVE_DATA_OUTPUT: "False"
6056
TZ: America/Chicago
6157
image: lux4rd0/sense-collector:latest
6258
restart: always
63-
volumes:
64-
- type: bind
65-
source: /mnt/docker/sense-collector/export
66-
target: /app/export
67-
bind:
68-
create_host_path: true
6959

7060
If you don't want to use docker-compose, an example docker run command will be displayed on the screen.
7161

7262
docker run --rm \
7363
--name=sense-collector-53997 \
7464
-e SENSE_COLLECTOR_API_PASSWORD=CHANGEME \
75-
-e SENSE_COLLECTOR_API_USERNAME=dave@pulpfree.org \
65+
-e SENSE_COLLECTOR_API_USERNAME=dave@lux4rd0.com \
7666
-e SENSE_COLLECTOR_HOST_HOSTNAME=sense-collector.lux4rd0.com \
7767
-e SENSE_COLLECTOR_INFLUXDB_BUCKET=sense \
7868
-e SENSE_COLLECTOR_INFLUXDB_ORG=Tylephony \
7969
-e SENSE_COLLECTOR_INFLUXDB_TOKEN=TOKEN \
8070
-e SENSE_COLLECTOR_INFLUXDB_URL=http://sense-collector.lux4rd0.com:8086 \
81-
-e SENSE_COLLECTOR_LOG_LEVEL_API=CRITICAL \
82-
-e SENSE_COLLECTOR_LOG_LEVEL_GENERAL=INFO \
83-
-e SENSE_COLLECTOR_LOG_LEVEL_STORAGE=CRITICAL \
84-
-e SENSE_COLLECTOR_SENSE_API_RECEIVE_DATA_OUTPUT="False" \
8571
-e TZ=America/Chicago \
86-
-v /mnt/docker/sense-collector/export:/app/export \
8772
--restart always \
8873
lux4rd0/sense-collector:latest
8974

9075
Running `docker-compose up -d' or the `docker-run` command will download and start up the sense-collector container.
9176

9277
## Environmental Flags:
9378

94-
The Docker contain can be configured with additional environment flags to control collector behaviors. They are descript below:
79+
The Docker contain can be configured with additional environment flags to control collector behaviors. They are described below:
9580

9681
# Sense Collector Environmental Variables
9782

98-
This document provides a detailed explanation of the environmental variables used to configure the Sense Collector Docker container. Each variable is classified as required or optional, along with its default value and possible options.
83+
This document provides a detailed explanation of the environmental variables used to configure the Sense Collector Docker container. Each variable is classified as required or optional, with its default value and possible options.
9984

10085
## Environmental Variables
10186

@@ -159,12 +144,71 @@ This document provides a detailed explanation of the environmental variables use
159144
- **Default**: INFO
160145
- **Options**: DEBUG, INFO, WARNING, ERROR, CRITICAL
161146

162-
### SENSE_COLLECTOR_SENSE_API_RECEIVE_DATA_OUTPUT
147+
### SENSE_COLLECTOR_OUTPUT_RECEIVED_DATA
163148
- **Description**: Enables or disables the output of received Sense API data to a file.
164149
- **Required**: No
165150
- **Default**: false
166151
- **Options**: true, false
167152

153+
### SENSE_COLLECTOR_WS_HEARTBEAT_INTERVAL
154+
- **Description**: Interval (in seconds) between heartbeat messages to keep the WebSocket connection alive.
155+
- **Required**: No
156+
- **Default**: 10
157+
- **Options**: Integer value representing seconds
158+
159+
### SENSE_COLLECTOR_WS_HEARTBEAT_TIMEOUT
160+
- **Description**: Timeout (in seconds) to wait for a heartbeat response before considering the WebSocket connection as dead.
161+
- **Required**: No
162+
- **Default**: 30
163+
- **Options**: Integer value representing seconds
164+
165+
### SENSE_COLLECTOR_WS_RECONNECT_DELAY_INITIAL
166+
- **Description**: Initial delay (in seconds) before attempting to reconnect the WebSocket after a connection loss.
167+
- **Required**: No
168+
- **Default**: 5
169+
- **Options**: Integer value representing seconds
170+
171+
### SENSE_COLLECTOR_WS_RECONNECT_DELAY_CAP
172+
- **Description**: Maximum delay (in seconds) between reconnection attempts.
173+
- **Required**: No
174+
- **Default**: 60
175+
- **Options**: Integer value representing seconds
176+
177+
### SENSE_COLLECTOR_WS_MAX_RETRIES
178+
- **Description**: Maximum number of retries for reconnecting the WebSocket before giving up.
179+
- **Required**: No
180+
- **Default**: 3
181+
- **Options**: Integer value
182+
183+
### SENSE_COLLECTOR_WS_BACKOFF_FACTOR
184+
- **Description**: Factor for exponential backoff between reconnection attempts.
185+
- **Required**: No
186+
- **Default**: 1
187+
- **Options**: Integer value
188+
189+
### SENSE_COLLECTOR_WS_RECONNECT_INTERVAL
190+
- **Description**: Interval (in seconds) between forced WebSocket reconnections to maintain a fresh connection.
191+
- **Required**: No
192+
- **Default**: 840
193+
- **Options**: Integer value representing seconds
194+
195+
### SENSE_COLLECTOR_DEVICE_CACHE_EXPIRY_SECONDS
196+
- **Description**: Duration (in seconds) for which the device data should be cached before it expires.
197+
- **Required**: No
198+
- **Default**: 120
199+
- **Options**: Integer value representing seconds
200+
201+
### SENSE_COLLECTOR_DEVICE_MAX_CONCURRENT_LOOKUPS
202+
- **Description**: Maximum number of concurrent lookups that can be performed for device data.
203+
- **Required**: No
204+
- **Default**: 4
205+
- **Options**: Integer value
206+
207+
### SENSE_COLLECTOR_DEVICE_LOOKUP_DELAY_SECONDS
208+
- **Description**: Delay (in seconds) between consecutive device data lookup requests.
209+
- **Required**: No
210+
- **Default**: 0.5
211+
- **Options**: Float value representing seconds
168212

169213
## Collector Details
170214

compose.yaml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
name: sense-collector
1+
name: sense-collector-53997
22
services:
3-
sense-collector:
4-
container_name: sense-collector
3+
sense-collector-53997:
4+
container_name: sense-collector-53997
55
environment:
6-
SENSE_COLLECTOR_API_PASSWORD: adkajsdlnaisdjasidamlisdmald
7-
SENSE_COLLECTOR_API_USERNAME: [email protected]
8-
SENSE_COLLECTOR_HOST_HOSTNAME: app20.tylephony.com
6+
SENSE_COLLECTOR_API_PASSWORD: CHANGEME
7+
SENSE_COLLECTOR_API_USERNAME: [email protected]
98
SENSE_COLLECTOR_INFLUXDB_BUCKET: sense
10-
SENSE_COLLECTOR_INFLUXDB_ORG: Tylephony
11-
SENSE_COLLECTOR_INFLUXDB_TOKEN: lkjijdalisdjoanisdnalisdjlamisdjm==
12-
SENSE_COLLECTOR_INFLUXDB_URL: http://influxdb.lux4rd0.com:8086
13-
SENSE_COLLECTOR_LOG_LEVEL_API: CRITICAL
14-
SENSE_COLLECTOR_LOG_LEVEL_GENERAL: INFO
15-
SENSE_COLLECTOR_LOG_LEVEL_STORAGE: CRITICAL
16-
SENSE_COLLECTOR_SENSE_API_RECEIVE_DATA_OUTPUT: "False"
9+
SENSE_COLLECTOR_INFLUXDB_ORG: Lux4rd0
10+
SENSE_COLLECTOR_INFLUXDB_TOKEN: TOKEN
11+
SENSE_COLLECTOR_INFLUXDB_URL: http://sense.lux4rd0.com:8086
1712
TZ: America/Chicago
1813
image: lux4rd0/sense-collector:latest
1914
restart: always
20-
volumes:
21-
- type: bind
22-
source: /mnt/docker/sense-collector/export
23-
target: /app/export
24-
bind:
25-
create_host_path: true

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
aiohttp==3.9.1
22
influxdb_client==1.39.0
3-
psutil==5.9.5
43
python_dateutil==2.8.2
54
pytz==2024.1
65
Requests==2.32.3

0 commit comments

Comments
 (0)