Skip to content

Host Storage Sensor

Mat Davis edited this page Jan 29, 2020 · 1 revision

Smart Command for 32-bit and 64-bit Hybrid

One difficult issue to deal with when running the HostStorageSensor (HSS) is that it is unknown at discovery time whether the HBA API libraries installed on the target are 32-bit or 64-bit. Furthermore, the sensor configuration can only be configured for one or the other. Previously, the only solution was to maintain scopesets for each and run separate discoveries.

Using the following configuration with a much smarter command will resolve this issue. The smart command, does the following:

  • Only use sudo if collectionengine is in the sudoers
  • First runs the 32-bit/default command to see if any HBAs are found
  • If no HBAs are found with the 32-bit command, the 64-bit command is ran if it's there
  • If the 64-bit command is not copied to the target, the 32-bit default command is run
PWD=`pwd`;CMD=`ls -1 collectionengine-* | head -1`;export CMD PWD;BIT_64=`if ls ${CMD}_64 >/dev/null 2>&1; then printf '_64'; fi`;export BIT_64;`AWK=awk;if command -v nawk >/dev/null 2>&1; then AWK=nawk; fi; sudo -l 2>&1 | $AWK '{ if (match($0, /.*collectionengine.*/)) {print "found";exit;}}' | $AWK 'END {if (NR < 1) {print ""; exit;}} {if (match($0,/.*found.*/)) {print "sudo";exit;} else {print ""; exit;}}'` `if $PWD/$CMD --console --hba | grep 'Collection enginedid not find any HBAs' >/dev/null; then BIT=$BIT_64; fi; echo "$PWD/$CMD$BIT --console --hba --disk 2> $PWD/${CMD}_stderr.out"` #

Sensor Configuration

Create a new sensor configuration for the HostStorageSensor in the discovery profile and use the following settings

  • collectionEngineBuild_64_bit = false
  • collectionEngineForceUniqueName = false
  • Use the command above for collectionEngineSudoCommand

Caveat

Since we are running with collectionEngineBuild_64_bit = false that means that the 64-bit binary will not be copied to the target, so it will not be able to be executed. In order to ensure that any 64-bit binaries are copied to the target, you must occasionally run discoveries with collectionEngineBuild_64_bit = true. This will copy out those 64-bit binaries to the Linux and AIX targets so that they will be there when you run the normal discoveries.

Clone this wiki locally