Macros
You can use macros in Action Menus, action_url, notes_url and icon_url, among other places.
Host Macros
Host related Macros:
| Macro | Example | Description |
|---|---|---|
| $HOSTNAME$ | www.thruk.org | Name from the host configuration |
| $HOSTALIAS$ | thruk.org | Alias from the host configuration |
| $HOSTADDRESS$ | 94.185.90.75 | Adress from the host configuration |
| $HOSTATTEMPT$ | 1 | Number of current check attempt |
| $MAXHOSTATTEMPTS$ | 5 | the configured max_check_attempts value for this host |
| $HOSTBACKENDADDRESS$ | localhost:6557 | Connection string used by the backend of this host |
| $HOSTBACKENDID$ | abcd | Internal id for the backend of this host |
| $HOSTBACKENDNAME$ | Cental-Monitor | Given name for the backend of this host |
| $HOSTCHECKCOMMAND$ | check_http!www.thruk.org | Checkcommand used for this host |
| $HOSTDOWNTIME$ | 1 | Scheduled downtime level, 0 if no downtime, >= 1 if in downtime |
| $HOSTDURATION$ | 1337 | Time in seconds since last state change |
| $HOSTLATENCY$ | 0.12 | Latency of last check in seconds |
| $HOSTNOTES$ | notes text | contains the configrured notes value for this host |
| $HOSTNOTESURL$ | http://example.org | Notes URL |
| $HOSTOUTPUT$ | HTTP - 200 OK... | Output of last check |
| $HOSTPERFDATA$ | size=100B;200;300;;; | Performance data from the last check |
| $HOSTSTATE$ | UP | State of last check in human readable form |
| $HOSTSTATEID$ | 0 | Number of the current state. 0 UP, 1 Down, 2 Unreachable |
| $HOSTSTATETYPE$ | HARD | Either HARD or SOFT |
| $_HOST{CUSTVARS}$ | anything | Custom variable value |
Service Macros
Service related Macros:
| Macro | Example | Description |
|---|---|---|
| $SERVICEDESC$ | Check Website | Description from the service configuration |
| $SERVICEATTEMPT$ | 1 | Number of current check attempt |
| $MAXSERVICEATTEMPTS$ | 5 | the configured max_check_attempts value for this service |
| $SERVICEBACKENDADDRESS$ | localhost:6557 | Connection string used by the backend of this service |
| $SERVICEBACKENDID$ | abcd | Internal id for the backend of this service |
| $SERVICEBACKENDNAME$ | Cental-Monitor | Given name for the backend of this service |
| $SERVICECHECKCOMMAND$ | check_http!www.thruk.org | Checkcommand used for this host |
| $SERVICEDURATION$ | 1337 | Time in seconds since last state change |
| $SERVICELATENCY$ | 0.12 | Latency of last check in seconds |
| $SERVICENOTESURL$ | http://example.org | Notes URL |
| $SERVICEOUTPUT$ | HTTP - 200 OK... | Output of last check |
| $SERVICEPERFDATA$ | size=100B;200;300;;; | Performance data from the last check |
| $SERVICESTATE$ | OK | State of last check in human readable form |
| $SERVICESTATEID$ | 0 | Number of the current state. 0 UP, 1 Down, 2 Unreachable |
| $SERVICESTATETYPE$ | HARD | Either HARD or SOFT |
| $_SERVICE{CUSTVARS}$ | anything | Custom variable value |
Date/Time Macros
Date and time related macros:
| Macro | Example | Description |
|---|---|---|
| $SHORTDATETIME$ | 2015-01-14 14:53:35 | Date with format: %Y-%m-%d %H:%M:%S |
| $LONGDATETIME$ | Wed Jan 14 14:53:35 CET 2015 | Date with format: %a %b %e %H:%M:%S %Z %Y |
| $DATE$ | 2015-01-14 | Date with format: %Y-%m-%d |
| $TIME$ | 14:53:35 | Date with format: %H:%M:%S |
| $TIMET$ | 1421243760 | Unix Timestamp |
User Macros
Macros from the resource.cfg:
| Macro | Example | Description |
|---|---|---|
| $USER1$ | /usr/lib/nagios/plugins | USER1 variable from resource.cfg |
| ... |
Dashboard Macros
These macros are only available in server actions used by action items in the panorama dashboard.
| Macro | Example | Description |
|---|---|---|
| $REMOTE_USER$ | thrukadmin | User name of current user which is also available in $REMOTE_USER environment variable |
| $DASHBOARD_ID$ | 10 | Number of the current dashboard |
| $DASHBOARD_ICON$ | tabpan-tab_1_panlet_2 | Id of the current icon which triggered the server action |