Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 rodolico 1
#!/bin/bash
2
 
3
MAILLOG=/var/log/mail.log
4
DAT1=/tmp/zabbix-postfix-offset.dat
5
DAT2=$(mktemp)
6
PFLOGSUMM=/usr/sbin/pflogsumm
7
ZABBIX_CONF=/etc/zabbix/zabbix_agentd.conf
8
 
9
function zsend {
10
  /usr/bin/zabbix_sender -c $ZABBIX_CONF -k $1 -o $2
11
}
12
 
13
/usr/sbin/logtail -f$MAILLOG -o$DAT1 | $PFLOGSUMM -h 0 -u 0 --no_bounce_detail --no_deferral_detail --no_reject_detail --no_no_msg_size --no_smtpd_warnings > $DAT2
14
 
15
zsend pfreceived `grep -m 1 received $DAT2|cut -f1 -d"r"`
16
zsend pfdelivered `grep -m 1 delivered $DAT2|cut -f1 -d"d"`
17
zsend pfforwarded `grep -m 1 forwarded $DAT2|cut -f1 -d"f"`
18
zsend pfdeferred `grep -m 1 deferred $DAT2|cut -f1 -d"d"`
19
zsend pfbounced `grep -m 1 bounced $DAT2|cut -f1 -d"b"`
20
zsend pfrejected `grep -m 1 rejected $DAT2|cut -f1 -d"r"`
21
zsend pfrejectwarnings `grep -m 1 "reject warnings" $DAT2|cut -f1 -d"r"`
22
zsend pfheld `grep -m 1 held $DAT2|cut -f1 -d"h"`
23
zsend pfdiscarded `grep -m 1 discarded $DAT2|cut -f1 -d"d"`
24
zsend pfbytesreceived `grep -m 1 "bytes received" $DAT2|cut -f1 -d"b"`
25
zsend pfbytesdelivered `grep -m 1 "bytes delivered" $DAT2|cut -f1 -d"b"`
26
 
27
rm $DAT2