Get Director vhostCount

William Edwards wedwards at cyberfusion.nl
Wed Aug 11 11:41:23 EEST 2021


Hi,

William Edwards schreef op 2021-07-24 18:11:
> Hi,
> 
> I would like to monitor each mail server's amount of available vhosts,
> so I can take action when a certain threshold is reached (e.g. adding
> mail servers). I'm using Dovecot 2.3.4.1 with Director.
> 
> My first idea was to use the Doveadm HTTP API, but the
> 'directorStatus' command doesn't return the 'vhostCount' attribute
> (although the 'directorAdd' and 'directorUpdate' commands take it as
> input).
> 
> My second idea was to directly connect to the 'director-admin' socket
> and look at the output of 'HOST-LIST'. I can find all the information
> I need in doveadm-connection.c, but I'm not getting the impression
> that we're meant to interact with the socket directly. I can't find
> protocol documentation, and the error message "doveadm not compatible
> with this server (mixed old and new binaries?)" when passing faulty
> input gives me the impression that the socket is only meant to be used
> by Dovecot directly.
> 
> My third idea is to parse 'doveadm director status', but in that case
> I'd like to know if that output is likely to change in the future. New
> major versions aside, of course.

I cooked up the attached Nagios-compatible Python script that parses 
'doveadm director status'. If anyone wants to use it, just replace 
CyberfusionCommand with a subprocess call.

> 
> Or, if anyone else has a better idea, which could very well be the
> case, I'd love to hear how people monitor this in the real world.
> 
> TIA.

-- 
With kind regards,

William Edwards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_dovecot_director_users.py
Type: text/x-python
Size: 3331 bytes
Desc: not available
URL: <https://dovecot.org/pipermail/dovecot/attachments/20210811/c5d1a007/attachment-0001.py>


More information about the dovecot mailing list