12 Storage enclosure LED utilities for MD software RAIDs #
    
    Storage enclosure LED Monitoring utility (ledmon) and
    LED Control (ledctl) utility are Linux user space
    applications that use a broad range of interfaces and protocols to control
    storage enclosure LEDs. The primary usage is to visualize the status of
    Linux MD software RAID devices created with the mdadm utility. The
    ledmon daemon monitors the status
    of the drive array and updates the status of the drive LEDs. The
    ledctl utility allows you to set LED patterns for
    specified devices.
   
These LED utilities use the SGPIO (Serial General Purpose Input/Output) specification (Small Form Factor (SFF) 8485) and the SCSI Enclosure Services (SES) 2 protocol to control LEDs. They implement the International Blinking Pattern Interpretation (IBPI) patterns of the SFF-8489 specification for SGPIO. The IBPI defines how the SGPIO standards are interpreted as states for drives and slots on a backplane and how the backplane should visualize the states with LEDs.
Some storage enclosures do not adhere strictly to the SFF-8489 specification. An enclosure processor might accept an IBPI pattern but not blink the LEDs according to the SFF-8489 specification, or the processor might support only a limited number of the IBPI patterns.
  LED management (AHCI) and SAF-TE protocols are not supported by the
  ledmon and ledctl utilities.
 
  The ledmon and
  ledctl applications have been verified to work with Intel
  storage controllers such as the Intel AHCI controller and Intel SAS
  controller. They also support PCIe-SSD (solid-state drive) enclosure LEDs to
  control the storage enclosure status (OK, Fail, Rebuilding) LEDs of PCIe-SSD
  devices that are part of an MD software RAID volume. The applications might
  also work with the IBPI-compliant storage controllers of other vendors
  (especially SAS/SCSI controllers); however, other vendors’ controllers have
  not been tested.
 
ledmon and ledctl
  are part of the ledmon package,
  which is not installed by default. Run sudo zypper in
  ledmon to install it.
 
12.1 The storage enclosure LED monitor service #
   The ledmon application is a daemon
   process that constantly monitors the state of MD software RAID devices or
   the state of block devices in a storage enclosure or drive bay. Only a
   single instance of the daemon should be running at a time. The
   ledmon daemon is part of Intel
   Enclosure LED Utilities.
  
The state is visualized on LEDs associated with each slot in a storage array enclosure or a drive bay. The application monitors all software RAID devices and visualizes their state. It does not provide a way to monitor only selected software RAID volumes.
   The ledmon daemon supports two types
   of LED systems: A two-LED system (Activity LED and Status LED) and a
   three-LED system (Activity LED, Locate LED, and Fail LED). This tool has the
   highest priority when accessing the LEDs.
  
   To start ledmon, enter
  
>sudoledmon [options]
where [options] is one or more of the following:
ledmon #- -c PATH,- --confg=PATH
- The configuration is read from - ~/.ledctlor from- /etc/ledcfg.confif existing. Use this option to specify an alternative configuration file.- Currently this option has no effect, since support for configuration files has not been implemented yet. See - man 5 ledctl.conffor details.
- -l PATH , --log=PATH
- Sets a path to local log file. If this user-defined file is specified, the global log file - /var/log/ledmon.logis not used.
- -t SECONDS,- --interval=SECONDS
- Sets the time interval between scans of - sysfs. The value is given in seconds. The minimum is 5 seconds. The maximum is not specified.
- --quiet,- --error,- --warning,- --info,- --debug,- --all
- Specifies the verbosity level. The level options are specified in the order of no information to the most information. Use the - --quietoption for no logging. Use the- --alloption to log everything. If you specify more than one verbose option, the last option in the command applies.
- -h,- --help
- Prints the command information to the console, then exits. 
- -v,- --version
- Displays version of - ledmonand information about the license, then exits.
    The ledmon daemon does not recognize the PFA (Predicted
    Failure Analysis) state from the SFF-8489 specification. Thus, the PFA
    pattern is not visualized.
   
12.2 The storage enclosure LED control application #
   The Enclosure LED Application (ledctl) is a user space
   application that controls LEDs associated with each slot in a storage
   enclosure or a drive bay. The ledctl application is a
   part of Intel Enclosure LED Utilities.
  
   When you issue the command, the LEDs of the specified devices are set to a
   specified pattern and all other LEDs are turned off. This application needs
   to be run with root privileges. Because the
   ledmon application has the
   highest priority when accessing LEDs, some patterns set by
   ledctl might have no effect if the
   ledmon daemon is running (except for
   the Locate pattern).
  
   The ledctl application supports two types of LED systems:
   A two-LED system (Activity LED and Status LED) and a three-LED system
   (Activity LED, Fail LED, and Locate LED).
  
   To start ledctl, enter
  
