Specifying TARGET lines

The actual data-reading part of Weathermap is handled by Data Source Plugins since version 0.9. These allow users or third-parties to easily add new data sources into Weathermap without altering the core code.

There are a number of plugins supplied as standard, which will be described here. Each one uses a different format of TARGET string, which contains the parameters the plugin needs to find your data. All plugins return an 'in' and 'out' value, and some may set other variables that can be accessed by Special Tokens in strings. For situations where there is only really one output, the 'out' value may just be the same as the 'in'.

Here are the details of the standard data source plugins:

Static value

TARGET static:invalue:outvalue
TARGET static:value

The simplest of all the plugins, static allows you to just set a value in the config file itself. Sometimes this is useful for testing, or simple maps of things like OSPF metrics. If only a single value is specified, it is used for both input and output, just like the BANDWIDTH parameter.

The values in the target string can use the same K,M,G,T suffixes as BANDWIDTH.

RRDtool files

TARGET rrdfile.rrd:in_ds:out_ds
TARGET gauge:rrdfile.rrd:in_ds:out_ds
TARGET rrd:rrdfile.rrd:in_ds:out_ds

This is the 'core' plugin for Weathermap. It reads data from rrd files, created using Tobi Oetiker's RRDtool, by tools like Cacti, MRTG, Cricket, NRG and so on.

If you only specify a filename, and no DS-names, the default DS names for RRD files are 'traffic_in' and 'traffic_out', which works with the majority of Cacti RRD files. For MRTG-produced RRD files, the names are 'DS0' and 'DS1'.

You can also specify '-' for either DS name, which tells Weathermap to ignore this rrd file for the purposes of the input or output value. This is mainly useful in combination with the aggregation feature, where you can take the input data from one rrd file, and the output data from another.

With no prefix, or with just 'rrd:' as a prefix, the data read from the rrd file is assumed to be a standard SNMP interface counter, which is a byte-rate. It automatically multiplies these by 8 to get a bit-rate for the map. With the 'gauge:' prefix, this multiplication doesn't happen, which is useful for non-bandwidth values, like SNR or session-counts.

By default, the plugin will read the last 800 seconds of data, and find the most recent within that to use. You might need to make it read back further, if you are updating your rrd files slowly. You can do this with the SET command, by adding 'SET rrd_period 3000' (any value in seconds) at the top of your map config file, before any NODE or LINK lines.

Similarly, you can change the time that the plugin looks for data at from the present to the past, by using 'SET rrd_start -1d' in the top section of the config file. The full range of time-specification strings is at the bottom of the rrdfetch manual page.

Tab-separated text

TARGET textfile

For tab-delimited data files, the format is plain-text, with three tab-seperated columns. The first one is a linkname, and the second and third are traffic-in and traffic-out, respectively. The linkname should match the name in the configuration file. This allows you to create one text file for the entire map from some outside source. Traffic in & out values can use the same "K,M,G,T" abbreviated forms as the BANDWIDTH configuration command. The file should have an extension of .txt or .tsv to be recognised as a tab-delimited file by Weathermap.

MRTG .html file

TARGET htmlfile

This plugin reads data from special comments in the HTML files generated by MRTG. This is intended mainly for people using the 'old-style' MRTG .log files. If you are using MRTG with an RRDtool backend, then it's probably better to use the RRDtool plugin.

The file should have an extension of .html or .htm to be recognised as an MRTG file by Weathermap.

Cacti host status

TARGET cactihost:hostid

This plugin reads the current status of a host from your Cacti database. The hostid is visible in Cacti URLs when you click on links in the Devices page. The return values for this plugin are numeric codes. It also sets a Hint Variable called 'state' to a string, that can be nicer to use in an ICON filename, for example

Codestate value

An appropriate SCALE definition to get red, green, yellow and grey labels based on the state of a host would be:

SCALE cactiupdown 0 0.5 192 192 192 
SCALE cactiupdown 0.5 1.5 255 0 0 
SCALE cactiupdown 1.5 2.5 0 0 255 
SCALE cactiupdown 2.5 3.5 0 255 0 

SNMP value

TARGET static:invalue:outvalue

This is a fairly experimental plugin. It requires the PHP snmp extension to be installed and enabled. Even then, it's hit & miss whether it will work on a particular system - some versions of PHP have better support for SNMP than others, and on some platforms it is different to others, too.

This plugin can directly query an SNMP-manageable device and fetch an OID from it.

External script

TARGET !scriptname

This plugin is fairly experimental and not thoroughly tested.

This plugin allows you to write small external scripts, and pass the value from the script into Weathermap. The output format of the script is the same one that MRTG uses for it's external scripts, so it's possible that you can even find an existing script to do what you want, somewhere else.