Hello,
i need to monitor a mailbox via IMAP and trigger notifications whenever a new mail comes in. So i added a IMAP Sensor and its working fine monitoring the amount of new mails in the inbox.
But i only get a notification once. When the value increases i dont get a notification anymore because the system triggered a notification before. I tried to use a threshold trigger whenever amount of mails in inbox is above 0. Also i changed the upper threshold for errors in the channel and set a state trigger whenever sensor is in a error state.
So what i want is a notification everytime the value increases.
Kind regards
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
If the emails usually come with the same subject you can create filters in the sensor so that a message with that subject sets the sensor as down and then create a state trigger to alert for each message that comes. You can check the filter settings in the IMAP sensor manual
Nov, 2021 - Permalink
Hello Jonathan,
unfortunately when the imap sensor goes down-state, it stays in down state and triggers a notification once. Or the nearest to get is to consider only include recent emails younger than 1 hour. So the Sensor would be OK again after 1 hour if no new email for the configured filter is received. I need to be informed for every email received separately.
So how i solved it was following: 1. Set IMAP Sensor to "Count Emails" and "Save Sensor Output" as a file. 2. New EXE-Sensor / Powershell:
####################
param(
$sensorids="1234,5678"
)
$sensorids=$sensorids -split ','
[int]$totalamount_Mails=0
[string]$totalamountMailsString
foreach ($sensorid in $sensorids) {
$filepath="C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors\Result of Sensor $($sensorid).txt"
$filecontent=Get-Content $filepath
$amountMailsString=$filecontent -match "Mails in mailbox: "
$amountMailsInteger=$amountMailsString -replace "[^0-9]"
$totalamount_Mails+=$($amountMailsInteger)
}
[string]$outputcode=":OK"
Write-Output "$totalamount_Mails$outputcode"
#####################
3. Set Parameters of Exe-Sensor: "-sensorids 1234,5678" and set "Change Trigger"
Now with this workaround i have a change trigger for every prtg-sensor which has no change trigger. This solved my problem.
Dec, 2021 - Permalink
Perhaps instead of using a State trigger you can use a change trigger, this would notify when there is a change. If you dont see this option you can contact us directly so we can check better with some screenshots. At support@paessler.com
Nov, 2021 - Permalink