PRTG Happiness Sensor
Originally published on August 15, 2018 by Jakob Leurs
Last updated on February 10, 2020 • 4 minute read
You have an event, a workshop, other internal training, or anything where the mood of the participants can take different directions - and you want to get fast, honest and digital feedback? Here we show you how you can quickly check the happiness factor in the room with a dash button and PRTG.
There are some components we need to set up the “Happiness Sensor”. The most important component is of course the AWS IoT Button.
With the button, we can emit a signal and connect it with AWS. Within AWS, we can catch the signal via AWS Lambda in which we can define a function that will be executed when the button is pressed. The easiest solution for this use case was DynamoDB. The DynamoDB is also created within the AWS. The database can be used to iterate the button presses, so we have two buttons: one for happy and one for sad. When we press one of the buttons, the value for happy or sad is iterated and reflects the corresponding count in the DynamoDB.
Now we can press the buttons, we have a database that increments the button presses, but we still need a way to grab the data externally. For this we use the API Gateway functionality of AWS. In the API Gateway we can establish a connection to the DynamoDB to provide the data, i.e. the count for happy and sad, as JSON. So now we can press the button, increment the values in the database, and provide the values via JSON request. The last part of the puzzle is to present the data in a neat way and nothing is better suited for that than PRTG! So, in the last step, we create a REST CustomSensor and call the API Gateway with the provided request. After the sensors have been set up, we can create a map and show the different values.
In a more advanced approach, we implemented the logic to have a count entry in DynamoDB for , so we can also count the happies and sads for the current week and the current month. In addition, we added the date into DynamoDB for when the button was first pressed in order to be able to reset the values. So when the initial date for pressing the button was more than seven days ago, the corresponding count for the week is set to zero and the date is updated to the current date. That is how we can ensure consistency.
This is how a map could look:
So that's it. Easy Peasy. Looks nice, doesn't it?
If you have any further questions about the technical implementation in PRTG, please let us know.