Documentation
¶
Overview ¶
Package queue parses `postqueue -j` output and summarises the Postfix queue, including a qshape-style age-by-domain matrix.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BucketEdges = []int{5, 10, 20, 40, 80, 160, 320, 640, 1280}
BucketEdges are the upper edges in minutes, like qshape's default (-t 5 -b 10).
Functions ¶
Types ¶
type Filter ¶
type Filter struct {
Queue string // active, deferred, hold, incoming, maildrop, corrupt; "" = all
Domain string // recipient domain (exact, or suffix with leading ".")
Sender string // substring of sender
ReasonContains string // case-insensitive substring of any delay_reason
Category string // reason category id
MinAge time.Duration
}
Filter selects messages.
type Message ¶
type Message struct {
QueueName string `json:"queue_name"`
QueueID string `json:"queue_id"`
ArrivalTime int64 `json:"arrival_time"`
MessageSize int64 `json:"message_size"`
ForcedExpire bool `json:"forced_expire"`
Sender string `json:"sender"`
Recipients []Recipient `json:"recipients"`
}
Message is one line of `postqueue -j` output.
type ReasonCount ¶
type ReasonCount struct {
Reason string `json:"reason"`
Category string `json:"category"`
Hint string `json:"hint"`
Count int `json:"recipients"`
Domains []string `json:"domains"`
Example string `json:"example"`
// Provider (gmail, microsoft, yahoo) and provider playbook id, if any.
Provider string `json:"provider,omitempty"`
Playbook string `json:"playbook,omitempty"`
}
ReasonCount groups recipients by normalised delay reason.
type Recipient ¶
type Recipient struct {
Address string `json:"address"`
DelayReason string `json:"delay_reason,omitempty"`
}
Recipient is one undelivered recipient of a queued message.
type Shape ¶
type Shape struct {
Queue string `json:"queue"`
By string `json:"by"`
Buckets []string `json:"buckets"`
Total ShapeRow `json:"total"`
Rows []ShapeRow `json:"rows"`
}
Shape is a qshape-style matrix: rows are domains, columns are age buckets in minutes (0-5, 5-10, 10-20 ... 1280+), cells count messages.
func BuildShape ¶
BuildShape computes the matrix. by is "recipient" (default) or "sender". A message counts once per distinct domain. top limits rows (0 = all).
type ShapeRow ¶
type ShapeRow struct {
Domain string `json:"domain"`
Total int `json:"total"`
Cells []int `json:"cells"`
}
ShapeRow is one domain.
type Summary ¶
type Summary struct {
Total int `json:"messages"`
Recipients int `json:"recipients"`
Bytes int64 `json:"bytes"`
ByQueue []Count `json:"by_queue"`
TopDomains []Count `json:"top_recipient_domains"`
TopSenders []Count `json:"top_sender_domains"`
Reasons []ReasonCount `json:"reasons"`
OldestID string `json:"oldest_queue_id,omitempty"`
OldestAge string `json:"oldest_age,omitempty"`
OldestAgeSecs int64 `json:"oldest_age_seconds,omitempty"`
ForcedExpire int `json:"forced_expire"`
}
Summary is an overview of the queue.