When you create alerts, or modify preconfigured alerts, you can include a variable in the alert description. The variable provides more detail about the device or interface that triggered the alert.
- Variables must relate to the alert condition
- How to enter variables
- Percentage-based variables
- Date/time based variables
- Alert-specific variables
Variables must relate to the alert condition
Any variables you set must relate to the alert condition. The variables available for each alert condition are shown in the tables below.
You create an alert with a trigger condition of Device Online Status. Looking at the table below, you can see the variables you can add to the alert description include device make, device model, and device serial number.
Your alert description with variables included looks like this:
A device has recently gone $deviceOnlineStatusString. Device details are: Make $deviceMake, model $deviceModel, and serial number $deviceSerialNumber.
When the alert triggers, you’ll see this message:
A device has recently gone offline. Device details are: Make Cisco, model 2801, and serial number FTX1113W12Y.
If you set a variable that doesn’t relate to the alert condition, it will not return any information.
You create an alert with a trigger condition of Interface Utilization. In the alert description, you include a variable about interface utilization. But you also include a variable about interface packet error count.
Your alert description looks like this:
This interface is at $interfaceUtilization%.0f% utilization and the interface packet error counts are $interfaceErrorCount.
Because the packet error count variable doesn’t relate to the interface utilization condition, the result for that variable is null. When the alert triggers, you’ll see this message:
This interface is at 50% utilization and the interface packet error counts are .
How to enter variables
When you add a variable to an alert description, you must enter it exactly as shown below. If you enter the variable without the dollar sign, for example, you’ll receive the plain text of the variable (e.g., deviceOnlineStatusString) rather than the appropriate value (e.g., online) in your alert message.
Percentage-based variables default to a zero decimal place value. You can change the zero decimal place value to two decimal places by changing %.0f% to %.2f%. Excluding %.0f% altogether results in a value with no rounding (e.g., 29.833333333333332).
Date/time-based variables default to the following format: Thu Feb 12 21:37:15 UTC 2015. But you can define the date/time format differently if you prefer. These are the formats that can be used:
- Date (mm/dd/yy) - %tm/%td/%ty
- Date (YY-MM-DD) - %tY-%tm-%td
- 24-hour clock (hh:mm) - %tH:%tM
- 24-hour clock (hh:mm:ss) - %tH:%tM:%tS
- 12-hour clock (hh:mm am/pm) - %tI:%tM %Tp
- 12-hour clock (hh:mm:ss am/pm) - %tI:%tM:%tS %Tp
Enter date/time variables as shown in this example:
The last snapshot taken was on $lastSnapshot%tI:$lastSnapshot%tM:$lastSnapshot%tS $lastSnapshot%Tp at $lastSnapshot%tm/$lastSnapshot%td/$lastSnapshot%ty
The list below contains links to articles with the variables that can be used to set conditions or descriptions, for each particular type of alert.