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:
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.
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.
First of all, Weathermap needs to be able to find your rrdtool executable. If you are using the Cacti plugin, then this information is taken automatically from Cacti. If you are using the command-line tool, you will need to edit weathermap around line 29 to point to your rrdtool executable.
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 (those produced by the Interface Traffic template). For MRTG-produced RRD files, the names are 'DS0' and 'DS1'. For Cricket standard-interface RRD files, it would be '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. Finally, you can use the 'scale:' prefix to multiply by any factor - suppose you have a value in seconds, and you want to show it in milliseconds for example. Of course, you can also divide using this, by using a scale factor that is less than 1 - multiplying by 1/x is the same as dividing by x.
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.
If you are using Cacti as your data collector, and running Weathermap from Cacti's poller, then there is another special feature, called poller_output. Weathermap can intercept data as it is collected by Cacti, and therefore avoid running lots of external rrdtool processes to collect the data it needs to display your map. This is especially useful if you are using TheWitness' Boost plugin, as the data isn't written to the rrd files until some time after it is collected. Even without Boost, it should provide a performance improvement, particularly with large installations of Weathermap.
To use this feature, a map-global variable needs to be set. Near the top of your map config file, add 'SET rrd_use_poller_output 1'. The setting will take a few poller cycles to take effect: during the first one, the appropriate cacti data sources are identified based on the rrd filenames, on the second cycle values will be collected, and on the third we'll have two values, so any COUNTER datasources will begin to work properly. If the poller_output feature fails to collect data, then the regular rrdtool-running method will be attempted too.
Note that since the rrdtool program is not bein run in this mode, you can't use the "time-shifting" features described above - those rely on using real rrdtool files.
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.
link1 3M 4M link2 66K 1.8M link3 34.6K 113
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.
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 - possible values are 'up','down','disabled', and 'recovering'.
Code | state value |
---|---|
0 | disabled |
1 | down |
2 | recovering |
3 | up |
It also sets the following additional Hint Variables, to use in a LABEL, COMMENT or NOTES section as you see fit: cacti_hostname, cacti_description, cacti_curtime, cacti_avgtime, cacti_mintime, cacti_maxtime, cacti_availability, cacti_faildate, and cacti_recdate
.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
When used with cactimonitor: prefix, this plugin takes data from both Cacti's host table and from the THold plugin's data to produce a composite state, similar to the one used by the Monitor plugin.
It sets all the same Hint Variables as cactihost: plus a couple more: thold_failcount is the number of thresholds failing on this host, and thold_failpercent is the percentage of thresholds set on this host that are failing. Bear in mind that if you have both a minimum and maximum set on the same variable, then you will never get 100% failure.
It also has a new value possible for the state Hint Variable - 'tholdbreached', and adds a new state number 4, for "threshold breached".
In the second and third forms, with the cactithold: prefix, the plugin simply returns either a 0 or 1 for the 'input bandwidth' value. 0 if the threshold has not been breached, 1 if it has. You can supply either the internal THold id number for a threshold (not easily visible), the the rra_id and data_id values which can be seen at the end of URLs within THolds web pages.
You can provide a similar output to the Monitor plugin by using the cactimonitor: TARGET and multiple icons. Create a set of coloured (or otherwise different) icons for your node - they should have 'up','down','disabled','recovering' and 'tholdbreached' in the names. Then:
NODE myserver LABEL Server 1 POSITION 100 100 TARGET cactimonitor:77 ICON images/server_{node:this:state}.png LABELOFFSET S USESCALE none
You can make use of the TARGET aggregation features of weathermap to make a value that is effectively a 'percentage badness' for a set of thresholds. Suppose you have a set of load-balanced firewalls, and you want to see how many of the set have exceeded their session count. You would set up thresholds on each firewall as normal, and then:
SCALE badness 0 100 0 255 0 255 0 0 NODE firewall_status TARGET cactithold:334:22 cactithold:34:255 cactithold:337:235 cactithold:33:254 MAXVALUE 4 USESCALE badness in
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.
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.