8.4.2 Monitor any event (execution condition item)
- Organization of this subsection
(1) Overview of the function
This item executes a command periodically and executes the job depending on the return code of the command.
(2) List of settings
Name |
Required |
Format |
Can specify inherited information? |
---|---|---|---|
Command name |
Yes |
String (1 to 255 bytes) |
No |
Parameter |
No |
String (0 to 512 bytes) |
No |
Return code regarding to monitor event |
Yes |
String (1 to 512 bytes) Format: numeric-value[,numeric-value...] The valid values are 0 to 4,294,967,295. |
No |
Does not detect when the return code is the same as last time |
No |
Check box |
No |
After detecting events, start next monitor immediately |
No |
Check box |
No |
Return code regarding to monitor abnormal end |
No |
String (0 to 512 bytes) Format: numeric-value[,numeric-value...] The valid values are 0 to 4,294,967,295. |
No |
Virtual user name |
No |
String (0 to 512 bytes) |
No |
(3) Settings
- Command name
-
Specify the file name of the command to be executed periodically for monitoring.
- Parameter
-
Specify the parameter for the execution command.
- Return code regarding to monitor event
-
Specify the return codes that are regarded as event detection, which triggers action execution. You can specify multiple return codes, separated by commas.
- Does not detect when the return code is the same as last time
-
Select this check box if you do not want CPA to detect an event if the return code of the command is the same as that of the previous monitoring. CPA still detects an event if the return code of the first execution matched the return code regarding to monitor event. If you select this option, you cannot select the After detecting events, start next monitor immediately option.
- After detecting events, start next monitor immediately
-
Select this check box if you want CPA to execute the command immediately after detecting an event, without a given interval. If you select this option, you cannot select the Does not detect when the return code is the same as last time option.
- Return code regarding to monitor abnormal end
-
Specify the return codes with which the job executed on event ends abnormally. You can specify multiple return codes, separated by commas.
- Virtual user name
-
Specify the name of the virtual user mapped to the name of the Windows user who executes the item. If the virtual user name is omitted, the item is executed with the account for the CPA job execution service.
To map the virtual user name, use the cpasetumap command. For details on the cpasetumap command, see cpasetumap in 9. Commands.
(4) Example 1
Execute the job if a certain process exists. Otherwise, continue monitoring.
Command name |
cmd |
Parameter |
/c tasklist|findstr process-name |
Return code regarding to monitor event |
0 |
Return code regarding to monitor abnormal end |
-- |
Does not detect when the return code is the same as last time |
Cleared |
After detecting events, start next monitor immediately |
Cleared |
- Legend:
-
-- : Not specified
(5) Example 2
Detect an event if a certain process exists. Otherwise, end abnormally.
Command name |
cmd |
Parameter |
/c tasklist|findstr process-name |
Return code regarding to monitor event |
0 |
Return code regarding to monitor abnormal end |
1 |
Does not detect when the return code is the same as last time |
Cleared |
After detecting events, start next monitor immediately |
Cleared |
(6) Example 3
Detect an event if a certain process exists. The item does not detect an event even if the process still exists during the second and later monitoring.
Command name |
cmd |
Parameter |
/c tasklist|findstr process-name |
Return code regarding to monitor event |
0 |
Return code regarding to monitor abnormal end |
-- |
Does not detect when the return code is the same as last time |
Checked |
After detecting events, start next monitor immediately |
Cleared |
- Legend:
-
-- : Not specified
(7) Example 4
Execute the job every hour.
Command name |
sleep |
Parameter |
3600 |
Return code regarding to monitor event |
0 |
Return code regarding to monitor abnormal end |
-- |
Does not detect when the return code is the same as last time |
Cleared |
After detecting events, start next monitor immediately |
Checked |
- Legend:
-
-- : Not specified
(8) About return codes
If the same value is set to both of the Return code regarding to monitor event and the Return code regarding to monitor abnormal end, the item ends abnormally.
(9) About the setting of "Does not detect when the return code is the same as last time"
If Does not detect when the return code is the same as last time is selected, the latest return code is compared with the return code of the previous monitoring. This means that the return code is retained and carried over for each monitoring interval. The return code retained is reset when:
-
You change the definition of the job in the Job design view.
-
You register the job or perform overwrite registration for the job in the following order:
-
Select the Does not detect when the return code is the same as last time check box and register the job.
-
Clear the Does not detect when the return code is the same as last time check box and perform overwrite registration for the job.
-
Select the Does not detect when the return code is the same as last time check box and perform overwrite registration for the job.
-
(10) About the setting of "After detecting events, start next monitor immediately"
With the Monitor any event item, commands are executed every 60 seconds. However, if After detecting events, start next monitor immediately is selected, a command runs again immediately after it ends. This means that if you specify a command that takes a very short time to finish for the Monitor any event item, the command runs consecutively when the return codes of the command always satisfy conditions. This imposes a high load on the machine. This also might cause the Job Design View to fail to update the status information in real time. The window might display inconsistent information, for example, a job is in the Executing state but the end time appears. In such a case, you should wait until the peak period of events passes and then update the status information in the window. Alternatively, you can use the cpareport command described in 9. Commands to view the status information. We recommend that you select After detecting events, start next monitor immediately only if you use a command that does not finish until an event is detected, or if you want to perform monitoring repeatedly for a certain return code.