What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

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

Votes:

0

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 the 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 Sep 21, 2022 11:20:18 AM by  Jacqueline Conforti [Paessler Support]



1 Reply

Accepted Answer

Votes:

2

This article applies as of PRTG 22

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 the down or 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 Status 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 is 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 the 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 Up and Down Conditions in the PRTG 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 resolves to TRUE, the sensor shows the down status. If the status() function resolves to FALSE, the sensor shows the up status.

If you have only one sensor as source in your Sensor Factory sensor and if this source sensor is in the down status, the Sensor Factory sensor is in the down status, too. Because the down condition is TRUE. Likewise, a single sensor in up condition corresponds to FALSE and the Sensor Factory sensor shows the 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 the DOWN status only if ALL source sensors are in the 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 the 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 the down status when both source sensors are in the down status

2. “I want the Sensor Factory sensor to show the UP status if at least ONE source sensor is in the 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 the 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 the up status

3. “I want the Sensor Factory sensor to show the DOWN status only if ALL source sensors are in the 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 the 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 the down status although both source sensors are in the up status

With this boolean syntax you can change your Sensor Factory sensor to the down status even if all source sensors are in the 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 alarms 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.

Other

Do not forget to set the notifications, so PRTG alarms you when you need to be alarmed.

More

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

Last change on Dec 29, 2022 1:21:06 PM by  Brandy Greger [Paessler Support]




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.