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:
-
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. -
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.
- For instance, if
Variables
Document the various variables in the script. Delete any section that is not relevant to your script.
Name | Description |
---|---|
VarLog | A running variable holding the logged results. |
BiosName | Used when the monitor calls this script to set up the email body. |
BiosVer | Used when the monitor calls this script to set up the email body. |
Name | The name of the monitor. |
MonitorType | Used to determine remote vs internal monitor. |
RAWSQL | Used to recreate the monitor results to ensure overflowed variables are not present from the monitor. |
DataOut | Used to recreate the monitor results to ensure overflowed variables are not present from the monitor. |
FieldName | The field name from the monitor. |
Result | The result from the monitor. |
SuccessMSG | Self-explanatory. |
FailedMSG | Self-explanatory. |
EmailCreateBody | The formatted body for the email creation. |
Tcomp | Used to remove the tcomp line from the query. |
Global Parameters
Name | Example | Required | Description |
---|---|---|---|
EmailOnSuccess | 0 or 1 | True | 0 disables emailing a success email. 1 enables emailing a success email. |