diff --git a/collector.sh b/collector.sh index cc64db2..b7cf41a 100755 --- a/collector.sh +++ b/collector.sh @@ -24,9 +24,9 @@ log_lines_smtpd=0 mo_sent=0 mo_deferred=0 -mo_bounced_total=0 -mo_bounced_spam=0 -mo_bounced_reputation=0 +mo_bncd_total=0 +mo_bncd_spam=0 +mo_bncd_reputation=0 mo_deliverable=0 mo_undeliverable=0 @@ -54,9 +54,9 @@ if [ ! -f "$DBFILE" ]; then DS:log_lines_smtpd:GAUGE:60:0:U \ DS:mo_sent:GAUGE:60:0:U \ DS:mo_deferred:GAUGE:60:0:U \ - DS:mo_bounced_total:GAUGE:60:0:U \ - DS:mo_bounced_spam:GAUGE:60:0:U \ - DS:mo_bounced_reputation:GAUGE:60:0:U \ + DS:mo_bncd_total:GAUGE:60:0:U \ + DS:mo_bncd_spam:GAUGE:60:0:U \ + DS:mo_bncd_reputation:GAUGE:60:0:U \ DS:mo_deliverable:GAUGE:60:0:U \ DS:mo_undeliverable:GAUGE:60:0:U \ DS:mi_accept:GAUGE:60:0:U \ @@ -100,8 +100,8 @@ fi # Collect number of log lines log_lines_total=`expr $new_log_position - $old_log_position` -log_lines_smtp=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' wc -l) -log_lines_smtpd=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtpd\[' wc -l) +log_lines_smtp=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | wc -l) +log_lines_smtpd=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtpd\[' | wc -l) # Get lines and analyse them a bit, do the counting @@ -110,9 +110,9 @@ mo_sent=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE mo_deferred=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=deferred' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) mo_deliverable=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=deliverable' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) mo_undeliverable=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=undeliverable' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) -mo_bounced_total=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) -mo_bounced_spam=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -i 'spam' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) -mo_bounced_reputation=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep -i 'reputation' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) +mo_bncd_total=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) +mo_bncd_spam=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -i 'spam' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) +mo_bncd_reputation=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep -i 'reputation' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) # Collect inbound email statistics mi_accept=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtpd\[' | grep '\/smtpd\[' | grep ': [0-9A-F]*: client=' | wc -l) @@ -127,8 +127,8 @@ mi_connects_tls=$(sed -n "$old_log_position","$new_log_position"p $LOGFILE | gre # Report counter results rrdtool update $RRDFILE \ - -t log_lines_total:log_lines_smtp:log_lines_smtpd:mo_sent:mo_deferred:mo_bounced_total:mo_bounced_spam:mo_bounced_reputation:mo_deliverable:mo_undeliverable:mi_accept:mi_reject:mi_proxy_accept:mi_proxy_reject:mi_connects:mi_connects_tls \ -$db_last_modified:$log_lines_total:$log_lines_smtp:$log_lines_smtpd:$mo_sent:$mo_deferred:$mo_bounced_total:$mo_bounced_spam:$mo_bounced_reputation:$mo_deliverable:$mo_undeliverable:$mi_accept:$mi_reject:$mi_proxy_accept:$mi_proxy_reject:$mi_connects:$mi_connects_tls + -t log_lines_total:log_lines_smtp:log_lines_smtpd:mo_sent:mo_deferred:mo_bncd_total:mo_bncd_spam:mo_bncd_reputation:mo_deliverable:mo_undeliverable:mi_accept:mi_reject:mi_proxy_accept:mi_proxy_reject:mi_connects:mi_connects_tls \ +$db_last_modified:$log_lines_total:$log_lines_smtp:$log_lines_smtpd:$mo_sent:$mo_deferred:$mo_bncd_total:$mo_bncd_spam:$mo_bncd_reputation:$mo_deliverable:$mo_undeliverable:$mi_accept:$mi_reject:$mi_proxy_accept:$mi_proxy_reject:$mi_connects:$mi_connects_tls # That's it. exit 0