Sensor Factory Sensor
The Sensor Factory sensor is a powerful tool that allows you to create your own sensor with channels based on data from other sensors. You can define one or more channels using formulas that combine monitoring results from other sensors.
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 graphs with one or more graph lines and one or more horizontal lines at specific vertical positions.
The Add Sensor dialog appears when adding a new sensor on a device manually. It only shows the setting fields that are imperative for creating the sensor. Therefore, you will not see all setting fields in this dialog. You can change all settings in the sensor's Settings tab later.
Sensor Factory Sensor Settings
On the sensor's detail page, click on the Settings tab to change settings.
Note: If not set explicitly in a sensor's settings, it will connect to the IP address or DNS name defined in the settings of the parent device the sensor is created on.
Basic Sensor Settings |
|
Sensor Name |
Enter a meaningful name to identify the sensor. The name will be shown by default in the device tree and in all alarms. |
Tags |
Enter one or more tags, separated by space or comma. You can use tags to group sensors and use tag-filtered views later on. Tags are not case sensitive. We recommend using the default value. You can add additional tags to it, if you like. Tags are automatically inherited. |
Priority |
Select a priority for the sensor. This setting determines where the sensor will be placed in sensor lists. Top priority will be at the top of a list. You can choose from one star (low priority) to five stars (top priority). |
Sensor Factory Specific Settings |
|
Channel Definition |
Enter a channel definition for the sensor. Using a specific syntax, you can refer to data from other sensors here. Please see section Channel Definition Basic Syntax below. |
Error Handling |
Define the sensor's behavior if one of the sensors defined above is in an error state. In this case, you can set the sensor factory sensor either to error or to warning state. Choose between:
|
By default, all following settings are inherited from objects higher in the hierarchy and should be changed there, if necessary. Often, best practice is to change them centrally in the Root group's settings. To change a setting for this object, disable inheritance by clicking on the check mark symbol in front of the respective setting name. You will then see the options described below.
Scanning Interval |
|
Scanning Interval |
The scanning interval determines the time the sensor waits between two scans. Select a scanning interval (seconds, minutes, or hours) from the list. You can change the available intervals in the system administration. |
Schedules and Dependencies |
|
Schedule |
Select a schedule from the list. Schedules can be used to pause monitoring for a certain time span (days, hours) throughout the week. You can create new schedules and edit existing ones in the account settings. Note: Schedules are generally inherited. New schedules will be added to existing ones, so all schedules are active. |
Dependency Type |
Define a dependency type. Dependencies can be used to pause monitoring for an object depending on the status of another. You can choose between:
Note: Testing your dependencies is easy! Simply choose Simulate Error Status from the context menu of an object that other objects depend on. A few seconds later all dependent objects should be paused. |
Dependency |
This field is only visible if the select object option is enabled above. Click on the reading-glass symbol and use the object selector to choose an object on which the current sensor will be dependent on. |
Inherit Access Rights |
|
User Group Access |
Define which user group(s) will have access to the object you're editing. A table with user groups and right is shown; it contains all user groups from your setup. For each user group you can choose from the following access rights:
You can create new user groups in the System Administration—User Groups settings. To automatically set all objects further down in the hierarchy to inherit this object's access rights, set a check mark for the Revert children's access rights to inherited option. |
Channel Unit Configuration |
|
Channel Unit Types |
For each type of sensor channel, define the unit in which data is displayed. If defined on probe, group, or device level, these settings can be inherited to all sensors underneath. You can set units for the following channel types (if available):
Note: Custom channel types can be set on sensor level only. |
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). 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 channels.
- You cannot compare a delta with a gauge channel.
- You cannot use a channel of (another) Sensor Factory sensor 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
The avg() function 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
The percent() function calculates the percent value of two given values, for example, a channel and a 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. PRTG will calculate <source>/<maximum> * 100.
Unit is optional and is the unit the maximum is provided in. You can use constants with this function (see Constants section 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
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
Knowledge Base: Can I add sensors to Sensor Factory sensors using tags?
Click on the Channels tab to change display settings. For detailed information, please see Sensor Channels Settings section.
Click on the Notifications tab to change notification triggers. For detailed information, please see Sensor Notifications Settings section.
For more general information about settings, please see Object Settings section.
For information about sensor settings, please see the following sections:
Keywords:
