Macro Reference

A macro is a text string with the format ${macroname:other-information}. The macroname is required and some macros use or require other-information that follow the colon (:). The entire macro is replaced by the appropriate text when the page is generated.

Macros can fall into one of the following categories:

Include Macro

Your template files and target files might include other files.

${include:file-to-be-included.html}

the named file is inserted into the web page. The file must be in the same folder.

Macros That Generate Content of an Intermapper Web Page

Intermapper often uses these macros either as the ${bodytext} of the page or as a major part of a page's contents. All macros below work on the map named in the request URL. If the URL is for a page in the ~admin directory, Intermapper displays information about all items in all maps.

${chartlist}

outputs a sorted list of charts from the current context, one per line with each line preceded by a <LI> tag. You are required to supply your own <UL> or <OL> tags. Each chart title is a hyperlink to the related chart web page.

Within an administrator context, ${chartlist} generates a list of all charts. In a per-map context, ${chartlist} generates a list of charts from the current map.

${chartname}

outputs the title of the chart related to the current web page. If you are not on a chart-related page, the output is "".

This is similar to ${mapname}.

${currentlinkoutages}

outputs a table of current interface outages. The table's column names are Date, Time, Interface, and Duration.

${currentoutages}

shows the list of current outages (devices or links that are currently in warning, alarm, or are down in the named map).

${errorstatus_orig}

outputs the original errors status report. Differences from ${errorstatus} include the following:

  • ${errorstatus_orig} does not show device alarms.
  • ${errorstatus} first outputs interfaces in error, then interfaces with high utilization.
    ${errorstatus}lists interfaces in random order.

${errorstatus}

shows only the devices and links that are in warning or alarm states, or down for the named map.

${fullstatus}

shows a list of all the devices and links for the map named in the URL.

${include:file-to-be-included.html}

inserts the specified file into the web page.

${maplist}

shows an HTML unnumbered list (<UL>) of the maps available.

${maplistwithcharts}

shows an HTML unnumbered list of the maps available, with sub-lists of the charts for each map.

${previousoutages:hours=xx}

shows the list of previous outages within the last xx hours.

${previousoutages:maxrows=x}

shows a list of the last x previous outages.

${previousoutages}

shows the list of devices listed as outages but have since returned to normal.

Miscellaneous Macros That Describe Intermapper and Its Environment

${abouthtml}

Shows the About page with the current version of Intermapper.

${date}

The current date.

${deviceaddress}

The IP or AppleTalk address of the particular device.

For anything that is not a device, an empty string is returned.

${deviceid}

Outputs the device identifier of the device related to the current page, in the "gMMMM-rNN" format. If the current page is not device-related, output "".

${devicelist_kml}

Generates a device list in KML format for use by Google Earth.

${devicelist}

Outputs a table showing the device list for the current context. The table's columns are Status, Name, Condition, Date, Time, Probe, and Port.

Within an administrator context, ${devicelist} generates a list of all devices. In a per-map context, ${devicelist} generates a list of devices from the current map.

${devicename}

The DNS name or AppleTalk NBP name of the device. This is an empty string for anything that is not a device.

${httplocaladdress}

Outputs the IP address of the web server side of the connection. If the Intermapper server is multi-homed, this is the local side IP address of the current TCP connection.

Use caution with this address; URLs produced using this address might break in NAT situations.

${httpremoteaddress}

The IP address of the remote browser.

${httpuserid}

The name used for authentication.

${ifadmin: ADMIN : NONADMIN }

Outputs ADMIN if the user has admin privileges. Otherwise, it outputs NONADMIN.

${imagesuffix}

Set to .png if the web client can display .png images or .jpeg images, or other supported image types.

${intermapperaddress}

The IP address of this Intermapper server.

${mapname}

The current map name.

${pagetitle}

Displays the value set by the #title directive.

${SetNameFieldWidth:xx}

Set the width of the name field. Intermapper pads the name up to xx characters wide. Use -1 to set the width of the field to the width of its contents. The default width is 20 characters.

${statshtml}

Shows Intermapper's statistics: uptime, memory usage, and so on.

${telnetserverurl}

The telnet: URL that connects to this Intermapper Telnet server.

${time}

The arithmetic Linux time in seconds, counted from 00:00:00 UTC on 1 January 1970.

${timestamp}

The human-readable textual representation of the time.

${version}

The version of this copy of Intermapper.

${webserverurl}

The http: URL that connects to this Intermapper server.

Macros to Place Images On a Page

${imageref:IMAGEFILE [,tags]}

Creates an <img ... > tag to place an image on the page.

For example,
  ${imageref: photo, class='grade4'}

outputs
  <IMG SRC="/images/photo.gif" class='grade4'>

Unlike every other macro, this one uses a comma-delimiter in the parameter section instead of a colon (:).

This macro searches the images folder alphabetically for the first file where the name matches the IMAGEFILE parameter. For example, if you have two files called photo.gif and photo.png, photo.gif is found first.

${imagesuffix}

Set to .png if the web client can display .png images,.jpeg images, or other supported image types.

${intermapperlogo}

Creates an <img... > tag that includes the Made with Intermapper logo image.

*chart

Displays a strip chart that generally has a suffix of ${chart}.${imagesuffix} to send the desired format for the client's browser. This uses the width parameters for the chart, in pixels and the other parameters of the URL.

Usage:

