Does your department manager always hound you for emails of up-to-date reports and analyses? No problem, with a Shell or PowerShell script you can easily handle that. And in Automic, you handle it with SEND_MAIL.
However, I want to show you another elegant solution which also works in Automic: Notification Objects.
You can download these objects at the end of this brief introductory article.
This blog post is a new edition of an article published in my old AutomicBlog in February 2013. I wrote the objects for V9 but they still work perfectly in today’s V11.
The Notification Object CALL
With a notification object you can send external files of any RunID as attachments.
Among the objects I made available, there is the notification object CALL_EMAIL_OUTPUTFILES. It allows to enter all parameters via Prompt Set.
If you select in your Prompt Set the automatic recognition of a RunID, the entered ID is ignored and CALL_EMAIL_OUTPUTFILES tries to find the RunID automatically:
- If CALL_EMAIL_OUTPUTFILES is used in a workflow, the system selects the RunID of the predecessor in the workflow.
- Otherwise it uses the value of &UC_CAUSE_NR – for example, if it has been activated via the “Output Scan” of a Job.
JOBS for Mailing Other Files
Sometimes Automic Jobs files cannot or should not be registered as external output. If you want to mail such files, the following JOBS are used:
The two jobs JOBS_*_REGISTER_EMAIL_OUTPUTFILES (one each for Unix and Windows) register the stated file per Prompt Set as external output and then send it per output scan with CALL_EMAIL_OUTPUTFILES.
This allows you to mail files which are not created by Automic Jobs.
An Overview of the Objects in the Files
I have segmented the objects into 4 sections. You will be able to download the four files as an archive at the end of this article.
The four sections are: FRONTEND, LIBRARY, EXAMPLES and UC4.RUNBOOK_PART.
FRONTEND
Contains objects intended for direct access.
- CALL_EMAIL_OUTPUTFILES
See description above. uses PRPT_EMAIL_OUTPUTFILES. - JOBS_*_REGISTER_EMAIL_OUTPUTFILES
See description above. Uses the Prompt Sets UC4.RB.PRPT.*.AGENTS, PRPT_FILE, PRPT_EMAIL_OUTPUTFILES.
Activates CALL_EMAIL_OUTPUTFILES via output scan.
LIBRARY
Contains objects required by the “FRONTEND“ objects.
- FILTER_REGISTER_OUTPUTFILE
The output filter recognizes if the script statement “REGISTER_OUTPUTFILE“ has been executed in the Job. - PRPT_EMAIL_OUTPUTFILES
Prompt Set for mail addresses, mail subject and RunID. - PRPT_FILE
Prompt Set for file name (fully qualified). - VARA_OUTPUTFILES_TASKIDNR_SRCTYPE
List of values for “automatically” and “manually”.
EXAMPLES
Three examples to demonstrate various use cases.
- EXAMPLE1_JOBP
Shows usage within a workflow. The first job in the workflow creates and registers an external file. The following command of CALL_EMAIL_OUTPUTFILES automatically takes the RunID of its predecessor and sends its external files. - EXAMPLE1_JOBS_CREATES_OUTPUTFILE
Job for Workflow example.
Registers the external file in the “Output” tab. - EXAMPLE2_JOBS_CREATES_OUTPUTFILE
Creates an external file and registers it via “ REGISTER_OUTPUTFILE“. Activation of CALL_EMAIL_OUTPUTFILES via “Output Scan”. - EXAMPLE3_SCRI_EMAIL_FILE
Sending an external file via script.
UC4.RUNBOOK_PART
These objects are NOT mine, but are part of the UC4 Runbook Templates by Automic, which were made available with V9 and V10 of AE as transport case files “UC4_RB_Functions” in the DB directory with the initial data. Automic is not assuming responsibility for them and I certainly won’t either.
Tip: If this solution were to be rebuilt in V11 or higher, one would use the ITPA_SHARED Action Pack instead of the Runbook Objects.
- UC4.RB.PRPT.UNX.AGENTS or UC4.RB.PRPT.WIN.AGENTS
Prompt Set with a selection list of all Unix or Windows Agents and login objects of the current client. - UC4.RB.VARA.UNX.SQLI.AGENT or UC4.RB.VARA.WIN.SQLI.AGENT
SQLI Variables to find all Unix or Windows Agents of the current client. - UC4.RB.VARA.UNX.SQLI.LOGINS or UC4.RB.VARA.WIN.SQLI.LOGINS
SQLI Variables to find all Unix or Windows Login Objects of the current client.
Some Usage Limitations
- The emailing of external files takes place directly from the Agent. If an Agent does not have authority for it, the objects will not function (firewall, whitelist at the SMTP server, or the like).
- It is not possible to mail to an unlimited number of addresses. Eight addresses with a total of 240 characters have always worked for me without problems.
- The email has a subject line but no body. If you want to send pleasant news along with your reports, you can expand the Prompt Set accordingly, or insert a standard text in the CALL Object.
- You may use or modify these objects as you like. If you pass them on, would you mind mentioning me – preferably in a positive light 😉
- And finally: I cannot take responsibility for any problems or errors, data loss or other damage that may occur to your IT System through the use of my files/objects. These objects are made available to you without liability.
Try it for Yourself
Here, finally, you can download the Object Files and test them for yourself.
Have fun!