Sunday, August 2, 2015

Sensor Factory dalam PRTG

Seringkali kita ingin membuat Sensor sendiri dalam PRTG, dengan channel berdasarkan data dari sensor lain. Hal ini bisa digunakan untuk monitoring Proses Bisnis (Business Process) yang berhubungan dengan sensor lain.

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.
Which channels the sensor actually shows might depend on the monitored device and the sensor setup.
 
Sensor Factory SensorSensor Factory Sensor

Remarks

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 details page of a sensor, click on the Settings tab to change its settings.
Note: Usually, a sensor connects to the IP Address or DNS Name of the parent device on which you created this sensor. See the Device Settings for details. For some sensor types, you can define the monitoring target explicitly in the sensor settings. Please see below for details on available settings.
BASIC SENSOR SETTINGS
Sensor Name
Enter a meaningful name to identify the sensor. By default, PRTG shows this name in the device tree, as well as in alarmslogsnotificationsreportsmapslibraries, and tickets.
Parent Tags
Shows Tags that this sensor inherits from its parent device, group, and probe. This setting is shown for your information only and cannot be changed here.
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 that you use 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. These are visible above as Parent Tags.
Priority
Select a priority for the sensor. This setting determines where the sensor is placed in sensor lists. Top priority is at the top of a list. 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 behavior of the sensor if one of the sensors defined above is in an error status. In this case, you can set the sensor factory sensor either to down 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 that you use in a channel definition is in a Down status, the Factory sensor shows 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.
    Note: If a lookup definition or an error limit triggers the error status of the source sensor, the Sensor Factory will not show a Down status. This is because the Sensor Factory should only show this status if it cannot calculate values.
  • Factory sensor shows warning status when one or more source sensors are in error status : If at least one sensor that you use in a channel definition is in a Down status, the factory sensor shows a Warning status until all referred sensors leave the Down status.
    Note: If a lookup definition or an error limit triggers the error status of the source sensor, the Sensor Factory will not show a Warning status. This is because the Sensor Factory should only show this status if it cannot calculate values.
  • 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 you enable custom formula above. Define when the sensor will switch to aDown 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 reacts if 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 defined channels that use one or more sensor(s) that deliver no data, no data is shown. Additionally, the factory sensor shows aWarning status.
  • Calculate the factory channels and use zero as source value : If a sensor that you use in a channel definition does not deliver any data, zero values will be filled in instead. The sensor factory calculates the channel value and shows it using these zero values.
SENSOR DISPLAY
Primary Channel
Select a channel from the list to define it as the primary channel. In the device tree, the last value of the primary channel will always be displayed below the sensor's name. The available options depend on what channels are available for this sensor. Note: You can set another primary channel later by clicking on the pin symbol of a channel in the sensor's Overview tab.
Chart Type
Define how different channels will be shown for this sensor.
  • Show channels independently (default) : Show an own graph for each channel.
  • Stack channels on top of each other : Stack channels on top of each other to create a multi-channel graph. This will generate an easy-to-read graph which visualizes the different components of your total traffic. Note: This option cannot be used in combination with manualVertical Axis Scaling (available in the Sensor Channels Settings settings).
Stack Unit
This setting is only available if stacked graphs are selected above. Choose a unit from the list. All channels with this unit will be stacked on top of each other. By default, you cannot exclude single channels from stacking, if they use the selected unit. However, there is an advanced procedure to do so.

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 only for this object, disable inheritance by clicking on the check mark before the corresponding setting name. You will then see the options described below.
SCANNING INTERVAL
Scanning Interval
Select a scanning interval (seconds, minutes, or hours) from the list. The scanning interval determines the time the sensor waits between two scans. You can change the available intervals in the system administration.
When a Sensor Reports an Error
Define the number of scanning intervals that a sensor has time to report an error before the sensor will be set to a Down status. The sensor can try to reach a device several times, depending on the setup you can specify here, to help avoid false alarms if the monitored device has only temporary issues. For previous scanning intervals with failed requests, the sensor will show a Warning status. Choose between:
  • Set sensor to "down" immediately : The sensor will show an error immediately after the first failed request.
  • Set sensor to "warning" for 1 interval, then set to "down" (recommended) : After the first failed request, the sensor will show a yellow warning status. If the following request also fails, the sensor will show an error.
  • Set sensor to "warning" for 2 intervals, then set to "down" : Show an error status only after three continuously failed requests.
  • Set sensor to "warning" for 3 intervals, then set to "down" : Show an error status only after four continuously failed requests.
  • Set sensor to "warning" for 4 intervals, then set to "down" : Show an error status only after five continuously failed requests.
  • Set sensor to "warning" for 5 intervals, then set to "down" : Show an error status only after six continuously failed requests.
Note: Sensors that monitor via Windows Management Instrumentation (WMI) always wait at least one scanning interval until they show an error. It is not possible to set a WMI sensor "down" immediately, so the first option will not apply to these sensor types (all other options can apply).
Note: If a sensor has defined error limits for channels, this sensor will always be set to a Down status immediately, so no "wait" option will apply.
Note: If a channel uses lookup values, the sensor will always be set to a Down status immediately, so no "wait" options will apply.
SCHEDULES, DEPENDENCIES, AND MAINTENANCE WINDOW
Note: Inheritance for schedules, dependencies, and maintenance windows cannot be interrupted. The corresponding settings from the parent objects will always be active. However, you can define additional settings here. They will be active at the same time as 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 at the same time.
Maintenance Window
Specify if you want to set-up a one-time maintenance window. During a "maintenance window" period, this object and all child objects will not be monitored. They will be in a paused state instead. Choose between:
  • Not set (monitor continuously) : No maintenance window will be set and monitoring will always be active.
  • Set up a one-time maintenance window : Pause monitoring within a maintenance window. You can define a time span for a monitoring pause below and change it even for a currently running maintenance window.
