(Script) opmail.sh Batch Report Mailer for merging Reports into one email(OpManager Linux Only)
Hello all. I have created a script for OpManager on Linux that will gather all of today's reports and email them to a list of users. The script currently has 2 Job types and more may be added easily by the user. It has an option to rename Custom Reports so that they include the client hostname in the PDF file name.
Requirements:
1.) The script requires "mutt" to be installed since this is how it send the emails.
2.) Opmanager needs to be installed in /opt/ManageEngine/OpManager/
3.) The script uses temp space here: /var/tmp/opmail_tmp/
4.) Scheduled Reports naming requirements:
(This can change as the Jobs are modified by users)
a.) Daily reports must have "Daily" in the OpManager job name. It is case sensitive.
b.) Weekly reports must have "Weekly" in the OpManager job name. It is case sensitive.
5.) The script can be placed anywhere.
(I have it here: /opt/opmanager_email_reports/opmail.sh)
To view the options output with a visual example just run the script without any options.
Scheduling can be done via a cronjob. Be sure to schedule this cronjob a few minutes after the
OpManager Scheduled Report runs. This will prevent the cronjob from running before the reports
are created.
Ex.
`crontab -e`
##Run every day @ 7am and send every Daily report for today.
5 7 * * * /opt/opmanager_email_reports/opmail.sh 1 -r person1@place.net,person2@place.net
## Run every Sunday @ 7:05am and send every Weekly report for today.
5 7 * * 0 /opt/opmanager_email_reports/opmail.sh 2 -r person1@place.net,person2@place.net
Download:
v.1.5.2
Download
*Updated 3/24/2014
Enabled sorting of attachments. This is most noticeable when using the -r option.
Changed $Temp_Dir variable to use the date & PID. This should keep Daily &
Weekly reports from using the same temp dir.
New to ADSelfService Plus?