Have you ever been in a position where you have wanted to put together a custom script that triggers when a monitor fails, but you have no idea what variables are passed in to the script from the monitor? It’s not like you can debug through this behaviour either as you can’t trigger a script as monitor in debug mode. The documentation, even when it was at its best, still didn’t document all these variables. Though they were half documented at some point, I can’t even find them at all any more in the ConnectWise University documentation.
Fortunately, there is an easy way to get a handy list of variables. Simply add this step in to your script. It will take every variable that the script can see and log them in to the script log on the Agent the script is running on:
Variables I have picked up over the years
@result@ Result from monitor, for an internal monitor, the value of the ‘result’ field.
@where@ Table to check in internal monitor
@what@ Field to check in internal monitor
@status@ FAILED, SUCCESS – status of monitor
@monitor@ Name of calling monitor
@priority@ Priority of ticket to be created
@fieldname@ Generally the value of the field
@message@ Value of identity field
@disablealerting@ Monitor override to disable alerting
@ticketcreationcategory@ Numeric id of ticket category
@tzcompdisabled@ 0, 1 – If the monitor/script was called with timezone compensation disabled
@proploadedticketing@ 0, 1 – set if the system automation scripts have loaded ticket property variables
@scriptticketclose@ True, False – unknown
@propticketdefaultuserid@ Numeric id of LabTech user
@propticketdefaulttimecategoryid@ Numeric id of time category
@propticketdefaultminutestobill@ Numeric number of minutes to bill
@scripttimerecord@ True, False – boolean to enter time for monitor
@propticketmaxconsolidationcomments@ Numeric value for maximum number of comments to be appended to ticket
@propticketenableautofixtime@ 0, ? – should autofixes enter ticket time
@propticketinfocategoryid@ Numeric id of ticket category for ticket creation
@propticketinfoautoclose@ Numeric id ?
I have integrated Opsgenie alert in connectwise using https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-connectwise-automate-api/ link but I did not get @monitor@ value…then I also tried to display all variables using this link but I did not get @monitor@ value…It always gives me “@monitor@” as a string not variable value. Did I do anything wrong?
Thank you for this. I was trying to figure out why tickets created by the eventlog monitors were showing truncated information from the event in question. Using the Show Variables script showed that the @fieldname@ variable was the culprit and that the @verbosefieldname@ variable actually showed all the information. I updated the applicable scripts to use the verbose variable and now my techs are receiving useful information from these monitors.