See an example job monitor that sends an e-mail to an operator when the threshold limit of a job is exceeded.
You are currently running an application on your iSeries™ server, and you want to be notified if the CPU utilization reaches the specified threshold.
If the Advanced Job Scheduler is installed on the endpoint system, you can use the Send Distribution using JS (SNDDSTJS) command to notify someone by e-mail when the threshold is exceeded. For instance, you could specify that the notification escalate to the next person if the intended recipient does not respond by stopping the message. You could create on-call schedules and send the notification to only those people that are on-call. You can also send the notification to multiple e-mail addresses.
Job monitor configuration example
This example uses the SNDDSTJS command to send a message to a recipient named OPERATOR, which is a user-defined list of e-mail addresses. You can also specify an e-mail address instead of a recipient or both. To set up a job monitor that accomplishes this goal, complete the following steps:
SNDDSTJS RCP(OPERATOR) SUBJECT('Job monitor trigger') MSG('Job &JOBNAME is still running!')
Message monitor configuration example
If you use a message monitor, you can send the message text to the recipient. Here is an example of a CL program that retrieves the message text and sends an e-mail to all on-call recipients with the SNDDSTJS command.
PGM PARM(&MSGKEY &TOMSGQ &TOLIB) DCL &MSGKEY *CHAR 4 DCL &TOMSGQ *CHAR 10 DCL &TOLIB *CHAR 10 DCL &MSGTXT *CHAR 132 RCVMSG MSGQ(&TOLIB/&TOMSGQ) MSGKEY(&MSGKEY) RMV(*NO) MSG(&MSGTXT) MONMSG CPF0000 EXEC(RETURN) SNDDSTJS RCP(*ONCALL) SUBJECT('Message queue trigger') MSG(&MSGTXT) MONMSG MSGID(CPF0000 IJS0000) ENDPGM
This is the command that would call the CL program:
CALL SNDMAIL PARM('&MSGKEY' '&TOMSG' '&TOLIB')
Results
The monitor checks the QINTER subsystem every 15 seconds, and if the job MKWIDGET is consuming more than 30 percent of the CPU, the monitor sends an e-mail to the operator. The monitor resets when the job uses less than 20% CPU capacity.
See Work with notification for more information on the Advanced Job Scheduler notification function.