Note: To terminate a current maintenance window before the defined end date, you can change the time in Maintenance End At field to a date in the past.
Maintenance Begins At
This field is only visible if you enabled the maintenance window 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 you enabled the maintenance window 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, where it is created on, is in a Down status, or if the sensor is paused by another dependency.
  • Select object : Pause the current sensor if the device, where it is created on, is in an Down status, or if the sensor 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, where 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. You can check all dependencies in your PRTG installation by selecting Devices | Dependencies from the main menu bar.
Dependency
This field is only visible if the Select object option is enabled above. Click on the reading-glasses and use the object selector to choose an object on which the current sensor will depend.
Delay (Seconds)
Define a time span. After the master object for this dependency comes back to an Up status, the beginning of the monitoring of the depending objects will be additionally delayed by the time span you define here. This can help to 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 in 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 types of access rights 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 access rights settings of the parent object.
  • None : Users in this group cannot see or edit the object. The object neither shows up in lists nor 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 on access rights, please see the 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 use 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 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 you do not provide a unit, the sensor factory selects a suitable unit string 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 comparison resolves to true, the value is 10,000 ; if false, the value is . 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 results in a factory sensor that shows a calculation with values from two channels (channel IDs -1 and ) of two traffic sensors (sensor IDs 2001 and 1004 ). The returned values are 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 page header bar.
  • <channelId> is the ID of the sensor channel. It is displayed in the respective field of the channel settings.
Example 
 
channel(2001,2)
This function reads the data from channel ID of the sensor with the ID 2001 .
 
#1:Sample
channel(2001,2)
This full channel definition reads the data from channel ID 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 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 , because this is the smaller value out of 10 and 5.
 
min( channel(2001,1),channel(2002,1) )
This function returns the minimum of the values of channel of the sensor with ID 2001 and channel 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 of the sensor with ID 2001 and channel 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 (seeConstants 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 will be used. Note: The sensor adds the unit string 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 results in a factory sensor that shows two channels of a traffic sensor (sensor ID 2001 ): Traffic in (channel ID ) and traffic out (channel ID ). The sensor displays the values % of maximum bandwidth (100 kilobit/second).
 
#1:Ping %
percent(channel(2002,0),200)
This full channel definition results in a factory sensor that shows the Ping Time channel (channel ID ) of a Ping sensor (sensor ID 2002 ). The sensor displays the values 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 the sensor does not show a horizontal line as a channel, the ID has to be unique.
  • <name> is the name of the factory sensor's channel. PRTG does not display this name in graphs and tables, but you can use it as a comment to describe the nature of the line.
  • [<unit>] is an optional unit description (e.g., kbit/s). If you do not provide a unit, PRTG applies the line automatically to the scale of the first factory sensor channel. If your factory sensor uses different units, provide a unit to make sure the line is added for the right scale. Enter the unit exactly as shown in your graph's 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 results in a graph that shows a horizontal line at the value of 100 on the ms scale.
 
#6:Line at 2 Mbit/s [kbit/s]
2000
This channel definition results in a graph that shows 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 results in a factory sensor that shows the Ping Time channel (channel ID ) of a Ping sensor (sensor ID 2002 ). Additionally, the sensor 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 you enable the custom formula option in the Sensor Settings . Using a special syntax, you can define when the factory sensor changes 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. It is displayed on the sensor details page in the page header bar.
  • <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 changes the factory sensor to a Down status if both sensors, with IDs 2031 and 2044 , are Down . Otherwise the factory sensor shows anUp status.
 
status(2031) OR status(2044)
This changes 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 shows an Up status.
 
status(2031) AND NOT status(2044)
This changes 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 shows an Up status.
  • Note: A status() function with NOT has to be connected with AND or OR if it is combined with other status() functions:
status(sensorID) AND NOT status(sensorID)
status(sensorID) OR NOT status(sensorID)

( status(2031) AND status(2044) ) OR status(2051)
This changes 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 ID2051 is Down . Otherwise the factory sensor shows 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 comparison resolves to true, the value is 10,000 ; if false, the value is . 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.
If you understand this, you are able to use more complex formulas.
Example 
 
( status(1031) + status(1032) + status(1033) + status(1034) ) >= 20000
This changes 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 shows an Up status.
Note: You can also use the status() function in channel definitions. Using this functionality, it is possible, for example, to display the numeric status value of sensors in a factory sensor channel.

Using Factory Sensors in a Cluster Setup

If you run 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 shows 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 only shows data of the primary master node for this sensor channel.
     

More

Knowledge Base: Can I add sensors to Sensor Factory sensors using tags?
Knowledge Base: How can I monitor the overall status of the business process "Email"?

Edit Sensor Channels

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

Notifications

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

Others

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

Sensor Settings Overview

No comments:

Post a Comment

Map Security needs to DevSecOps tools in SDLC.

  Map Security needs to DevSecOps tools in SDLC. Implementing DevSecOps effectively into the SDLC involves adopting the right tools, adaptin...