<IMG SRC="*chart.${imagesuffix}?${clientwidth}&${httpparams}">
or
<IMG SRC="*chart.${imagesuffix}?width=300&${httpparams}">

*imagemap.html

Displays an HTML imagemap that corresponds to the map image. When you click in the image, it follows the links in the (automatically-generated) image map.

Usage:

${include:/${httpdocument}/document/main/*imagemap.html}

*map

Displays an image of the devices, networks, and links (the foreground) of the selected map against a transparent background. The objects in this image match the *imagemap.html, below. Takes an option of a timestamp to provide for auto-refresh.

Usage:

<img src="/${httpdocument}/document/main/*map.${imagesuffix}?${timestamp}">

*mapbg

Displays the background image of the selected map. This provides the customer-selected background to the map as an image. It takes an option of a timestamp to provide for auto-refresh.

Usage:

<img src="/${httpdocument}/document/main/*mapbg?${timestamp}">

*popuptext.html

Displays the contents of the current device, network, or interface Status Window (formerly called pop-up windows) as HTML.

Usage:

${include: *popuptext.html}, generally enclosed in <pre> ...</pre> tags.

NOTE:

The web pages combine *map with the *mapbg and *imagemap to create a <div> that superimposes all three items into a single visual unit. See Intermapper Settings/Web Pages/PerMapHTML/map.html for an example.

Macros That Control the Interval Between Page Refreshes

Intermapper's web server can automatically refresh a web page at a desired interval. Include these tags on your page to take advantage of this facility.

${htmlrefreshmetaoptions}

The option list that a web client can choose from. The current ${htmlrefreshmetatag} value is selected. Note that your HTML template should supply the <form><select>...</select></form> surrounding this ${htmlrefreshmetaoptions} macro.

${htmlrefreshmetatag}

Either an empty string or the previous refresh choice from the web client. (Inserts a <meta http-equiv="refresh"...> tag on the resulting page.)

${jsrefreshoptions} The option list that a web client can select from, generated with JavaScript. The current ${htmlrefreshmetatag} value is selected. Note that your HTML template should supply the <form><select>...</select></form>

Macros Related to Links and URLs

These macros all return a fully-escaped string, meaning that a space character is replaced with a %20, a question mark (?) with %3F, and so on.

The following is a sample URL. The result of using this URL is shown in parentheses after each macro:

http://localhost/Map1/device/192.168.0.1%3ASNMP/!device.html

${anchor: value}
${attr}

Sets the current anchor value.

Outputs the current anchor parameter value as a set using ${anchor: value}. If no anchor value is set, the output is "".

These two macros are closely related. ${anchor} sets the value and ${attr} retrieves it.

Example

${anchor:class="header"}
  <A HREF="maplist.html" ${attr}>Map List</A>
  <A HREF="${TelnetServerURL}" ${attr}>Telnet</A>
  <A HREF="${WebServerURL}"${attr}>Home</A>
${anchor:}

In this example, the anchor is set to class="header". The ${attr} macro is used to place the attribute string in each link. Afterward, ${anchor:} sets the anchor to an empty string.

${httpclass}

The second level directory of the page requested (device, chart, link, document, or network). For example, device.

${httpdocument}

The top level directory of the page requested. Also an alias for ${mapname}. For example, Map1.

${httpinstance}

The third level directory of the page requested. For example, 192.168.0.1%3ASNMP.

${httpinstancepath}

A concatenation of ${httpdocument}, ${httpclass}, ${httpinstance} separated by forward slashes (/). For example, /Map1/device/192.168.0.1%3ASNMP.

${httpmethod}

The fourth-level part of the page requested. For example, !device.html.

${httpparam: NAME}

Outputs the value of the HTTP parameter specified by NAME. An HTTP parameter is one passed with the originating GET request, affixed to the URL following a question mark. If there is no HTTP parameter by the given name, outputs "".

Example, given the following URL:

http://www.example.com/TestMap/?color=red&style=bold

${httpparam: color} outputs red
${httpparam: style} outputs bold
${httpparam: font} outputs "" (because the parameter does not exist)

${httpparams_endchart}
${httpparams_nextchart}
${httpparams_prevchart}
${httpparams_startchart}
${httpparams_timescale}

${httpparams_endchart} - Replaces the value of the endtime parameter with the last name of the chart. (For scrolling to the end of the chart.)

${httpparams_nextchart} - Replaces the value of the endtime parameter with a new time value that effectively scrolls the chart one page into the future.

${httpparams_prevchart} - Replaces the value of the endtime parameter with a new time value that effectively scrolls the chart one page into the past.

${httpparams_startchart} - Replaces the value of the endtime parameter with the start time of the chart. (For scrolling to the beginning of the chart).

${httpparams_timescale: VALUE} - Replaces the value of the timescale parameter with the specified value.

These five macros are nearly identical to ${httpparams}. They implement support for chart scrolling and scaling in the web interface. They generate output only within a web page associated with a chart.

${httpparams}

Outputs all the HTTP parameters from the originating GET request in their original format. If there were no parameters attached to the original request, output "".

Example, given the following URL:

http://www.example.com/TestMap/?color=red&style=bold

${httpparams} outputs color=red&style=bold.

${httppath}

The full path to the requested file. For example, /Map1/device/192.168.0.1%3ASNMP/!device.html.

${webpageurl}

The full URL of the requested web page. For example, the full URL as shown above.