Sensor Factory Sensor Type

A sensor with special capabilities is called the "Sensor Factory". It allows to combine measurements from two or more sensors into one new sensor.

Samples for the 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:

clip0126

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.

clip0127

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 - which begins with the # sign - is used. Here is an example with two channels:

#1:Sample
Channel(1000,0)
#2:Response Time[ms]
Channel(1001,1)

The parameters are:

  • The <id> must be a unique number (1 or greater).
  • The <name> is the name of the channel (displayed in graphs and tables).
  • The [<unit>] is optional (e.g. bytes). If it is not provided a fitting unit string is automatically selected (recommended).
  • The <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 behind the sensor name on the sensor "Overview" page.
  • The ChannelID displayed for each channel in the "Edit Channel" section of the "Channels" page.

Example: Read the data of channel 2 of sensor 2001

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. You can NOT:

  • Add/subtract a delta from a gauge channel (and vice versa)
  • Multiply two delta channel
  • Compare a delta with a gauge channel
  • Use a channel of a Aggregation 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 numbers or channel() functions, see this example:

min(10,5) -> return 5
min(channel(2001,1),channel(2002,1)  

The latter one returns the minimum of channel 1 of the sensors 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) -> 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. Unit is optional and is the unit the maximum is provided in. This value is multiplied with the maximum value. You can use constants here (see below for a list). This can be used for gauge (e.g. Ping) sensors und 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.

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 value for the source sensors and the sensor factory
  • There is no uptime/downtime totals calculation for aggregation 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 senors is defined as the average of the downtime of all used channels.

Continue

Keywords: factory,sensor,aggregation