ledmon

# ledmon

```sh
root@tokunori-desktop:/sys/bus/pci# tail -n 6 /var/log/ledmon.log 
Mar 09 04:30:34   ERROR: controller discovery: /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:0a.0/0000:0b:00.0 - enclosure management not supported.
Mar 09 04:30:34   ERROR: controller discovery: /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:09.0/0000:0a:00.0 - enclosure management not supported.
Mar 09 04:30:34   ERROR: controller discovery: /sys/devices/pci0000:00/0000:00:03.2/0000:0d:00.0 - enclosure management not supported.
Mar 09 04:30:44   ERROR: controller discovery: /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:0a.0/0000:0b:00.0 - enclosure management not supported.
Mar 09 04:30:44   ERROR: controller discovery: /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:09.0/0000:0a:00.0 - enclosure management not supported.
Mar 09 04:30:44   ERROR: controller discovery: /sys/devices/pci0000:00/0000:00:03.2/0000:0d:00.0 - enclosure management not supported.
```

# --list-controllers    -L   Display list of controllers recognizable by ledctl.

```sh
root@tokunori-desktop:/home/tokunori/ledmon#  ./src/ledctl -L
ledctl: controller discovery: /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:0a.0/0000:0b:00.0 - enclosure management not supported.
ledctl: controller discovery: /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:09.0/0000:0a:00.0 - enclosure management not supported.
ledctl: controller discovery: /sys/devices/pci0000:00/0000:00:03.2/0000:0d:00.0 - enclosure management not supported.
```

# help

## 1.1.0

```sh
tokunori@tokunori-desktop:~/ledmon$ ./src/ledctl/ledctl --help
Intel(R) Enclosure LED Control Application 1.1.0 
Copyright (C) 2009-2024 Intel Corporation.

Usage: ledctl --<mode> [option...] ...

Ledctl allows to manipulate LED states for chosen devices or slots.
See 'ledctl --<mode> --help' for help of a specific mode.

Modes:
--get-slot            -G   Print slot details for device/slot.
--ibpi                -I   Indicate IBPI mode, it is used as default.
--list-controllers    -L   Display list of controllers recognizable by ledctl.
--default-controller  -B   Print the preferred supported controller for device.
--list-slots          -P   Print all slots for a controller requested.
--set-slot            -S   Set state for slot/device by controller requested.

Refer to ledctl(8) man page for more detailed description (man ledctl).
Bugs should be reported at: https://github.com/intel/ledmon/issues
```

## 0.97

```sh
tokunori@tokunori-desktop:~/ledmon$ ./src/ledctl --help
Intel(R) Enclosure LED Control Application 0.97 
Copyright (C) 2009-2022 Intel Corporation.

Usage: ledctl [OPTIONS] pattern=list_of_devices ...

Mandatory arguments for long options are mandatory for short options, too.

--listed-only                                                         -x                                      Ledctl will change state only for given devices.
--list-controllers                                                    -L                                      Displays list of controllers detected by ledmon.
--list-slots --controller-type CONTROLLER                             -P -c CONTROLLER                        List slots under the controller type, their led states, slot numbers and devnodes connected.
--get-slot --controller-type CONTROLLER --device DEVNODE / --slot SLOT-G -c CONTROLLER -d DEVNODE / -p SLOT   Prints slot information, its led state, slot number and devnode.
--set-slot --controller-type CONTROLLER --slot SLOT --state STATE     -S -c CONTROLLER -p SLOT -s STATE       Sets given state for chosen slot under the controller.
--log=PATH                                                            -l PATH                                 Use local log file instead /var/log/ledctl.log.
--help                                                                -h                                      Displays this help text.
--version                                                             -v                                      Displays version and license information.
--log-level=VALUE                                                     -l VALUE                                Allows user to set ledctl verbose level in logs.

Patterns:
        Common patterns are:
                locate, locate_off, normal, off, degraded, rebuild,
                failed_array, hotspare, pfa, failure, disk_failed
        SES-2 only patterns:
                ses_abort, ses_rebuild, ses_ifa, ses_ica, ses_cons_check,
                ses_hotspare, ses_rsvd_dev, ses_ok, ses_ident, ses_rm,
                ses_insert, ses_missing, ses_dnr, ses_active, ses_prdfail,
                ses_enable_bb, ses_enable_ba, ses_devoff, ses_fault
        Automatic translation form IBPI into SES-2:
                locate=ses_ident, locate_off=~ses_ident,
                normal=ses_ok, off=ses_ok, degraded=ses_ica,
                rebuild=ses_rebuild, failed_array=ses_ifa,
                hotspare=ses_hotspare, pfa=ses_prdfail, failure=ses_fault,
                disk_failed=ses_fault
Refer to ledctl(8) man page for more detailed description.
Bugs should be reported at: https://github.com/intel/ledmon/issues
```

# example

```sh
tokunori@tokunori-desktop:~/linux$ cat /sys/class/leds/input9\:\:numlock/brightness 
1
tokunori@tokunori-desktop:~/linux$ sudo su 
[sudo] tokunori のパスワード: 
root@tokunori-desktop:/home/tokunori/linux# echo 1 > /sys/class/leds/input9\:\:numlock/brightness 
root@tokunori-desktop:/home/tokunori/linux# echo 0 > /sys/class/leds/input9\:\:numlock/brightness 
root@tokunori-desktop:/home/tokunori/linux# echo 1 > /sys/class/leds/input9\:\:numlock/brightness 
```

# link

https://www.dell.com/support/kbdoc/ja-jp/000148765/pcie-ssdソフトウェアraidドライブ用-linux-で-led-ledctl-ユーティリティー-を使用して-管理-バックプレーン-ledsを-使用-する-us-ledmon-ledctl-utilities-on-linux-to-manage-backplane-drives

https://documentation.suse.com/ja-jp/sles/12-SP5/html/SLES-all/cha-raid-leds.html

https://linux.die.net/man/8/ledmon

https://github.com/intel/ledmon

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-bus-pci#n516

https://github.com/md-raid-utilities/mdadm/