diff --git a/README.md b/README.md index 5ba4f8b..67ba783 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,18 @@ This Ansible Role will set up a Matt-Cloud host as a SSD health monitoring platform. -When the GUI is not installed, the terminal will auto login and show the information for the currently attached drives +When the GUI is not installed and it is requested, the terminal will auto login and show the information for the currently attached drives. -The data is also stored locally and can be viewed on a web dashboard at port 8088. +The historical data is stored locally in a SQLite database which is managed by a Python Flask API. It can be viewed on a web dashboard at port 80. -When deployed with Matt-Cloud Jenkins there is a Chromium kiosk option that will allow this web dashboard to be deployed as a local kiosk. +There is a live dashboard of currently attched drives on port 3000. This will show all attached drives along with the health data for these drives. This uses a websocket to live-update the data. The catch is I haven't learned how to mix PHP and Node.js sites yet, thus the multiple ports. It sounds to me like the next part of this project is another web server container that is a proxy with both pages. That does not exist yet. -The daabase is handled by the python service now. +There may be issues with some of the status commands due to hardware differences. I have only found an issue when using the NanoPi devices and have included the corrected string. journalctl is your friend, get to know it. + +When deployed with Matt-Cloud Jenkins there is a Chromium kiosk option that will allow the live dashboard to be deployed as a local kiosk. Instead of using an API key with the python service, I am binding everything to the docker interface to keep it unreachable externally. It's easier and good enough, it's not like this is the nuclear codes or anything. -https://jenkins.matt-cloud.com/job/Projects/job/SSD%20Health%20Checker/ \ No newline at end of file +https://jenkins.matt-cloud.com/job/Projects/job/SSD%20Health%20Checker/ + + + diff --git a/defaults/main.yaml b/defaults/main.yaml index 561bb75..3294ad9 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -7,21 +7,27 @@ ssd_health_packages: - python3-packaging - python3-venv - sqlite3 + - jq # autologin vars autologin_password: "kingduy" autologin: true autologin_user: "ssd_health" -# php container vars -container_name: "ssd_dashboard" -container_http_port: "80" -extra_volumes: "" +# the docker-compose file is about to get too complicated to be a template +# # php container vars +# container_name: "ssd_dashboard" +# container_http_port: "80" +# extra_volumes: "" # api service vars api_service_name: "drive_index" api_service_folder: "{{ service_folder }}" api_service_exe: "{{ service_folder }}/venv/bin/python -u {{ service_folder }}/app.py" +extra_options: | + After=docker.service + BindsTo=docker.service + ReloadPropagatedFrom=docker.service # kiosk service vars kiosk_service_name: "drive_check" @@ -43,5 +49,7 @@ sleep_time: "5" install_kiosk: false quick_refresh: false service_only: false +armcpu_check: false +service_mode: false ... \ No newline at end of file diff --git a/files/dashboard/index.php b/files/dashboard/index.php index 6744a76..1bafe84 100644 --- a/files/dashboard/index.php +++ b/files/dashboard/index.php @@ -18,6 +18,7 @@ function fetchSSDData() { return json_decode($result, true); // Decode JSON as an associative array } + ?> @@ -28,60 +29,51 @@ function fetchSSDData() {
+ This lists every disk ever scanned by this device.
+
this link.
"; $ssdData = fetchSSDData(); // Fetch data from the API - echo '
| - Disk ID: - | - {$ssd['id']} - |
| - Model String: - | - {$ssd['model']} - |
| - Serial Number: - | - {$ssd['serial']} - |
| - TB Written: - | - {$ssd['TBW']} - |
| - Disk Capacity: - | - {$ssd['capacity']} - |
| - Disk Flavor: - | - {$ssd['flavor']} - |
| - SMART Result: - | - {$ssd['smart']} - |
| Disk ID | +Model String | +Serial Number | +TB Written | +Disk Capacity | +Disk Flavor | +SMART Result | +
|---|---|---|---|---|---|---|
| {$id} | +{$model} | +{$serial} | +{$tbw} | +{$cap} | +{$flavor} | +{$smart} | +