Context templates are html files with some macros in them. These files can be used as context menus (right click menus) for the objects on the maps.
The context templates are located in nagvis/templates/context/
relative to the nagvis root directory. The templates are named like this: tmpl.<name>.html
. It is possible to add a css file to the template, the name has to be: tmpl.<name>.css
.
There are some so called macros available in context menus of all object types and some which are only available for some special objects. All standard macros are listed below.
The following macros are available in hover menus of all object types:
Macro | Description |
---|---|
General | |
[obj_id] | ID of object in JavaScript. Needed to locate the object specific parts e.g. to schedule a manual update of the state information. |
[name] | Name of the object (Hostname, Hostgroupname, Servicegroupname, Mapname,...) |
Language macros | |
[lang_refresh_status] | Label for refreshing the status of the object in frontend. |
[lang_schedule_downtime] | Label for scheduling a downtime in Nagios. |
[lang_reschedule_next_check] | Label for re-scheduling the next check of the object in Nagios. |
[lang_connect_by_ssh] | Label for connecting a host by ssh. |
Paths | |
[html_base] | Absolute URL to HTML-Base (Default: /nagios/nagvis) |
[html_cgi] | Absolute URL to the Nagios CGIs (Default: /nagios/cgi-bin) |
[html_templates] | Path to context templates directory (Default: /nagios/nagvis/nagvis/etc/templates/context) |
[html_template_images] | Path to context template images directory (Default: /nagios/nagvis/nagvis/images/templates/context) |
There are macros for context templates of a specified type. These macros should be surrounded by section macros. The section macros define that the included code will be removed if the hover template is not parsed for this type.
For example a section macro for host macros looks like this:
<!-- BEGIN host -->.+?<!-- END host -->
Below you can find a full list of the special macros.
Macro | Description |
---|---|
[address] | Address of the host configured in Nagios |
Macro | Description |
---|---|
[service_description] | Service description in Nagios |