PRTG Manual: 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 single channels of one or more sensors in one graph.
  • Use the data from single channels of one or more sensors to calculate new values (for example, you can subtract, multiply, and divide).
  • Create graphs with data from other sensor channels and add horizontal lines at specific vertical positions.

Note: A sensor factory sensor does not show a "Downtime" channel. Downtime cannot be calculated for this sensor type.

Note: The Sensor Factory sensor might not work with flow sensors. Sensor types using active flow timeout, this is, NetFlow and jFlow sensors, are not supported by the Sensor Factory sensor.

Note: This sensor type can have a high impact on the performance of your monitoring system. Please use it with care! We recommend using not more than 50 sensors, on each probe, of this type of sensor.

Limited to 50 Sensor Channels

PRTG does not support more than 50 sensor channels officially. Depending on the data used with this sensor type, you might exceed the maximum number of supported sensor channels. In this case, PRTG will try to display all sensor channels. However, please be aware that you will experience limited usability and performance.

Add Sensor

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 Settings

On the sensor's details 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. Other tags are automatically inherited from objects further up in the device tree. Those are not visible here.

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 channels of other sensors here. You can also calculate values. Enter one channel definition for each new channel you want to add to this sensor. Please see section Define Sensor Channels below.

Error Handling

Define the sensor's behavior if one of the sensors defined above is in an error status. In this case, you can set the sensor factory sensor either to error or to warning status. Choose between:

  • Factory sensor shows error status when one or more source sensors are in error status: If at least one sensor used in a channel definition is in a Down status, the factory sensor will show a Down status as well until all referred sensors leave this status. While the factory sensor is Down it will still show data of all available sensor channels.
  • Factory sensor shows warning status when one or more source sensors are in error status: If at least one sensor used in a channel definition is in a Down status, the factory sensor will show a Warning status until all referred sensors leave the Down status.
  • Use custom formula: Define the status of the factory sensor by adding a status definition in the field below.

Status Definition

This field is only visible if custom formula is enabled above. Define when the sensor will switch to a Down status. You can use the status() function in combination with Boolean operations. For advanced users it is also possible to calculate a status value. Please see section Define Sensor Status below.

If a Sensor Has No Data

Choose how this Sensor Factory sensor will react in case a sensor referred to in the channel definition does not provide any data (for example, because it is paused or does not exist). Choose between:

  • Do not calculate factory channels that use the sensor: For channels that are defined using one or more sensor(s) that deliver no data, no data will be shown. Additionally, the sensor will show a Warning state.
  • Calculate the factory channels and use zero as source value: If a sensor used in a channel definition does not deliver any data, zero values will be filled in instead. The channel will be calculated and shown using these values.

Inherited Settings

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, Dependencies, and Maintenance Window

Note: Inheritance for schedules, dependencies, and maintenance windows cannot be interrupted; the according settings from the parent objects will always be active. However, you can define additional settings here. They will be active in parallel to the parent objects' settings.

Schedule

Select a schedule from the list. Schedules can be used to monitor for a certain time span (days, hours) throughout the week. With the period list option it is also possible to pause monitoring for a specific time span. 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.

Maintenance Window

Specify if you want to set-up a one-time maintenance window. During a maintenance window this object and all child objects will not be monitored. They will enter a paused state then. Choose between:

  • Not set (monitor continuously): No maintenance window will be set.
  • Set up a one-time maintenance window: Pause monitoring within a maintenance window.

Maintenance Begins At

This field is only visible if maintenance window is enabled above. Use the date time picker to enter the start date and time of the maintenance window.

Maintenance End At

This field is only visible if maintenance window is enabled above. Use the date time picker to enter the end date and time of the maintenance window.

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:

  • Use parent: Pause the current sensor if the device it is created on is in a Down status, or if it is paused by another dependency.
  • Select object: Pause the current sensor if the device it is created on is in an Down status, or if it is paused by another dependency. Additionally, pause the current sensor if a specific other object in the device tree is in a Down status, or if it is paused by another dependency. Select below.
  • Master object for parent: Make this sensor the master object for its parent device. The sensor will influence the behavior of the device it is created on: If the sensor is in a Down status, the device will be paused. For example, it is a good idea to make a Ping sensor the master object for its parent device to pause monitoring for all other sensors on the device in case the device cannot even be pinged. Additionally, the sensor will be paused if the parent group of its parent device is in a Down status, or if it is paused by another dependency.

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.

Delay (Seconds)

Define a time span. After the master object for this dependency comes back to an Up status, monitoring of the depending objects will be additionally delayed by the defined time span. This can help avoid false alarms, for example, after a server restart, by giving systems more time for all services to start up. Please enter an integer value in seconds. Note: This setting is not available if you choose this sensor to be the Master object for parent. In this case, please define delays in the parent Device Settings or the superior Group Settings.

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:

  • Inherited: Use the settings of the parent object.
  • None: Users in this group cannot see or edit the object. The object does not show up in lists and in the device tree. Exception: If a child object is visible to the user, the object is visible in the device tree, though not accessible.
  • Read: Users in this group can see the object and review its monitoring results.
  • Write: Users in this group can see the object, review its monitoring results, and edit the object's settings. They cannot edit access rights settings.
  • Full: Users in this group can see the object, review its monitoring results, edit the object's settings, and edit access rights settings.

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.

