Custom Commands for Monitoring

Document created by Chris Sommerstad Employee on Jul 22, 2017
Version 1Show Document
  • View in full screen mode

Custom Commands can be used to create Custom Monitors in supported environments (all except Windows—support for which will be provided in the near future). Using this technique provides the ability to monitor runtime metrics (e.g. metrics whose value is not known ahead of time).

Custom Command monitors utilize an inline process call (entered into the provided Monitors box, text entry field) that executes a command inline or can refer to an external Shell Script accessible within the given environment.

TIP: Users should note that the output of the "script" in question must be a real number.

Custom Command monitors require an agent, SOASTA Conductor, be in use as part of command configuration. This configuration is done using the existing Monitor UI, which now includes the Custom Command field, as well as a new Enable Custom Commands for Monitoring box is found in the SOASTA Conductor field, which appears in the Conductor Capabilities section under Allow Monitoring.

Both the Allow monitoring box, and the Enable Custom Commands for Monitoring opt-in box must be checked for subsequent monitor setup to succeed.

Once the opt-in boxes in the relevant SOASTA Conductor are checked, the remaining portion of the Monitor configuration follows the same workflow found in the setup of SOASTA-provided monitors.

Creating a Custom Command Monitor

  1. Create a new monitor using Central > Monitors > New.
  2. In the Server Group or Monitor page, give the new monitor a name.
  3. Ensure that the new monitor is associated with a Monitor Server Group setup for the host that will be monitored (shown below using the LibertyMonitorGroup).

Additionally, ensure that the Monitor Server Group's Connection Type has been set to the Conductor in use for the given host (e.g. as opposed to SSH).

If you're not yet familiar with CloudTest's extensive monitoring capabilities, refer to Creating Monitor Server Groups and Creating a Monitor before proceeding.

  1. On the System Resources page, scroll down and click Add Custom Object (the green Plus icon) and then select Custom Command from the drop-down.

  1. In the "Select resource type" dial that appears, select Custom Command.

  1. In the Add a new Monitor Server Group or Monitor, System Resources page, check the Custom Command box in the Type column.
  2. In the Name column, enter a name to use for the monitor. For example, Shared DB Memory-PostgreSQL.

TIP: Although this name is optional, it will appear on the widget title bar in any dashboard where the monitor is in display, so SOASTA recommends that each Custom Monitor have a unique name to distinguish its purpose and the information being tracked at runtime.

    1. Next, create the external shell script to use on the machine to monitor.

For example, create a shell script called apache_shared_mem. This script will get the sum of shared memory for apache processes on the given machine.

top -b -n 1 | grep httpd | awk '{sum+=print $7} END {print sum}'

TIP: You can also enter your script inline in the System Resource Selection page (shown above) but SOASTA recommends doing so only for very basic scripts (e.g. usually ones that can be viewed in their entirety in the Arguments columns).

  1. On the Command Line (e.g. as an Administrator on the monitored server), change the script's permissions to make it executable. For example:

chmod a+x apache_shared_mem

  1. Enter the call to the script Monitor wizard's System Resource Selection. Note that the "./" preceding the script's name is required.

  1. Complete the monitor creation.
  2. At runtime, CloudTest will utilize a number returned from the given path.
  3. Click Next and then complete the creation of the Custom Monitor.

The Name (Optional) value appears on the Monitor dashboard (as noted above).