dsa-check-hpssacli: refactor for speed/efficiency
authorFaidon Liambotis <faidon@wikimedia.org>
Wed, 26 Jun 2019 15:32:45 +0000 (15:32 +0000)
committerJulien Cristau <jcristau@debian.org>
Fri, 12 Jul 2019 13:47:34 +0000 (15:47 +0200)
commit85df8fa4003a665d815a5e32f0e7ad0dc7be6e1d
treecc244ba693d6b33684b1155fde7d5fb6a7d8ed57
parent489c12d451d7cf4dbd07f7be6661238d5e75f432
dsa-check-hpssacli: refactor for speed/efficiency

Currently dsa-check-hpssacli executes:
  hpssacli controller all show
  hpssacli controller slot=3 ld all show
  hpssacli controller slot=3 ld 1 show
  hpssacli controller slot=3 ld 2 show
  ...
  hpssacli controller slot=3 pd all show
  hpssacli controller slot=3 pd 1I:1:1 show
  hpssacli controller slot=3 pd 1I:1:2 show
  ...
  hpssacli controller slot=3 show detail

On systems with e.g. 14 PDs/14 LDs, this results into 32 invocations,
just to get the status of all these disks. On systems with more
disks or controllers, even more.

Refactor the code to simply do:
  hpssacli controller all show detail
  hpssacli controller slot=3 ld all show detail
  hpssacli controller slot=3 pd all show detail

This is lightly tested, but seems to have no adverse effects and
currently achieves a ~10x speed-up.

Signed-off-by: Julien Cristau <jcristau@debian.org>
dsa-nagios-checks/checks/dsa-check-hpssacli