For more details about access rights, please see section User Access Rights.

Define Sensor Channels

The channels of a Sensor Factory sensor are controlled by the Channel Definition text field. Using a special syntax you can refer to other sensor channels, calculate values, and add horizontal lines. You can define factory sensor channels using data from any other sensor's channels on your PRTG core server.

Example

You see a definition of two factory sensor channels, both using the channel() function which simply collects data from the channels of other sensors in your monitoring and displays them:

#1:Local Probe Health
channel(1001,0)
#2:Local Traffic Out[kbit]
channel(1004,1)

The first channel of the factory sensor (#1) collects data from the Health channel (ID 0) of the Core/Probe Health sensor (ID 1001) running on the Local Probe device. The second channel (#2) collects data from the Traffic out channel (ID 1) of a traffic sensor (ID 1004) measuring the system's local network card. Both channels will be shown together in the factory sensor's data tables and graphs.

The basic syntax for a sensor factory channel definition looks like this:

#<id>:<name>[<unit>]
<formula>

For each channel one section is used. A section begins with the # sign. Function names in formulas are not case sensitive.

The parameters are:

  • <id> is the ID of the factory sensor's channel and must be a unique number > 0.
  • <name> is the name of the factory sensor's channel (displayed in graphs and tables).
  • [<unit>] is an optional unit description for the factory sensor's channel (e.g. bytes). If it is not provided a fitting unit string is selected automatically (recommended).
  • <formula> contains the formula to calculate the factory sensor's channel. For the formula, you can use the following functions: channel(), min(), max(), avg(), or percent().
     

Define Sensor Channels—Formula Calculations

Within a formula the following elements are allowed to perform calculations with the values that are returned by one or more functions:

  • Basic operations: + (add), - (substract), * (multiply), / (divide)
    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 10,000; if false the value is 0. For delta sensors the speed is compared.
     

Example

You see a Sensor Factory channel definition with calculation.

#1:Traffic Total x Minus Traffic Out y
( channel(2001,-1) - channel(1004,1) ) * 2

This full channel definition will result in a factory sensor showing a calculation with values from two channels (channel IDs -1 and 1) of two traffic sensors (sensor IDs 2001 and 1004). The returned values will be subtracted and then multiplied by two.

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. Note: When performing percentage calculation, please use the percent() Function to make sure you obtain the expected values!

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.
     

Define Sensor Channels—channel() Function

The channel() function allows to read the data from a channel of a different sensor. The syntax is:

channel(<sensorId>,<channelId>)

 

The parameters are:

  • <sensorId> is the ID of the sensor. It is displayed on the sensor details page, in the Overview tab behind the sensor name.
  • <channelId> is the ID of the sensor channel. It is displayed on the sensor details page, in the Channels tab for each channel behind the channel name.

Example
 

channel(2001,2)

This function reads the data from channel ID 2 of the sensor with the ID 2001.
 

#1:Sample
channel(2001,2)

This full channel definition reads the data from channel ID 2 of the sensor with the ID 2001 and displays it in the first factory sensor channel (#1), without any additional calculations.

Define Sensor Channels—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.

Examples
 

min(10,5)

This function in the first line returns 5, as this is the smaller value out of 10 and 5.
 

min( channel(2001,1),channel(2002,1) )

This function returns the minimum of channel 1 of the sensor with ID 2001 and channel 1 of the sensor with ID 2002.

Define Sensor Channels—avg() Function

The avg() function returns the average of the two values. This equals: (a+b) / 2. The syntax is:

avg(<a>,<b>)

Values for <a> and <b> are either numbers or channel() functions.

Examples
 

avg(20,10)

This function returns 15: (20+10) / 2 = 15.
 

avg( channel(2001,1),channel(2002,1) )

This function returns the average of channel 1 of the sensor with ID 2001 and channel 1 of the sensor with ID 2002.

Define Sensor Channels—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>])

 

The parameters are:

  • <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 an optional 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) or delta (e.g. traffic sensors). If no unit is provided 1 will be used. Note: As unit string % will be added automatically.

PRTG will calculate: <source> / <maximum> * <unit> * 100

Examples
 

#1:Usage Traffic In
percent(channel(2001,0),100,kilobit)
#2:Usage Traffic Out
percent(channel(2001,1),100,kilobit)

This full channel definition will result in a factory sensor showing two channels of a traffic sensor (sensor ID 2001): Traffic in (channel ID 0) and traffic out (channel ID 1). The values will be displayed as % of maximum bandwidth (100 kilobit/second).
 

#1:Ping %
percent(channel(2002,0),200)

This full channel definition will result in a factory sensor showing the Ping Time channel (channel ID 0) of a Ping sensor (sensor ID 2002). The values will be displayed as a percentage of 200 ms.

Define Sensor Channels—Horizontal Lines

You can add lines to the graph using a formula without channel() function. Use a fixed value instead. The syntax is:

#<id>:<name>[<unit>]
<value>

 

The parameters are:

  • <id> is the ID of the factory sensor's channel and must be a unique number > 1. Although a horizontal line will not be shown as a channel, the ID has to be unique.
  • <name> is the name of the factory sensor's channel. When used here it will not be displayed in graphs and tables, but can be used as a comment to describe the nature of the line.
  • [<unit>] is an optional unit description (e.g. kbit/s). If it is not provided the line is applied automatically to the scale of the first factory sensor channel. If your factory sensor uses different units you should provide a unit to make sure the line is added for the right scale. Please enter the unit exactly as shown in your graphs' legend. If you enter a unit that does not yet exist in your graph, a new scale will be added automatically.
  • <value> contains a number defining where the line will be shown in the graph.
     

Examples
 

#5:Line at 100ms [ms]
100

This channel definition will result in graph showing a horizontal line at the value of 100 on the ms scale.
 

#6:Line at 2 Mbit/s [kbit/s]
2000

This channel definition will result in graph showing a horizontal line at the value of 2000 on the kbit/s scale.
 

#1:Ping Time
channel(2002,0)
#2:Line at 120ms [ms]
120

This full channel definition will result in a factory sensor showing the Ping Time channel (channel ID 0) of a Ping sensor (sensor ID 2002). Additionally, the sensor's graphs will show a horizontal line at 120 ms.

Define Sensor Channels—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
     

Define Sensor Status—status() Function

The status of a Sensor Factory sensor can be controlled by the Status Definition text field, if the custom formula option is enabled in the Sensor Settings. Using a special syntax you can define when the factory sensor will change to a Down status. In all other cases the sensor will be in an Up status. The syntax is:

status(sensorID) <boolean> status(sensorID)

 

The parameters are:

  • <sensorId> is the ID of the sensor you want to check the status of. The ID is displayed on the sensor details page, in the Overview tab behind the sensor name.
  • <boolean> is one of the Boolean operators AND, OR, or NOT. If the resulting expression is true, the factory sensor will change to a Down status.

Examples
 

status(2031) AND status(2044)

This will change the factory sensor to a Down status if both sensors, with IDs 2031 and 2044, are Down. Otherwise the factory sensor will show an Up status.
 

status(2031) OR status(2044)

This will change the factory sensor to a Down status if at least one of the sensors with ID 2031 or ID 2044 is Down. Otherwise the factory sensor will show an Up status.
 

status(2031) NOT status(2044)

This will change the factory sensor to a Down status if the sensor with ID 2031 is Down, but the sensor with ID 2044 is not in a Down status. Otherwise the factory sensor will show an Upstatus.

( status(2031) AND status(2044) ) OR status(2051)

This will change the factory sensor to a Down status if both the sensor with ID 2031 and the sensor with ID 2044 is Down, or if the sensor with ID 2051 is Down. Otherwise the factory sensor will show an Up status.

Additionally, the following elements are allowed to perform calculations and comparisons with the values that are returned by the status functions:

  • Basic operations: + (add), - (substract), * (multiply), / (divide)
    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 10,000; if false the value is 0. For delta sensors the speed is compared.
     

Internally, the status() function returns the downtime channel of the sensor in hundreds of percent (10,000 = 100%).

  • true corresponds to a value of 10,000 which is a Down status.
  • false corresponds to a value of 0 which is an Up status.

Understanding this, more complex formulas are possible.

Example
 

( status(1031) + status(1032) + status(1033) + status(1034) ) >= 20000

This will change the factory sensor to a Down status if at least any two of the sensors with IDs 1031, 1032, 1033, or 1034 are Down. Otherwise the factory sensor will show an Up status.

Note: The status() function may also be used in channel definitions. Using this functionality, it is for example possible to display the numeric status value of sensors in a factory sensor channel.

Using Factory Sensors in a Cluster Setup

If you're running PRTG in Clustering mode, please note these additional facts:

  • If you add a Sensor Factory sensor underneath the Cluster Probe, and in the Sensor Factory formula, you refer to a channel of a sensor running on the Cluster Probe as well, the Sensor Factory sensor will show the data of all cluster nodes for this sensor channel.
  • If you add a Sensor Factory sensor underneath the Local Probe, and in the Sensor Factory formula, you refer to a channel of a sensor running on the Cluster Probe, the Sensor Factory sensor will only show data of the primary master node for this sensor channel.

Edit Sensor Channels

In order to change display settings, spike filter, and limits, please switch to the sensor's Overview tab and click on the gear icon of a specific channel. For detailed information, please see Sensor Channels Settings section.

Notifications

Click on the Notifications tab to change notification triggers. For detailed information, please see Sensor Notifications Settings section.

Others

For more general information about settings, please see Object Settings section.

Sensor Settings Overview

For information about sensor settings, please see the following sections:

Continue

Keywords: