New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Can you help me understand when the Sensor Factory sensor changes to a down status and why?

Votes:

0

Your Vote:

Up

Down

I use the status() function with Boolean operators to control the status of my Sensor Factory sensor. Can you help me understand when the Sensor Factory sensor changes to a down status and why?

boolean factory-sensor formelsensor formula operator prtg sensor status

Created on May 14, 2018 1:33:32 PM by  Martina Wittmann [Paessler Support]

Last change on Aug 29, 2019 8:57:52 AM by  Martina Wittmann [Paessler Support]



1 Reply

Accepted Answer

Votes:

2

Your Vote:

Up

Down

This article applies to PRTG Network Monitor 19 and later

TRUE and FALSE in the Sensor Factory status() Function

With the help of the Sensor Factory sensor, you can build your very own custom sensor that determines its status by using the states of any source sensor(s) in your network (except other Sensor Factory sensors).

To define your custom Sensor Factory channels, use one of the numerous channel functions that PRTG offers.

To define when you want your Sensor Factory sensor to show a down or an up status, and, consequently, when notifications are triggered, use the status() function.

To set your status definitions for the Sensor Factory sensor, follow these steps:

  1. Open the Settings of your Sensor Factory sensor.
  2. In the Error Handling section, select Use Custom Formula.
  3. In the Status Definition field, enter the status() function according to your needs.

Note: When using the sensor status() function, you can decide on the up and down status, but not on the warning status. The warning status in not available by design.

A Note on Down Condition and Up Condition in PRTG

Sensors in PRTG can have different states that are displayed with different colors, like up (green), warning (yellow), and down (red). (See all PRTG sensor states in the PRTG User Manual.)

PRTG Sensor States

Because highly flexible do-it-yourself sensors like the Sensor Factory sensor or the Business Process sensor refer to other sensors, there needs to be a basis for the calculation of the overall sensor status.

Therefore, the sensor states of the source sensors have to be resolved to an up or down condition first. This happens on a kind of meta level that consolidates all possible sensor states to either up or down.

Example:

sensor statesconditiontruthSensor Factory status
up, warning, unusualresolve toupFALSEup
down, down (acknowledged), pausedresolve todownTRUEdown

The overall up or down condition of a sensor that summarizes other sensor states is then resolved to an overall sensor status to be displayed with different colors in the PRTG user interfaces, following the sensor logic.

Find all PRTG Sensor States and Conditions in the PRTG User Manual.

The status() Function of the Sensor Factory Sensor

This section guides you through the Boolean logic behind the status() function and provides some examples.

How TRUE and FALSE correlate to DOWN and UP

The status() function checks if conditions are met to set the Sensor Factory sensor to down.

If the status() function of the Sensor Factory sensor resolves to TRUE, the Sensor Factory sensor shows a down status. If the status() function resolves to FALSE, the Sensor Factory sensor shows an up status.

If you have only one sensor as source in your Sensor Factory sensor and if this source sensor is in a down status, the Sensor Factory sensor will be in a down status, too. Because the down condition is TRUE. Likewise, a single sensor in up condition corresponds to FALSE and the Sensor Factory sensor will show an up status.

Of course, you will most probably want to use the advantage of the formulas of the Sensor Factory sensor and combine several source sensors.

Boolean Operators in the status() Function

If you have more sensors as source sensors for the Sensor Factory sensor and so more arguments for the status() function, PRTG needs to calculate the overall status result for the down or up status.

The overall result of the status() function depends on the logical operators that you use. The arguments are your source sensors. These are the Boolean operators you can use:

  • AND (conjunction)
  • OR (disjunction)
  • NOT (negation)

Truth table for AND considering 2 arguments:

Arguments combined with ANDResult
TRUE AND TRUETRUE
TRUE AND FALSEFALSE
FALSE AND TRUEFALSE
FALSE AND FALSEFALSE

Truth table for OR considering 2 arguments:

Arguments combined with ORResult
TRUE OR TRUETRUE
TRUE OR FALSETRUE
FALSE OR TRUETRUE
FALSE OR FALSEFALSE

Truth table for NOT:

Arguments combined with NOTResult
NOT TRUEFALSE
NOT FALSETRUE

There are two possibilities to use NOT:

  • Use AND NOT or OR NOT to combine a NOT-expression with other status() functions, for example status(1) AND NOT status(2)
  • Use NOT as a prefix, for example NOT status(1) OR status(2)

In any case, when calculating the overall status, resolve the NOT part first. For example:

true AND NOT true = true AND (NOT true) = true AND false = false

Illustration

To illustrate how the status() function works, we will use the values of a humidity sensor and a temperature sensor combined as source sensors in a Sensor Factory sensor that monitors, for example, the environment of your server room.

These are the source sensors:

Two Source Sensors Monitoring Temperature and Humidity

This is the Sensor Factory sensor:

An Example Sensor Factory Sensor

This is its channel definition:

The Channel Definition of the Example Sensor Factory Sensor

Basic Examples

1. “I want the Sensor Factory sensor to show a DOWN status only if ALL source sensors are in a DOWN status.”

To achieve this, you could use the following status() function:

status(sensorID1) AND status(sensorID2)

Example 1: source sensors
Both source sensors are in a down status

Example 1: status() function with 2 arguments combined with AND

Sensor“Temperature” (source)“Humidity” (source)“Server Room Environment” (Sensor Factory)
Statusdowndowndown
Conditiondowndowndown
TruthTRUETRUETRUE

Example 1: Sensor Factory sensor
The Sensor Factory sensor is in a down status when both source sensors are in a down status

2. “I want the Sensor Factory sensor to show an UP status if at least ONE source sensor is in an UP status”.

To achieve this, you could use the following status() function:

status(sensorID1) AND status(sensorID2)

Example 2: source sensors
At least one source sensor is in an up status

Example 2: status() function with 2 arguments combined with AND

Sensor“Temperature” (source)“Humidity” (source)“Server Room Environment” (Sensor Factory)
Statusdownwarningup
Conditiondownupup
TruthTRUEFALSEFALSE

Example 2: Sensor Factory sensor
The Sensor Factory sensor is in an up status if at least one sensor is in an up status

3. “I want the Sensor Factory sensor to show a DOWN status only if ALL source sensors are in an UP status.”

To achieve this, you could use the following status() function: NOT status(sensorID1) AND NOT status(sensorID2)

Example 3: source sensors
Both source sensors are in an up status

Example 3: status() function with 2 negated arguments combined with AND

Sensor“Temperature” (source)“Humidity” (source)“Server Room Environment” (Sensor Factory)
Statusupupdown
Conditionupupdown
TruthTRUE (NOTFALSE)TRUE (NOT FALSE)TRUE

Example 3: Sensor Factory sensor
The Sensor Factory sensor is in a down status although both source sensors are in an up status

With this Boolean syntax you can change your Sensor Factory sensor to a down status even if all source sensors are in an up status. Whether this behavior is desirable for you or not depends on what you monitor and how you define up and down. For example, you might have two servers and you define the write access as up. You want only one of your servers to have write access. With the status() function in example 3, PRTG will alarm you when both servers get write access.

Combine Boolean Operators

You can further customize the status calculation of your Sensor Factory sensor by combining different Boolean operators in one status() function.

Use brackets to group your calculation steps. For example:

status(sensorID1) OR (status(sensorID2) AND status(sensorID3))

Before actually setting up this kind of monitoring, have your Boolean matrix ready first ;-)


Wrap Up

The Sensor Factory sensor status() function follows the Boolean logic, that is, it operates with the conditions TRUE and FALSE.

The down condition of a source sensor corresponds to TRUE. The up condition of a source sensor corresponds to FALSE.

You can combine more arguments with the Boolean operators AND, OR, and/or NOT.

The overall status of the Sensor Factory sensor is calculated depending on the conditions of your source sensors and on the Boolean operators that you use.


What’s More

Don’t forget to set the notifications, so PRTG alarms you when you need to be alarmed!

See Also

Created on May 14, 2018 5:26:33 PM by  Martina Wittmann [Paessler Support]

Last change on Sep 2, 2019 9:16:21 AM by  Martina Wittmann [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.