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

Interrupt driven PIR motion sensor with a Raspberry Pi

Votes:

1

Dear all,

I would like to hear your opinion on this. I am currently monitoring the temperature and humidity of a room with a DHT22 and a Raspberry-Pi, and I would like to set up a PIR motion sensor and monitor the presence/absence of people in the room.

Now, while I am currently monitoring the temperature on a polling basis, with an interval of 5 minutes, I don't think it is a good idea to do that with the motion sensor. In my opinion, the motion sensor should be interrupt driven, not poll driven. Why? If I poll the Raspberry Pi from time to time, I may never see the PRTG go "Warning, there's someone in your room", unless I have a very short polling shedule (say every 5 or 10 seconds). However, a short schedule like that puts strain on my PRTG probe and network.

However, if I use an interrupt driven approach, any time the interrupt event on the Raspberry Pi detects a change in the PIR sensor's pin, and it alerts the PRTG Probe. It doesn't put any strain on the Rasp-pi, nor the network. It's a very CPU consuming sensor for the PRTG probe, though.

How should I implement this interrupt approach? Should I use Syslog, SNMP Trap? Can I use that? Can I create a custom OID and message?

Or is there any other way of transmitting these messages? Is there any other way you would do this?

interrupts motion-sensor pir-sensor raspberry-pi snmp

Created on Oct 31, 2017 11:33:45 AM



1 Reply

Votes:

0

Hello André,
we appreciate your inquiry.

You have a very valid point. Polling the device very frequently to "cover all data-points" is not the best solution.

For the PIR sensor I encourage you to work with the HTTP Push Data Advanced sensor. This sensor works differently from most sensors in PRTG: In this sensor, the probe starts a socket (webserver if you want to call it like that) and your "sensor" (script, application, ..) will contact PRTG when it has 'something to say' (i.e. when motion is detected).

I'm not sure how you're currently polling the measurements from the DHT22 using PRTG, but for the "complete" solution in this case I would use:

  • 1x HTTP Data Advanced or SNMP Custom Table/Custom Advanced, polling the device every x minutes to check the values for Temperature and Humidity from the DHT22.
  • 1x HTTP Push Data Advanced, used for the monitored device to report motion (and the lack of motion after XX seconds or minutes, since the sensor will "store" the latest value until a new value arrives.

The advantage of working with these two sensors (HTTP Data Advanced and HTTP Push Data Advanced) is that the format for both the "push" messages send by your application/script and the format for the temperature/humidity readings is exactly the same. The expected format is documented on the URL below or in PRTG under Setup > PRTG API on the Custom Sensors tab.

The manual page for the HTTP Push Data Advanced sensor also contains plenty of information about the set-up/usage.


Best Regards,
Luciano Lingnau [Paessler Support]

Created on Oct 31, 2017 7:17:34 PM by  Luciano Lingnau [Paessler]




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.