Changes

From SME Server
Jump to navigationJump to search
use split() instead of substr() (old script always reported max=9). Add example showing how to scan "x" days of log files.
Line 38: Line 38:  
==== Monitor simultaneous in-bound SMTP connections ====
 
==== Monitor simultaneous in-bound SMTP connections ====
 
The command below will show the maximum number of simultaneous in-bound SMTP connections to your server since the last time the qpsmtpd log was rotated.  Replace "/current" with "/*" to get the maximum connection count in all existing qpsmtpd log files.
 
The command below will show the maximum number of simultaneous in-bound SMTP connections to your server since the last time the qpsmtpd log was rotated.  Replace "/current" with "/*" to get the maximum connection count in all existing qpsmtpd log files.
  awk -v INSTANCES="/"$(config getprop smtpd Instances) \
+
 
' $0 ~ INSTANCES { if(max=="") {max=1}; if(substr($5,0,length($5)-length(INSTANCES))>max)\
+
(The single quotes on the first and last line make this a single command):
{max=substr($5,0,length($5)-length(INSTANCES))}} END {print max}' /var/log/qpsmtpd/current
+
  <nowiki>awk -v INSTANCES="/"$(config getprop smtpd Instances) 'BEGIN {max=0}
 +
$0 ~ INSTANCES {split($5, count, "/"); count[1]>max?max=count[1]:max}
 +
END {print max}' /var/log/qpsmtpd/current</nowiki>
 +
 
 +
Show the maximum connections in any log file closed in the last 3 days, and include the configured "qpsmtpd Instances" for your system:
 +
<nowiki>awk -v INSTANCES="/"$(config getprop smtpd Instances) 'BEGIN {max=0}
 +
$0 ~ INSTANCES {split($5, count, "/"); count[1]>max?max=count[1]:max}  
 +
END {print max INSTANCES}' $(find /var/log/qpsmtpd/ -name "@*" -ctime -3)</nowiki>
    
===Allow for individual configuration of qpsmtpd and sqpsmtpd log file retention ===
 
===Allow for individual configuration of qpsmtpd and sqpsmtpd log file retention ===

Navigation menu