Resolving Imapsync issues with Zimbra shared folders

While migrating mailboxes away from a Zimbra server using imapsync, I ran into several accounts which consistently failed with errors like:

Host1 folder 45/55 [INBOX/Some_Folder] Host1 Folder INBOX/Some_Folder: Could not select: * BYE zcs1.brewerscience.com Zimbra IMAP4rev1 server closing connection (4x)

I found the following in the Zimbra log around the same time:

2017-05-06 18:15:34,903 WARN [ImapServer-13] [name=username@domain.com;mid=285; ip=192.168.253.100;oip=10.0.50.6;via=192.168.253.100 (nginx/1.2.0-zimbra);ua=Zimbra/8.6.0_GA_1200;] imap – target account missing or not active; dropping connection

The accounts were active and otherwise appeared to be working properly. A Google search revealed nothing. The issue turned out to be that these users had mail folders shared to them from other accounts, and those accounts were either closed or had revoked the share. I had excluded these folders since they were shared and I didn’t want to copy them, but imapsync apparently still tried to access them. This issue seemed to happen the first time imapsync tried to access a revoked/closed shared folder and to every request that followed, even for normal folders.

The solution is to remove the shared folders from the account, after which imapsync works properly. You can do this by clicking on the folder name. Zimbra will prompt you to remove the folder.

Monitoring Windows Mount Points with Nagios

I needed to monitor some volumes on some Windows Server 2016 machines with Nagios, including some volumes with mount points rather than drive letters.  The Check WMI Plus plugin got me close, but it was only able to natively monitor drives with letters assigned.   Luckily, Check WMI Plus allows for custom checks using ini files, so I set up a custom ini file in /etc/check_wmi_plus/check_wmi_plus.d:

[myStorage diskUsed]
# this help is displayed only when -m MODE or -m MODE -s SUBMODE are specified AND --inihelp is used on the command line
inihelp=<<EOT
Get disk percentage used.  arg1 is path to the mount point.   Example: C:   or  E:\DB\DB1\
EOT
 
query=Select Name,Capacity,FreeSpace from Win32_Volume where name = "{_arg1}"
 
# Calculate percent full
customfield=PercentFree,percent,FreeSpace,Capacity,%.1f,
customfield=PercentUsed,basicmaths,100,-,PercentFree,%.1f,
 
# allow warning/critical for PercentFull
test=PercentUsed
 
display=_DisplayMsg||~|~| - ||
display=PercentUsed

My nagios check looks like this:

define service{
    use                         snmp-disk-service
    host_name                   exchange3
    service_description         disk used EX3-JDB-01
    contact_groups              exchange-admins
    check_command               check_wmi_disk!C:\\\\Mount Point\\\\!90!95
}

The slashes in the path needs to be escaped twice because (I assume) the string is being interpreted by the check_wmi_plus.pl script and the wmic utility.

The check_wmi_disk definition is:

# Check disk used using WMI
# Arguments are: Mount point, warning percentage, critical percentage
#
define command {
	command_name	check_wmi_disk
	command_line	/usr/bin/perl $USER1$/wmi/check_wmi_plus.pl -H $HOSTADDRESS$ -u [Domain]/[Service Account Username] -p [Service Account Password] --IgnoreMyOutDatedPerlModuleVersions -m myStorage -s diskUsed -a '$ARG1$' -w $ARG2 -c $ARG3$
}