System Command Rules

In conjunction with System Command Alerts, System Command Rules are a product-within-a-product – using just these two facilities you could conceivably monitor much of your enterprise.

You will find the same about the other scripting twins: the WMI Rules and WMI Action Script Alerts.

It would be very labor intensive and time consuming, but it does illustrate the power of the System Command Rules.

What makes System Command Rules so powerful and useful is their ability to execute any program or command file you have, and then to examine the results.


In this example, a program from the W200x resource kit is run to check the size of user profiles.

This Rule tests for and reports on directories in WINNT\PROFILES that exceed 9 MB in size.

As can be seen from the screenshot, the parameters are specified on the Command File line.

The Rule is not broken if the Exit Code from the program is 0; any other value indicates some directories over 9 MB, and the Rule is broken and an Event is fired to the main Argent Console screen.

Two seconds is allowed as the Default Timeout.

The Output Option is very useful. It enables you to put in the Argent Console message all the text generated from the program – this is the same text you would see in the command window were you to run diruse from a command window.

In microcosm, this simple example shows the power and flexibility of the System Command Rules.

OR In System Command Rules

System Command Rules let you test the output generated from the program.

Often you need to test a number of different strings.

Here you can use the OR parameter.

In this example the Rule will be broken if either of the following two strings are found:

  • DNS Requested Timed Out
  • Can’t find server name for address

As you can see the OR is used to separate the two cases.

%VARIABLES% In System Command Rules

Sometimes you need to add a variable to a System Command Rule for parameters, such as the name of the server being tested – hard-coding each server name would be a huge amount of needless work.

For example, for these two variables of %AGNodeName% and %AGNodeTryCount% Argent extracts the server name and the TCP/IP try count and substitutes them when the test is run.

If the Monitoring Group listed three servers, TEST1, TEST2, and TEST3, then the above System Command Rule becomes

C:\NTResKit\Guardian\CPing.cmd TEST1 1

C:\NTResKit\Guardian\CPing.cmd TEST2 1

C:\NTResKit\Guardian\CPing.cmd TEST3 1

Where 1 is the %AGNodeTryCount%

Timeout And Temporary Disk Files In System Command Rules

When you run a program in a System Command Rule you sometimes want the program to be ended if it does not complete within a reasonable period of time.

Use the Default Timeout option to do this, and you have the option of forcing the Rule to break if it does timeout.

Another option is to have Argent create a temporary work file on disk to hold the output. As the screen comment states, this option is needed when your program does not allow redirected input.

Normally, Argent captures the output of command by redirecting the standard input/output of the command line process to an anonymous pipe.

By reading this anonymous pipe, Argent captures the output in real time.

This mechanism works for most of the console programs.

But there are some console programs, especially those related to terminal emulation such as RCMD, RSH, TELNET, etc., where this mechanism does not work.

The option Run Command Using Temporary Disk File For Output can be used in these cases.

The drawback of this option is it can slow performance.

The temporary file is deleted automatically for you by Argent.