Compare commits

...

1 Commits

7 changed files with 38 additions and 10 deletions

1
.gitignore vendored
View File

@@ -292,6 +292,7 @@ TSWLatexianTemp*
.ipynb_checkpoints/
env/
.env
__pycache__/
test/
venv/

View File

@@ -34,7 +34,13 @@ peertube-collector/
cd peertube-collector
```
2. Build and start the Docker containers:
2. Create and configure the environment file based on the `.env.example` file:
```sh
cp .env.example .env
```
3. Build and start the Docker containers:
```sh
docker-compose up --build
```

View File

@@ -21,6 +21,10 @@ services:
image: telegraf:1.33.1
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
environment:
- DATABASE=${TELEGRAF_MONGODB_DATABASE:?"Database name is required"}
- DSN=${TELEGRAF_MONGODB_DSN:?"DSN is required"}
- HOSTNAME=${TELEGRAF_HOSTNAME:?"Hostname is required"}
networks:
- backend
@@ -34,6 +38,8 @@ services:
condition: service_healthy
telegraf:
condition: service_started
environment:
- VIDEO_URL=${VIDEO_URL:?"Video URL is required"}
networks:
- backend

8
example.env Normal file
View File

@@ -0,0 +1,8 @@
# User defined hostname persisted across all sessions, used to keep track of the same user
TELEGRAF_HOSTNAME=
# MongoDB connection string
TELEGRAF_MONGODB_DSN=
# MongoDB database name to store the data
TELEGRAF_MONGODB_DATABASE=
# URL of the video to be analyzed
VIDEO_URL=

View File

@@ -183,7 +183,12 @@ if __name__ == '__main__':
signal.signal(signal.SIGINT, lambda signum, frame: interrupt_handler(signum, driver))
setupStats(driver, "https://tube.kobim.cloud/w/iN2T8PmbSb4HJTDA2rV3sg")
url = os.getenv('VIDEO_URL')
if url is None:
logger.error('VIDEO_URL environment variable is not set.')
raise SystemExit(1)
setupStats(driver, url)
logger.log(logging.INFO, 'Starting server collector.')
httpd = HTTPServer(('collector', 9092), partial(Handler, downloadStats, driver, logger))

View File

@@ -1,3 +1,7 @@
[agent]
hostname = "${HOSTNAME}"
omit_hostname = false
[[processors.dedup]]
dedup_interval = "600s"
@@ -14,8 +18,7 @@
[inputs.socket_listener.xpath.tags]
url = "url"
session = "session"
#id = ??
#state = ??
host = "host"
[inputs.socket_listener.xpath.fields]
player = "player"
@@ -26,8 +29,6 @@
data_format = "json"
[[outputs.mongodb]]
dsn = "mongodb://stats_user:%40z%5EVFhN7q%25vzit@192.168.86.120:27017/?authSource=statistics"
database = "statistics"
granularity = "seconds"
# docker run --rm -v .\peertube\statnerd\telegraf.conf:/etc/telegraf/telegraf.conf:ro -p 8094:8094/udp telegraf
dsn = "${DSN}"
database = "${DATABASE}"
granularity = "seconds"

View File

@@ -16,7 +16,8 @@ const DEFAULT_OPTIONS = {
gzip: false,
job: "webrtc-internals-exporter",
enabledOrigins: {
"https://tube.kobim.cloud": true,
"http://*/*": true,
"https://*/*": true,
},
enabledStats: ["data-channel", "local-candidate", "remote-candidate"]
};