SSH (Performance)
- Last Updated: December 11, 2024
- 3 minute read
- WhatsUp Gold
- Version 2024
The SSH monitor uses SSH authentication to connect to a remote device to execute commands or scripts which can be either embedded in the monitor or placed as an executable script file on the remote machine with a command embedded in the monitor to run the script. Each monitor returns a single numeric value which is recorded in the database and then used later by other WhatsUp Gold functions as needed.
Provide a unique name and description for the monitor, then configure the following:
- Command to run. Enter the command to run and execute on the remote device. The command can be anything the device can interpret and run; for example, a UNIX shell command or a perl script. Please note, if you create a script to run on the remote device, it must be developed, tested, and/or debugged on the remote machine. Select one of the following script options:
- Numeric. The command or script must return a single numeric value. The script can be as complex as required, but MUST only return a numeric value. For example, old, single-line UNIX-style:
free -m | awk 'NR==2{print $3}'This is the script format required prior to WhatsUp Gold 16.2.3. - Shell Interactive. This script is not constrained to only returning single numeric values; however, the output MUST contain the string 'Result=xxxx' where xxxx represents a numeric value. For example, new multi-line Linux-style:
echo Result=$(free -m | awk 'NR==2{print $3}')This newer script format supports all the features of the target script interpreters without burdening the script developer to limit the output to a single numeric value.
- Numeric. The command or script must return a single numeric value. The script can be as complex as required, but MUST only return a numeric value. For example, old, single-line UNIX-style:
Note: Beginning with v18.0.2, the Shell Interactive option supports user-defined custom regular expressions to make it possible for WhatsUp Gold to successfully gather performance data from some embedded systems including routers, switches, and Integrated Dell Remote Access Controllers (iDRAC). To enable this feature when configuring an SSH performance monitor, enable the Use Custom Regex checkbox when the Shell Interactive option is selected.Example: Default RegexCommand:
<command that outputs the result in the default format>Output: Result=15When the default regex is run with this output, it matches on Result=15. The capturing group considers 15 the result, so that is the value WhatsUp Gold stores as the result of the poll. The regex inside the capturing group [0-9.,]+ matches on any one or more 0-9 number, decimal point, and comma, though the value should only have one decimal or comma in it to be parsed correctly into a number. If the same regex was run against Result=A33, it would not match. However, Result=33A would match on Result=33 and the capturing group would consider 33 the result.Example: Custom RegexTo monitor the power usage of a Dell R710 (the specific statistic being cfgServerPowerLastMinAvg) through the iDRAC management interface using the following command, "racadm getconfig -g cfgServerPower", enter the following regular expression. Please note, only the relevant lines of the expression are included below.# cfgServerPowerStatus=1(Snipped)cfgServerPowerCapEnable=0# cfgServerPowerLastMinAvg=357 AC W | 1218 Btu/hr# cfgServerPowerLastHourAvg=359 AC W | 1225 Btu/hr(Truncated for brevity)The regular expression used in this example to capture the watt usage average over the last minute is cfgServerPowerLastMinAvg=([\d]+) which looks for cfgServerPowerLastMinAvg= followed by one or more digits.The value that would be returned as the result of the poll is 357 because the [\d]+ is inside a capturing group (). Note that the regular expression specified MUST include a capturing group () to return the result of the poll to WhatsUp Gold.The monitor only consumes the last match it finds in the output. Even if the command executed returns thousands of results, WhatsUp Gold only records the last match. Additional information on .Net Default Regular Expression options can be found here.In the event WhatsUp Gold fails to find a match when processing the regular expression against the output returned, the Performance Error Log will contain the raw output received from the device. You can use this information to address the issue(s) with the regex pattern specified in the monitor configuration.- Line end character. Select the appropriate line end type:None, Linefeed, Carriage return, or Carriage return linefeed. Multiline scripts are entered and persisted on a Windows operating system and include line-ending characters that may not be recognized on the target device. This configuration feature instructs WhatsUp Gold to replace the line-ending characters with the selected characters prior to connection and command execution.