30 Commits

Author SHA1 Message Date
Berthold Höllmann
c33c05ae67 Add support for setting power LED via systemctl (#60)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
* Add support for setting power LED via systemctl

* Add documentation for rudimentary ugreen-power-led.service

* Add "Type=oneshot" and "RemainAfterExit=true" as suggested
2025-06-12 10:14:48 +08:00
Thomas
dc04db484c Don't mark drives in standby as failed (#59)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
The standby return code of smartctl is updated to 0 to avoid detecting it as a failure.
2025-06-07 11:31:44 +08:00
Thomas
276ae34cd1 Update ugreen-diskiomon to ignore smartctl non-critical return codes (#57)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
Smartctl will also return non-zero if it detected past errors even when currently no other errors are observed. It will set up to 8 bits to indicate the differen types of observed results, where bit 5 does not indicate a _current_ error: `SMART status check returned "DISK OK" but some attributes have been at or below threshold in the past.`

The change ignores bit 5 (= 32) when checking the exit code.

Future improvements could detect other bits to color the leds differently depending on the type of error (f.e. bit 4 might indicate a future problem and could turn the led orange instead of red)
2025-06-04 17:33:44 +08:00
docgalaxyblock
15dbae0f8f fix systemd services (#51)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
* move systemd scripts to their own subfolder

* move probe-leds to its own oneshot service

* README improvements
2025-01-11 21:50:36 +08:00
Yuhao Zhou
e0bbe9ee50 Improve the disk standby check (#40)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
2024-11-01 21:36:19 +08:00
Yuhao Zhou
b49da0d890 Add an optional compiled disk activities monitor to reduce the CPU usage (#38)
Some checks are pending
Build kernel module for TrueNAS / build-and-run (push) Waiting to run
2024-10-31 18:24:48 +08:00
gulikoza
af8680ce95 Add support for disk standby. (#37)
Co-authored-by: gulikoza <gulikoza@users.noreply.github.com>
2024-10-31 16:08:09 +08:00
gulikoza
7dd43ccc8d Add SPECS for RHEL8/9 (#33)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
* Fix grep: lsmod changes '-' to underscores.

* Add SPECS for RHEL8/9

Prepare SOURCES:
    download source archive and copy to ~/rpmbuild/SOURCES
    copy SPECS/kmod-led-ugreen.spec to ~/rpmbuild/SPECS

Build with:
    rpmbuild -ba kmod-led-ugreen.spec --define 'kmod_kernel_version (your_kernel_version)'

---------

Co-authored-by: gulikoza <gulikoza@users.noreply.github.com>
2024-10-27 23:25:56 +08:00
Yuhao Zhou
8587b51e76 fix the duplicated calls of ugreen-probe-leds (#25)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
2024-10-03 01:59:58 +08:00
KrzysztofHajdamowicz
0facdf2a6f Adjust systemd units to wait for kernel modules to be loaded (#23)
* Run ugreen-diskiomon.service after kernel modules are loaded

* Run ugreen-netdevmon@.service after kernel module is loaded
2024-09-19 02:30:24 +08:00
Yuhao Zhou
1228d276c3 move the unRAID script to ich777's repo 2024-06-30 20:45:21 +08:00
Yuhao Zhou
3646dd1fd7 add DX4700 support 2024-06-28 23:57:33 +08:00
Yuhao Zhou
10d62c1594 add DXP2800 series (#19) 2024-06-28 03:02:35 +08:00
9282e52e25 bug fixes for the unRAID script (#20)
* Bugfixes

- add missing led_map thanks @miskcoo
- implement functions for modprobe from drivers
- minor changes for logger messages
- add DXP480T and function to set static white LED

* Bugfix for DXP6800

* fix: turn off the light when no disk in a slot (#16)

* Update ugreen-leds

---------

Co-authored-by: Yuhao Zhou <miskcoo@gmail.com>
2024-06-28 01:57:05 +08:00
fb712f3a93 add custom ugreen-leds script for unRAID (#18)
Customize script specifically for unRAID plugin
- remove predefined variables
- send messages to syslog
- determine first available Interface automatically
2024-06-26 01:51:31 +08:00
Benjamin Reich
d7a2f85dc8 fix: config file, and suppress the decvice-probe error (#17)
* suppress write errors

* fix format
2024-06-23 21:03:19 +08:00
Yuhao Zhou
c85084c9f1 fix a copy-paste mistake 2024-06-23 04:00:18 +08:00
Yuhao Zhou
522f93b8cf add ATA disk mapping, zpool check, netdev check, and a config file (#15)
1. Add the config file /etc/ugreen-leds.conf for environment variables used in ugreen-diskiomon (see scripts/ugreen-leds.conf)
2. Make the blinking of netdev activities, colors of different disk states / NIC link speeds configurable
3. Add the check of zpool health
4. Add the check of gateway connectivity and the link speed of network device
5. Split the systemd service to ugreen-diskiomon.service and ugreen-netdevmon@<device name>.service
6. HCTL mapping will fail in some cases (hctl mapping for SATA drives only #14), UGOS uses ATA number to map disks to slots. I changed the default mapping to ATA, which can be shown by the following scripts:
2024-06-22 03:26:26 +08:00
1dbc4c42ae Few changes (#12)
Few changes for unRAID plugin.

- create lock file on script execution
- create function to to remove lockfile and kill subprocess if running
- trap exit from script
- check if environment variables are set for: `mapping_method`, `CHECK_SMART`& `CHECK_SMART_INTERVAL` otherwise use default values
- set `CHECK_SMART` to false if file `/etc/unraid-release` is found (unRAID specific since it check on it's own for smart errors)
- create variable `LED_REFRESH_INTERVAL` for while looop
- run smart check in subprocess
- put `zpool-leds.sh` in a variable to make the while loop a bit more efficient
- remove check for `/sys/class/leds/$led/color` and set color <- I'm not too sure about that one but this path should always exist correct?

* fix some bugs in the smart check loop

* improve the efficiency of ugreen-diskiomon

* Additional changes

- change mpaaing_method to upper case to unify settings which can be set by environment variables
- read config file from plugin with variables (unRAID specific)

---------

Co-authored-by: Yuhao Zhou <miskcoo@gmail.com>
2024-06-20 12:55:40 +08:00
Yuhao Zhou
c12f57f55d update the device detection prompts 2024-06-18 00:59:24 +08:00
Yuhao Zhou
4d108456d6 remove some comments 2024-06-18 00:47:04 +08:00
Yuhao Zhou
23fbde7488 update the hctl_map for DX6800 Pro (#11) 2024-06-18 00:42:24 +08:00
Yuhao Zhou
f161948c51 update the doc about HCTL mapping (#9) 2024-06-17 19:35:57 +08:00
Yuhao Zhou
dbc92dbb0f update the comments in ugreen-diskiomon (#9) 2024-06-16 02:47:34 +08:00
Yuhao Zhou
1dcea8cb3f fix: reading the correct item of write I/Os in /sys/class/<dev>/stat 2024-06-14 14:46:03 +08:00
Yuhao Zhou
5955ad1473 support specifying the network device in the systemd service configuration (#7) 2024-06-12 21:07:10 +08:00
yooooki
05d1b02d71 Added SMART monitoring based on smartctl, and mapped the devices based on HCTL (#5)
* Added disk SMART monitoring to ugreen-diskiomon

Added SMART monitoring based on smartctl. The led now turns red if the corresponding disk fails (smartctl -H does not show PASSED).
Optimized the pooling loop to only iterate the existing drives at the execution of the script
The led will be turned off if no disk in installed in the slot.

* fixed some silly mistake

* Update ugreen-diskiomon

The sata devices are now mapped to leds based on hctl by default.
Added an option to map devices based on serial number. (serial numbers must be manually configured)
Fixed a bug in SMART polling invertal control.
Failed disk will be marked and left untouched. The failure date will be recorded.

* fix an error in ugreen_diskiomon

---------

Co-authored-by: Yuhao Zhou <miskcoo@gmail.com>
2024-06-10 19:15:40 +08:00
Yuhao Zhou
7bd44eed6f update the diskiomon script 2024-06-08 18:17:34 +08:00
Yuhao Zhou
d7f9e85d96 Update README.md 2024-06-08 03:55:24 +08:00
Yuhao Zhou
32243e0dc0 reorganize scripts and add a systemd service for monitoring diskio 2024-06-07 19:13:56 +08:00