Custom shell command
A custom shell command allows you to execute a command to implement any custom checks and receive verified output.
It is configured with an arbitrary Linux or Windows shell commands, which is then executed by private agent, deployed on a selected server. Command output is collected and uploaded to Anturis backend for interpretation. Instead of a shell command there may be a script, a PowerShell command or script, or an executable being used. You are able to specify criteria for “success” and “failure”, and as the command is being repeatedly launched you will be promptly alerted if something goes wrong.
There are two ways to check the output of the command execution. First, treat it as a number (“a measurement”). In this case the Anturis will graph this value and check if it stays inside user-defined bounds. Another option is to treat the output as a text and check if there is a certain word, such as “OK” or “Error” present (or missing).
Custom diagnostics
In case a failure is detected, each monitor gathers additional information to provide problem context for faster troubleshooting. With Custom Shell Command Monitor a user possesses flexibility to set custom diagnostic actions to be executed.
This is achieved simply by collecting all the information sent by the command to the standard error stream (stderr) and attaching it to failed checks. So while standard output (stdout) is used to define success or failure (treating it either as a text or a number), stderr is used as a container for extra diagnostically data. Several examples are given below.
Examples
Let’s use well-known Linux commands to build some examples of how Custom Shell Command Monitor can be used.
Are you renting a virtual machine? Then you probably wonder if you get the processing power you pay for and if your VM is not occasionally migrated to a weaker machine. So, for example you may measure the time it takes to calculate pi with high precision using the following command:
/usr/bin/time -f "%U" 2>&1 bash -c 'echo "scale=2000; a(1)*4" | bc -l >
/dev/null'
To count the number of processes under the “user” account, and also collect and store the list of those processes for you run the following command:
ps -U user -u user uf | tee /dev/stderr | wc -l
To spot and troubleshoot IO problems you may want to watch the time processes that are blocked on IO, using iostat tool:
(iostat -c 10 2 | tail -2 | head -n 1 | gawk '{print $4}' ; ps auxf | grep
"D[^[]" >/dev/stderr; exit 0)
Custom monitoring configured with this command will report the percentage of time presented by iowait utility. Where the time goes above the threshold, the list of processes in uninterruptible sleep state (“D” state in ps output) will be collected and stored.
You may also plug in your favorite Nagios plugin, like in the following example, which will trigger alerts if there are less than 10 days left until domain expiration:
./check_domain –d somedomainname –c 10
For this command you will need to configure the monitor to treat the command output as a string and to look for an “OK” word.
Adding a custom shell command monitor
Before proceeding, please ensure that you have created the component and your Anturis Private Agent for Windows/Linux is running.
- On the Component page, click Add/Remove Monitors > Add Custom Monitor.
- Select the Local Resources monitors tab and Software sub tab view.
- Select Shell Command and click Next.
- Select the agents from the list.
- Type command under Command and click Execute.
- Select Check type.
- Specify the interval type.
- Enter the range checks.
- Click Next.
- Click Finish.
To manage your monitor, click View/Edit parameters.
Customer support service by UserEcho