Support scraping multiple controllers.#27
Conversation
Why? vilhelmprytz#26 (comment) Why not auto-detect the controllers? To remain in the spirit of the current behavior of the exporter. Although a list is shown in the CLI along with usage help when run without any argument, there is no explicit CLI command to return the number of controllers. Running e.g. `sys info` for an increasing controller index until failure is noticed works but it is difficult to disambiguate a non-existing controller from a failed run (which are metric reported and skipped) without introducing fragility. It seems simpler and sufficient to have this number specified. Tested, on system with 3 controllers: - default, `--controllers 2`, `--controllers 3` works as expected. All `areca_...` metrics (but the implicit `areca_exporter_build_info`) are reported with a new `controller_index=<n>` label (`controller_index` was preferred over `controller` b/c there's an existing `controller_name`). E.g.: ``` areca_disk_state{controller_index="2",device_location="Enclosure#2 SLOT 01",device_type="SATA(5001B4D50FA6201C)",disk_capacity="3000.6GB",firmware_rev="MKAOAA10",model_name="Hitachi HUA723030ALA640",num="9",security_capability="N.A.",serial_number="MK0371YVKJR45K"} 0[...]areca_sys_info{boot_rom_version="V1.50 2012-01-30",controller_index="1",controller_name="ARC-1882IX-24",cpu_dcache_size="32KB",cpu_icache_size="32KB",cpu_scache_size="1024KB",current_ip_address="192.168.1.158",firmware_version="V1.52 2014-12-26",main_processor="800MHz",serial_number="Y205CADHAR800006",system_memory="1024MB/1333MHz/ECC"} 1 areca_sys_info{boot_rom_version="V1.52 2014-02-07",controller_index="2",controller_name="ARC-1882",cpu_dcache_size="32KB",cpu_icache_size="32KB",cpu_scache_size="1024KB",current_ip_address="192.168.1.100",firmware_version="V1.52 2014-02-07",main_processor="800MHz",serial_number="A228CADFAR300104",system_memory="4096MB/1333MHz"} 1 areca_sys_info{boot_rom_version="V1.52 2014-02-07",controller_index="3",controller_name="ARC-1882",cpu_dcache_size="32KB",cpu_icache_size="32KB",cpu_scache_size="1024KB",current_ip_address="192.168.1.100",firmware_version="V1.52 2014-02-07",main_processor="800MHz",serial_number="Y321CADFAR310359",system_memory="4096MB/1333MHz"} 1 ``` - `--controllers 4` behaves like `--controllers 3` but with additional error logs and metrics for the fourth controller: ``` level=error ts=2025-01-08T22:50:04.906Z caller=areca_exporter.go:53 err="exit status 1" msg="ErrMsg: Invalid Controller#.\n" [...] areca_up{collector="disk_info",controller_index="1"} 0 areca_up{collector="disk_info",controller_index="2"} 0 areca_up{collector="disk_info",controller_index="3"} 0 areca_up{collector="disk_info",controller_index="4"} 1 areca_up{collector="rsf_info",controller_index="1"} 0 areca_up{collector="rsf_info",controller_index="2"} 0 areca_up{collector="rsf_info",controller_index="3"} 0 areca_up{collector="rsf_info",controller_index="4"} 1 areca_up{collector="sys_info",controller_index="1"} 0 areca_up{collector="sys_info",controller_index="2"} 0 areca_up{collector="sys_info",controller_index="3"} 0 areca_up{collector="sys_info",controller_index="4"} 1 ```
|
@vilhelmprytz gentle ping, thanks |
vilhelmprytz
left a comment
There was a problem hiding this comment.
Really good work! I do not have a system with two controllers to test with, but it works on my machine with one controller still. Left two comments!
| - Provides metrics for the Areca RAID cards to be scraped by Prometheus. | ||
| - Supports the following metrics: | ||
| - `areca_up`: '0' if a scrape of the Areca CLI was successful, '1' otherwise. | ||
| - `areca_sys_info`: Constant metric with a value of 1 labeled with information about the Areca controller. | ||
| - `areca_sys_info`: Constant metric with a value of 1 labeled with information about Areca controllers. | ||
| - `areca_raid_set_state`: Areca RAID set state, where 0 represents normal and 1 represents degraded. | ||
| - `areca_disk_info`: Constant metric with value 1 labeled with info about all physical disks attached to the Areca controller. | ||
| - `areca_disk_info`: Constant metric with value 1 labeled with info about all physical disks attached to Areca controllers. | ||
| - `areca_disk_state`: Areca controller metric for disk state, 0 for normal, 1 for error | ||
| - `areca_disk_media_errors`: Metric for media errors of all physical disks attached to the Areca controller. | ||
| - `areca_disk_media_errors`: Metric for media errors of all physical disks attached to Areca controllers. |
There was a problem hiding this comment.
Nice! Maybe we could emphasize that the exporter supports systems with multiple controllers as well?
| | -------------------- | --------------------------------- | ------------- | | ||
| | `--collect-interval` | How often to poll each controller | `5s` | | ||
| | `--cli-path` | Path to Areca CLI binary | `areca.cli64` | | ||
| | `--controllers` | How many controllers to scrape | `1` | |
There was a problem hiding this comment.
Maybe a little bit out of scope, but would it be possible to auto-detect the number of controllers? For example, by "trying" different n = 1, 2, 3, ... etc in numctrl=<n> and see when it fails?
There was a problem hiding this comment.
not sure if you saw the pr description covering that? I initially implemented exactly what you suggest but I felt it was fragile for the reasons given there. I then considered the current behavior of the exporter: It is run under the implicit assumption that there is a controller at index 1, and report errors if failures are encountered (i.e., it doesn't auto-discover there are no controllers and report success, doing nothing). So, making that intent explicit and supporting more than 1, reporting on failures for controllers which aren't actually found (rather than ignoring a difference between intent and actual), seemed to both avoid that fragility and match the current spirit well. I understand it's slightly less functional, but I felt it was a good tradeoff.
Why? #26 (comment)
Why not auto-detect the controllers? To remain in the spirit of the current behavior of the exporter. Although a list is shown in the CLI along with usage help when run without any argument, there is no explicit CLI command to return the number of controllers. Running e.g.
sys infofor an increasing controller index until failure is noticed works but it is difficult to disambiguate a non-existing controller from a failed run (which are metric reported and skipped) without introducing fragility. It seems simpler and sufficient to have this number specified.numctrl=<n>param support appears present in all CLI versions found at ftp://ftp.areca.com.tw/.Tested, on system with 3 controllers:
--controllers 2,--controllers 3works as expected. Allareca_...metrics (but the implicitareca_exporter_build_info) are reported with a newcontroller_index=<n>label (controller_indexwas preferred overcontrollerb/c there's an existingcontroller_name). E.g.:--controllers 4behaves like--controllers 3but with additional error logs and metrics for the fourth controller: