Hi,
We have an issue with the Exchange Mailbox (PowerShell) sensor.
We are using this sensor to get alerted if a specific Mailbox is holding more than a few E-Mails this indicates that a script is not running correctly (sadly this is happening). But PRTG was a lot of help to get us notified.
A few days ago we changed from our old Exchange Server 2010 to a new Exchange Server 2016, after this change we are getting an item count that is a lot higher than before (like 154 more).
Surely we checked the mailbox and there aren’t 154 E-Mails in it. The sensor seems to function, the count goes up and down but the "Item Count" is a bit messed up. Even when this Mailbox is empty we get the "Item Count" from 154.
I also checked other Mailboxes the "Item Count" was different but the result is similar.
Maybe this sensor needs a small adjustment to get the right values from the exchange Server 2016.
Many thanks in advance.
Article Comments
Hello Stephan,
this mailbox isn't actively used by a real person. Its only purpose is to receive some E-Mails, a scheduled task executes a script that checks the Mails within it, does something with the information and then deletes the mail within this mailbox.
I recreated this Sensor several times, but with the exact same results.
I also took a look at the Logs from the sensor but I can’t see an obvious reason behind the values it displays.
Many thanks in advance.
Feb, 2019 - Permalink
Could you post the log? Then I'll take a look :)
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Hi Stephan,
shortly after the normal post I added the logs with "!NOPUBLISH" like you suggested :). To keep everyone updated as well. Can you see them?
Feb, 2019 - Permalink
Yep, I can see them, and there are indeed no indications of why the amount of mails doesn't match. Just out of curiosity, does this sensor have a Recycled folder or something like that? What does the following command, executed in the Exchange Management Shell, yield:
Get-Mailbox | Get-MailboxFolderStatistics | Where {$_.Name -match “Inbox|Sent Items|Deleted Items|Junk E-Mail”} | FT Identity, Name, ItemsInFolder -Autosize
Note that this will check all mailboxes. When you put
Get-Mailbox -Anr '<SAMaccountName>'
...at the beginning, it should check only for the user's mailbox. That is, if I got the -Anr description correctly :)
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Hi Stephan,
Thank you for your help.
Get-Mailbox -Identity MAILBOXADRESS@COMPANY.DOMAIN | Get-MailboxFolderStatistics | Where {$_.Name -match "Inbox|Sent Items|Deleted Items|Junk E-Mail"} | FT Identity, Name, ItemsInFolder –Autosize
Does not return any results, because we use a German System :). If I adapt the code to that, we get the results we desire…
Identity Name ItemsInFolder COMPANY.DOMAIN/…/MAILBOX\Posteingang Posteingang 18 COMPANY.DOMAIN/…/MAILBOX\Gesendete Elemente Gesendete Elemente 0 COMPANY.DOMAIN/…/MAILBOX\Gelöschte Elemente Gelöschte Elemente 0 COMPANY.DOMAIN/…/MAILBOX\Junk-E-Mail Junk-E-Mail 0
Even when I ask the Mailbox without the filter (to get absolutely everything) i can’t see the 154 that are presented to prtg.
Within a folder named “Deletions” are several items but this count exceeds the 154 by over multiple thousand Items, so this seems to be irrelevant.
The other folders are empty or nearly empty. If I count every Item besides the "Posteinngang" (that we like to monitor with 18 Items) and "Deletions" together I get 8 Items in total.
:) and if you mean the "Deleted Items" folder with "Recycled" folder then yes this Mailbox does have one but it is empty.
Feb, 2019 - Permalink
Thanks for the testing! :) This is getting mysterious. Could you check if your own inbox is being monitored correctly?
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Hi Stephan,
I checked several other mailboxes and sadly no count is correct.
They all differ with other item counts so there is no consistency. So I guess every mailbox gets its own wrong basic item count.
Many thanks in advance.
Feb, 2019 - Permalink
I'll forward this to our Sensor team, maybe they have some additional ideas. Might take a day or two until I hear from them. Thanks for your patience!
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Turns out that we'll need the output of the following two commands, too:
Get-MailboxStatistics Get-MailboxStatistics -StoreMailboxIdentity [MailboxGuid/or LegacyDN]
The parameter "-StoreMailboxIdentity" is explained here. Thanks!
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Hi Stephan,
with this command we got the wrong count! It seems to count some items that are hidden and used by the system only.
So prtg just shows what it gets with this command, but how can we get the count right?
In our case and I guess in general it would be nice to get a reliable count of items that are "really" present in the Mailbox.
Get-MailboxStatistics -Database "DATABASENAME" -Filter 'DisplayName -eq "MAILBOXNAME" | Select DisplayName, ItemCount, DeletedItemCount, AssociatedItemCount,TotalItemSize | Sort-Object TotalItemSize -Descending
DisplayName : MAILBOXNAME ItemCount : 159 DeletedItemCount : 12044 AssociatedItemCount : 88 TotalItemSize : 1.192 MB (1,249,913 bytes)
Many thanks in advance.
Feb, 2019 - Permalink
This should only be the case for Exchange Online, at least according to this document. But you're using Exchange on premises, right?
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Hi Stephan,
i have read this article. And yes you are correct we are using Exchange on premises and not Exchange Online.
I can't get why the counts are different from each other...
Many thanks in advance.
Feb, 2019 - Permalink
It would be interesting to know if these can actually be filtered within the PowerShell command we're using...I'll check back with our Exchange Administrator regarding this :)
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
He hasn't heard of that either, but hasn't kept an eye on it as well during his reporting exports :( I'll open up a bug ticket regarding this to see if we can use any other approach for this sensor.
Thanks for reporting it!
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Been following this a while now, I can't replicate it right now, but why don't you just create a script-sensor and use this command:
Get-MailboxFolderStatistics
The folder might be called INBOX but could be also language specific...
What you want is a simple item-count in the INBOX if I understand you right...
Regards
Florian
Feb, 2019 - Permalink
It's the sensor that should actually show the elements in the inbox and ignore everything MS puts into it for administrative purposes :) As of now, due to that, the counter shows incorrect information (compared to manually checking the inbox) and that might cause confusion :)
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
Hi Jacqueline
Well, the sensor is using the IMAP protocol, which should still apply to 2016 :) I suspect something else to be off here. Are those mailboxes actively used by anybody? Or are they just there for checking purposes?
When recreating the Sensor in question, do you get the same results? Could you enable the
Write Result to Disk option in the Sensor settings and provide me with the log? It resides in the following directory:
C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)
...and should have the Sensor ID within it's filename. Please post the log content here and make sure to add !NOPUBLISH to it to avoid accidental publishing of confidential data.
PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink