Skip to main content

Email Creation - Computer

Summary

This script functions similarly to the CWM - Automate - Script - Ticket Creation - Computer script; however, instead of creating a ticket, it is designed to send an email to the email address provided in the system property.

This script sends emails to two different addresses:

  1. If the script is called by the alert template “△ Custom - Email RAWSQL Monitor set results to ProVal,” it will send an email to the address set in the system property “ProVal_Alerts_Email_Address,” which is typically set to “alerts@provaltech.com.”
    Note: If the property is missing, the script will automatically set it to “alerts@provaltech.com,” but if it is set to a different email address, it will not be modified.

  2. If the script is called by any other template, it will fetch the email address from the system property “_sysTicketDefaultEmail.”

Sample Run

This script should be utilized as an autofix for a monitor.

Important Notes on Using This with Monitors

  • Monitors can be tricky with this; in most cases, remote monitors will work fine. However, in some cases, internal monitors may not be compatible with this solution. This can be due to the utilization of set @something = in the monitor. You should avoid this in your internal RAWSQL monitors if the result is going to be used with this solution.
  • If you can place your SQL inside a select statement in parentheses and it works, you should be fine (tcomps are adjusted for).
    • For instance, if select youridentityfield from ( [your select statement] ) s Where your select computerid is equal to the computer id for the script works, then this solution should work for you.

Variables

Document the various variables in the script. Delete any section that is not relevant to your script.

NameDescription
VarLogA running variable holding the logged results.
BiosNameUsed when the monitor calls this script to set up the email body.
BiosVerUsed when the monitor calls this script to set up the email body.
NameThe name of the monitor.
MonitorTypeUsed to determine remote vs internal monitor.
RAWSQLUsed to recreate the monitor results to ensure overflowed variables are not present from the monitor.
DataOutUsed to recreate the monitor results to ensure overflowed variables are not present from the monitor.
FieldNameThe field name from the monitor.
ResultThe result from the monitor.
SuccessMSGSelf-explanatory.
FailedMSGSelf-explanatory.
EmailCreateBodyThe formatted body for the email creation.
TcompUsed to remove the tcomp line from the query.

Global Parameters

NameExampleRequiredDescription
EmailOnSuccess0 or 1True0 disables emailing a success email. 1 enables emailing a success email.

Output

  • Email