Sensor Factory Sensors
A sensor with special capabilities is called "Sensor Factory". It allows combining measurements from two or more sensors into one new sensor.
Samples for usage are:
- Show two or more channels from one or more sensors in one graph.
- Add the value from two or more channels from one or more sensors into a new value (you can also subtract, multiply and divide values).
- Create charts with one or more graph lines and one or more horizontal lines at specific vertical positions.
This is the graph of a Sensor Factory with 4 channels that use data from 4 different sensors:

Here is second sample: A sensor factory which compares the results of an SNMP sensor, a WMI sensor and two packet sniffer sensors for one data line. And there is a horizontal line at 2 Mbit/s.

The Sensor Factory can be found in the "Custom Sensors" section when creating a new sensor.
Channel Definition Basic Syntax
The behaviour of a Sensor Factory sensor is controlled by a text field called "Channel Definition". The basic syntax for a channel definition looks like this:
#<id>:<name>[<unit>]
<formula>
For each channel one section is used. A section begins with the # sign. Here is an example with two channels:
#1:Sample
Channel(1000,0)
#2:Response Time[ms]
Channel(1001,1)
The parameters are:
- <id> must be a unique number (1 or greater).
- <name> is the name of the channel (displayed in graphs and tables).
- [<unit>] is optional (e.g. bytes). If it is not provided a fitting unit string is automatically selected (recommended).
- <formula> contains the formula to calculate the channel.
In the formula the following elements are allowed:
- Basic operations: + - * / -
Example: 3 + 5 * 2 - Brackets: ( )
Example: 3 * (2 + 6) - Compare: = (equal) <> (not equal) > (greater) < (less) >= (greater or equal) <= (less or equal). If the compare is "true" the value is 1, otherwise 0, for delta sensors the speed is compared.
- Functions: channel, min, max, avg, percent.
channel() Function
The channel() function allows to read the data from a channel of a different sensor. The syntax is:
channel(<SensorId>,<ChannelId>)
- The SensorId is displayed on the sensor details page, in the "Overview" tab behind the sensor name.
- The ChannelID is displayed on the sensor details page, in the "Channels" tab for each channel behind the channel name.
Example: Read the data of sensor ID 2001, channel ID 2:
channel(2001,2)
Channels can be gauge values (e.g. PING ms) or delta values (e.g. traffic kbit/s) values. Not all combinations are allowed in a formula. There are calculations you cannot do:
- You cannot add/subtract a delta from a gauge channel (and vice versa).
- You cannot multiply two delta channel.
- You cannot compare a delta with a gauge channel.
- You cannot use a channel of (another) Sensor Factory channel in the formula.
min() and max() Functions
The min() and max() functions return the minimum or maximum of the two values. The syntax is:
min(<a>,<b>)
max(<a>,<b>)
Values for a and b are either numbers or channel() functions, see this example:
min(10,5)
min(channel(2001,1),channel(2002,1))
The first one returns "5", the latter one returns the minimum of channel 1 of the sensors with IDs 2001 and 2002.
avg() Function
avg() returns the average of the two values. This equals: (a+b) / 2. The syntax is:
avg(<a>,<b>)
Example:
avg(20,10)
This function returns "15".
percent() function
Calculates the percent value of a value (e.g. a channel) compared to a given fixed value. The syntax is:
percent(<source>,<maximum>[,<unit>])
"Source" is the value the percent is calculated for. This is usually a "channel()" function. "Maximum" is the limit value used for the percent calculation. This value is multiplied with the maximum value. "Unit" is optional and is the unit the maximum is provided in. You can use constants with this function (see below for a list). This can be used for gauge (e.g. PING) sensors and delta (e.g. Traffic Sensors).
The following example shows how to display a traffic sensor as % of maximum bandwidth (100 kilobit/second):
#1:Usage IN
percent(channel(2001,0),100,kilobit)
#2:Usage OUT
percent(channel(2001,1),100,kilobit)
Another example shows how to display the values of a sensor as percentage of 200ms:
#1:Ping %
percent(channel(2002,0),200)
Horizontal Lines
You can add lines to the graph using a formula without a channel() function (returning a fixed value). In this case you have to provide the unit of the axis the line is used for. You can use constants here. Examples:
#1:Line at 100ms [ms]
100
#2:Line at 50 kbit [kbit/s]
50
#3:2 Mbit/s [kbit/s]
2000
Constants
The following constants are defined and can be used in calculations:
- one = 1
- kilo = 1000
- mega = 1000 * kilo
- giga = 1000 * mega
- tera = 1000 * giga
- byte = 1
- kilobyte = 1024
- megabyte = 1024 * kilobyte
- gigabyte = 1024 * megabyte
- terabyte = 1024 * gigabyte
- bit = 1/8
- kilobit = kilo / 8
- megabit = mega / 8
- gigabit = giga / 8
- terabit = tera / 8
Channel Settings
The color, line thickness, warning/error limits, etc. can be edited on the "Channels" tab after creating the sensor. This works like with any other sensor. You can also use triggers to send notifications. See section Edit Sensor and Channel Settings for more details.
Tips and Infos
- The data is always calculated on the fly using the Historic Data of the sensors if available.
- The display of live data for Sensor Factory sensors can be delayed since it has to wait for data in all used channels.
- You can use channels from sensors with different scanning intervals to create a new channel, but it is recommended to use the same interval for the source sensors and the Sensor Factory.
- There is no uptime/downtime totals calculation for Factory Sensors.
- The coverage of the Sensor Factory is defined as the minimum coverage of all Sensor Factory channels.
- The coverage of a Sensor Factory channel is the weighted average coverage of the sensors used in the calculation.
- The downtime channel of Sensor Factory sensors is defined as the average of the downtime of all used channels.
Keywords: Sensor,Factory Sensor,Aggregation Sensor,Combine Sensor Values,Merge Sensors,Aggregate Sensor Values,Custom Sensor