>sudo[options] PATTERN_NAME=list_of_devices
where [options] is one or more of the following:
- -c PATH,- --confg=PATH
- Sets a path to local configuration file. If this option is specified, the global configuration file and user configuration file have no effect. 
- -l PATH , --log=PATH
- Sets a path to local log file. If this user-defined file is specified, the global log file - /var/log/ledmon.logis not used.
- --quiet
- Turns off all messages sent to - stdoutor- stderrout. The messages are still logged to local file and the- syslogfacility.
- -h,- --help
- Prints the command information to the console, then exits. 
- -v,- --version
- Displays version of - ledctland information about the license, then exits.
12.2.1 Pattern names #
    The ledctl application accepts the following names for
     argument, according to the SFF-8489
    specification.
   
- locate
- Turns on the Locate LED associated with the specified devices or empty slots. This state is used to identify a slot or drive. 
- locate_off
- Turns off the Locate LED associated with the specified devices or empty slots. 
- normal
- Turns off the Status LED, Failure LED, and Locate LED associated with the specified devices. 
- off
- Turns off only the Status LED and Failure LED associated with the specified devices. 
- ica,- degraded
- Visualizes the - In a Critical Arraypattern.
- rebuild,- rebuild_p
- Visualizes the - Rebuildpattern. This supports both of the rebuild states for compatibility and legacy reasons.
- ifa,- failed_array
- Visualizes the - In a Failed Arraypattern.
- hotspare
- Visualizes the - Hotsparepattern.
- pfa
- Visualizes the - Predicted Failure Analysispattern.
- failure,- disk_failed
- Visualizes the - Failurepattern.
- ses_abort
- SES-2 R/R ABORT 
- ses_rebuild
- SES-2 REBUILD/REMAP 
- ses_ifa
- SES-2 IN FAILED ARRAY 
- ses_ica
- SES-2 IN CRITICAL ARRAY 
- ses_cons_check
- SES-2 CONS CHECK 
- ses_hotspare
- SES-2 HOTSPARE 
- ses_rsvd_dev
- SES-2 RSVD DEVICE 
- ses_ok
- SES-2 OK 
- ses_ident
- SES-2 IDENT 
- ses_rm
- SES-2 REMOVE 
- ses_insert
- SES-2 INSERT 
- ses_missing
- SES-2 MISSING 
- ses_dnr
- SES-2 DO NOT REMOVE 
- ses_active
- SES-2 ACTIVE 
- ses_enable_bb
- SES-2 ENABLE BYP B 
- ses_enable_ba
- SES-2 ENABLE BYP A 
- ses_devoff
- SES-2 DEVICE OFF 
- ses_fault
- SES-2 FAULT 
When a non-SES-2 pattern is sent to a device in an enclosure, the pattern is automatically translated to the SCSI Enclosure Services (SES) 2 pattern as shown above.
| Non-SES-2 Pattern | SES-2 Pattern | 
|---|---|
| locate | ses_ident | 
| locate_off | ses_ident | 
| normal | ses_ok | 
| off | ses_ok | 
| ica | ses_ica | 
| degraded | ses_ica | 
| rebuild | ses_rebuild | 
| rebuild_p | ses_rebuild | 
| ifa | ses_ifa | 
| failed_array | ses_ifa | 
| hotspare | ses_hotspare | 
| pfa | ses_rsvd_dev | 
| failure | ses_fault | 
| disk_failed | ses_fault | 
12.2.2 List of devices #
    When you issue the ledctl command, the LEDs of the
    specified devices are set to the specified pattern and all other LEDs are
    turned off. The list of devices can be provided in one of two formats:
   
- A list of devices separated by a comma and no spaces 
- A list in curly braces with devices separated by a space 
If you specify multiple patterns in the same command, the device list for each pattern can use the same or different format. For examples that show the two list formats, see Section 12.2.3, “Examples”.
    A device is a path to file in the /dev directory or in
    the /sys/block directory. The path can identify a
    block device, an MD software RAID device, or a container device. For a
    software RAID device or a container device, the reported LED state is set
    for all of the associated block devices.
   
The LEDs of devices listed in list_of_devices are set to the given pattern pattern_name and all other LEDs are turned off.
12.2.3 Examples #
To locate a single block device:
>sudoledctl locate=/dev/sda
To turn off the Locate LED for a single block device:
>sudoledctl locate_off=/dev/sda
To locate disks of an MD software RAID device and to set a rebuild pattern for two of its block devices at the same time:
>sudoledctl locate=/dev/md127 rebuild={ /sys/block/sd[a-b] }
To turn off the Status LED and Failure LED for the specified devices:
>sudoledctl off={ /dev/sda /dev/sdb }
To locate three block devices, run one of the following commands (both are equivalent):
>sudoledctl locate=/dev/sda,/dev/sdb,/dev/sdc>sudoledctl locate={ /dev/sda /dev/sdb /dev/sdc }
12.3 More information #
See the following resources for details about the LED patterns and monitoring tools: