Skip to content

Support scraping multiple controllers.#27

Open
sebbov wants to merge 2 commits intovilhelmprytz:mainfrom
sebbov:multi-controller
Open

Support scraping multiple controllers.#27
sebbov wants to merge 2 commits intovilhelmprytz:mainfrom
sebbov:multi-controller

Conversation

@sebbov
Copy link

@sebbov sebbov commented Jan 8, 2025

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 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.

numctrl=<n> param support appears present in all CLI versions found at ftp://ftp.areca.com.tw/.

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

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
```
@sebbov
Copy link
Author

sebbov commented Jan 13, 2025

@vilhelmprytz gentle ping, thanks

Copy link
Owner

@vilhelmprytz vilhelmprytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment on lines +7 to +14
- 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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Maybe we could emphasize that the exporter supports systems with multiple controllers as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

| -------------------- | --------------------------------- | ------------- |
| `--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` |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants