1
0
Fork 0

Initial commits for lecture theatre audio source

master
Ambrose Chua 2020-03-16 23:01:10 +08:00
parent b3490f14d7
commit 9f5dba9a2a
17 changed files with 845 additions and 23 deletions

View File

@ -1,7 +1,8 @@
[recorders]
x220-01 ansible_host=fd11:f055:a514::2 ansible_user=opentech room_type=setup2 room_id= webcam_name=usb-046d_HD_Pro_Webcam_C920_CEB3336F
x230-01 ansible_host=fd11:f055:a514::3 ansible_user=opentech room_type= room_id= webcam_name=usb-046d_HD_Pro_Webcam_C920_50EBAE4F
ansible_host=fd11:f055:a514::4 ansible_user=opentech room_type= room_id= webcam_name=
ansible_host=fd11:f055:a514::5 ansible_user=opentech room_type= room_id= webcam_name=
ansible_host=fd11:f055:a514::6 ansible_user=opentech room_type= room_id= webcam_name=
x220-02 ansible_host=fd11:f055:a514::7 ansible_user=opentech room_type= room_id= webcam_name=usb-046d_HD_Pro_Webcam_C920_312AF46F
x220-01 ansible_host=fd11:f055:a514::2 ansible_user=opentech room_type=setup1 room_id=eventhall2-1 webcam_name=usb-046d_HD_Pro_Webcam_C920_50EBAE4F
x230-01 ansible_host=fd11:f055:a514::3 ansible_user=opentech room_type=setup3 room_id=lecturetheatre webcam_name=usb-046d_HD_Pro_Webcam_C920_CEB3336F
x240-01 ansible_host=fd11:f055:a514::4 ansible_user=opentech room_type=setup1 room_id=eventhall2-2 webcam_name=
x240-02 ansible_host=fd11:f055:a514::5 ansible_user=opentech room_type=setup2 room_id=trainingroom2-1 webcam_name=
x240-03 ansible_host=fd11:f055:a514::6 ansible_user=opentech room_type=setup2 room_id=trainingroom2-2 webcam_name=
[audio_source]
x220-02 ansible_host=fd11:f055:a514::7 ansible_user=opentech room_type=setup3 room_id= webcam_name=usb-046d_HD_Pro_Webcam_C920_312AF46F

View File

@ -17,4 +17,4 @@ node_exporter_enabled_collectors:
# Meta
ansible_python_interpreter: auto
ansible_python_interpreter: /usr/bin/python3

View File

@ -0,0 +1,3 @@
---
autostart: true

View File

@ -1,8 +1,5 @@
---
room_type: unknown
room_id: unknown
# Overwrite in inventory if cannot cope
record_profile: 720p
# Overwrite in inventory if want to use more storage to use less CPU

View File

@ -1,13 +1,19 @@
---
- hosts: recorders
- hosts: all
roles:
- productivity
- laptop
- role: cloudalchemy.node-exporter
tags: node_exporter
- hosts: recorders
roles:
- role: laptop
- role: recorder
- role: cloudalchemy.node-exporter
tags: node_exporter
vars:
autostart: false
- hosts: audio_source
roles:
- role: audio_source
vars:
autostart: false

View File

@ -1,12 +1,16 @@
---
- hosts: recorders
- hosts: all
roles:
- productivity
- hosts: recorders
roles:
- role: laptop
- role: recorder
- laptop
- role: cloudalchemy.node-exporter
tags: node_exporter
- hosts: recorders
roles:
- role: recorder
- hosts: audio_source
roles:
- role: audio_source

View File

@ -0,0 +1,19 @@
---
- name: remove existing audio_source network
command:
cmd: nmcli connection delete audio_source
ignore_errors: yes
become: yes
- name: configure audio_source network
command:
cmd: nmcli connection add save yes ifname enp0s25 con-name audio_source type ethernet ipv4.method disabled ipv6.method manual ipv6.addresses "fd12:f055:a514:a0a0::1/64" ipv6.never-default true ipv6.addr-gen-mode eui64 ipv6.ignore-auto-dns yes ipv6.ignore-auto-routes yes
become: yes
when: autostart
- name: enable audio_source network
command:
cmd: nmcli connection up audio_source
become: yes
when: autostart

View File

@ -0,0 +1,3 @@
---
- name: automatically start ffmpeg

View File

@ -0,0 +1,3 @@
---
- include: packages.yml
- include: audio_source.yml

View File

@ -0,0 +1,11 @@
---
- name: install packages required to be an audio_source
become: yes
apt:
state: latest
name:
- ffmpeg
# for NetworkManager in audio_source
- python3-dbus
- libnm-dev

View File

@ -31,7 +31,7 @@ logo='/opt/login-logo.png'
# disable-restart-buttons=true
# - Show a login welcome message
banner-message-enable=true
banner-message-text='Hostname: {{ ansible_hostname }}\n{% if room_type %}Room: {{ room_type }} {{ room_id }}{% endif %}\nUsername: opentech Password: opentech\nUsername: mixer Password: mixer\n{% if autostart %}Mixer Autostart Enabled{% endif %}'
banner-message-text='Hostname: {{ ansible_hostname }}\n{% if room_type %}Room: {{ room_type }} {{ room_id }}{% endif %}\nUsername: opentech Password: opentech\nUsername: mixer Password: mixer\n{% if autostart %}Mixer Autostart Enabled\n{% endif %}'
# Automatic suspend
# =================

View File

@ -0,0 +1,20 @@
---
- name: remove existing audio_source network
command:
cmd: nmcli connection delete audio_source
ignore_errors: yes
become: yes
when: room_id == "lecturetheatre"
- name: configure audio_source network
command:
cmd: nmcli connection add save yes ifname enp0s25 con-name audio_source type ethernet ipv4.method disabled ipv6.method manual ipv6.addresses "fd12:f055:a514:a0a0::2/64" ipv6.never-default true ipv6.addr-gen-mode eui64 ipv6.ignore-auto-dns yes ipv6.ignore-auto-routes yes
become: yes
when: autostart and room_id == "lecturetheatre"
- name: enable audio_source network
command:
cmd: nmcli connection up audio_source
become: yes
when: autostart and room_id == "lecturetheatre"

View File

@ -3,4 +3,5 @@
- include: packages.yml
- include: artwork.yml
- include: obs.yml
- include: audio_source.yml
- include: textfile.yml

View File

@ -6,3 +6,6 @@
state: latest
name:
- obs-studio
# for NetworkManager in audio_source
- python3-dbus
- libnm-dev

View File

@ -1,6 +1,6 @@
---
- name: Log room for node_exporter
- name: log room for node_exporter
become: yes
copy:
content: "room{type=\"{{ room_type }}\",id=\"{{ room_id }}\"} 1\n"
@ -9,3 +9,12 @@
group: root
mode: u=rw,g=r,o=r
- name: save room_type into home
copy:
content: "{{ room_type }}\n"
dest: "/home/opentech/room_type"
- name: save room_id into home
copy:
content: "{{ room_id }}\n"
dest: "/home/opentech/room_id"

View File

@ -34,7 +34,7 @@
{% elif room_type == "setup2" %}
"device_id": "alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo"
{% elif room_type == "setup3" %}
"device_id": "alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo"
"device_id": ""
{% else %}
"device_id": "alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo"
{% endif %}

742
dashboard.json Normal file
View File

@ -0,0 +1,742 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "6.6.2"
},
{
"type": "panel",
"id": "heatmap",
"name": "Heatmap",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1584259937108,
"links": [],
"panels": [
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#B877D9",
"colorScale": "linear",
"colorScheme": "interpolateSpectral",
"exponent": 0.5,
"max": 1,
"min": 0,
"mode": "opacity"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 0,
"y": 0
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 3,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "(up * on(instance) group_left(nodename) (node_uname_info))",
"format": "time_series",
"instant": false,
"intervalFactor": 1,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Up",
"tooltip": {
"show": false,
"showHistogram": false
},
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
},
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"max": 90,
"min": 50,
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 6,
"y": 0
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 2,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "avg by (instance) (node_hwmon_temp_celsius{chip=\"platform_coretemp_0\"}) * on(instance) group_left(nodename) (node_uname_info)",
"format": "time_series",
"instant": false,
"intervalFactor": 1,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Coretemp (℃)",
"tooltip": {
"show": true,
"showHistogram": false
},
"tooltipDecimals": 1,
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
},
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"max": 12,
"min": 0,
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 12,
"y": 0
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 5,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "rate(node_disk_written_bytes_total[1m]) / 1024 / 60 * on(instance) group_left(nodename) (node_uname_info)",
"instant": false,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Disk Write (KB/s)",
"tooltip": {
"show": true,
"showHistogram": false
},
"tooltipDecimals": 1,
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
},
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"max": 0,
"min": -75,
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 18,
"y": 0
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 6,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "-node_filesystem_avail_bytes{mountpoint=\"/\"} / 1024 / 1024 / 1024 * on(instance) group_left(nodename) (node_uname_info)",
"format": "time_series",
"instant": false,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Disk Available (GB)",
"tooltip": {
"show": true,
"showHistogram": false
},
"tooltipDecimals": 1,
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
},
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#5794F2",
"colorScale": "linear",
"colorScheme": "interpolateGreens",
"exponent": 0.5,
"max": 0,
"min": -100,
"mode": "opacity"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 0,
"y": 13
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 7,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "node_wifi_station_signal_dbm * on(instance) group_left(nodename) (node_uname_info)",
"format": "time_series",
"instant": false,
"intervalFactor": 1,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "WiFi RSSI (dBm)",
"tooltip": {
"show": true,
"showHistogram": false
},
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
},
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"max": 9,
"min": 0,
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 6,
"y": 13
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 8,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "node_load1 * on(instance) group_left(nodename) (node_uname_info)",
"format": "time_series",
"instant": false,
"intervalFactor": 1,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Load",
"tooltip": {
"show": true,
"showHistogram": false
},
"tooltipDecimals": 1,
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
},
{
"columns": [],
"datasource": "${DS_PROMETHEUS}",
"fontSize": "100%",
"gridPos": {
"h": 13,
"w": 6,
"x": 12,
"y": 13
},
"id": 11,
"interval": "1m",
"options": {},
"pageSize": null,
"showHeader": true,
"sort": {
"col": null,
"desc": false
},
"styles": [
{
"alias": "",
"align": "auto",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "Time",
"thresholds": [],
"type": "hidden",
"unit": "short"
},
{
"alias": "",
"align": "auto",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "Value",
"thresholds": [],
"type": "hidden",
"unit": "short"
},
{
"alias": "IP",
"align": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 2,
"pattern": "instance",
"preserveFormat": false,
"sanitize": true,
"thresholds": [],
"type": "string",
"unit": "short",
"valueMaps": [
{
"text": "",
"value": ":9100"
}
]
},
{
"alias": "",
"align": "auto",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "job",
"thresholds": [],
"type": "hidden",
"unit": "short"
},
{
"alias": "Name",
"align": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"link": false,
"mappingType": 1,
"pattern": "nodename",
"sanitize": true,
"thresholds": [],
"type": "string",
"unit": "short"
},
{
"alias": "Room Type",
"align": "auto",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "type",
"sanitize": true,
"thresholds": [],
"type": "string",
"unit": "short"
},
{
"alias": "Room Name",
"align": "auto",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "id",
"sanitize": true,
"thresholds": [],
"type": "string",
"unit": "short"
}
],
"targets": [
{
"expr": "room * on(instance) group_left(nodename) (node_uname_info)",
"format": "table",
"instant": true,
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Hosts",
"transform": "table",
"type": "table"
},
{
"cards": {
"cardPadding": null,
"cardRound": null
},
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"max": 0,
"min": -2,
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
"gridPos": {
"h": 13,
"w": 6,
"x": 18,
"y": 13
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 9,
"interval": "1m",
"legend": {
"show": true
},
"options": {},
"reverseYBuckets": false,
"targets": [
{
"expr": "-node_memory_MemFree_bytes / 1024 / 1024 / 1024 * on(instance) group_left(nodename) (node_uname_info)",
"format": "time_series",
"instant": false,
"legendFormat": "{{nodename}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Memory Free (GB)",
"tooltip": {
"show": true,
"showHistogram": false
},
"tooltipDecimals": 3,
"type": "heatmap",
"xAxis": {
"show": true
},
"xBucketNumber": null,
"xBucketSize": null,
"yAxis": {
"decimals": null,
"format": "none",
"logBase": 1,
"max": null,
"min": null,
"show": true,
"splitFactor": null
},
"yBucketBound": "middle",
"yBucketNumber": null,
"yBucketSize": null
}
],
"refresh": "30s",
"schemaVersion": 22,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"datasource": null,
"filters": [],
"hide": 0,
"label": "",
"name": "Filters",
"skipUrlSync": false,
"type": "adhoc"
}
]
},
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Overview",
"uid": "xCFQeAXWk",
"version": 17
}