crontab:
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1
59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
14 0 * * * root rm -f /var/spool/cron/lastrun/cron.daily
29 0 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
44 0 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
1-46/15 * * * * /root/srvreport-0.35/bin/srvreport.pl
--------------------------------------------------------------------------
servreport.conf
# if set to 1, it will also display the time of the report-generation
ReportWithTime = 1
MailReport =
webmaster@xxxxx.tld
FileReport = ../web/html/%%YYYY-%%MM-%%DD.html
FileReportImgPath = ../../images/
# if you change the following to 1, then a file-report will created on every call
FileReportCreateAlways = 0
#FileReportChOwn = web1:ftponly
# 0: No TEST; normal behavior
# Bit 0: report-generation with the current day
# Bit 1: cyclic-call
# Bit 2: call reportFinished (only available if Bit 0 is also set)
# Bit 3: output to stdout
TEST = 0
order = Traffic CPUUsage WebServer FTPServer FTPLogs Postfix Warnings LastLogins
[Traffic]
module = TrafficReport
description = Traffic report
file = /proc/net/dev
interface = eth0:
pattern = %interface %in %o %o %o %o %o %o %o %out
[CPUUsage]
module = CPUReport
description = CPU Usage
file = /usr/bin/uptime |
regex = load average:s+d.dd,s+d.dd,s+(d.dd)
[LastLogins]
module = LogReport
description = Last logins
file = /usr/bin/last |
pattern = %o %o %o %o %time4
[Warnings]
module = LogReport
description = Warnings
file = /var/log/warn
pattern = %time2
#you can also defined your own custom regex
#regex = ^([^s]+)s+([^s]+)s+
#if you have a custom regex and you doe not want the whole file,
# you should specify the keys of the matches
# Known keys are at the moment:
# YEAR MONTH DAY HOUR MIN VHOST BYTES STATE INTERFACE OUT IN
# LogReport only uses YEAR MONTH and DAY
# but this syntax apllies to all modules (Httpd, Postfix CPU Traffic)
regexkeys = MONTH DAY
# you can also set "pre" to 1, so it will be display within an pre-html-tag
pre = 1
[FTPLogs]
module = LogReport
description = FTP-Logs
file = /var/log/xferlog
pattern = %o %time1
[WebServer]
module = HttpdReport
description = Web-Server
# variables in "file":
# %%YYYY: Year
# %%MM : Month (always 2 decimals, e.g. "02", "10")
# %%mm : Month (1 or 2 decimals, e.g. "2", "10")
# %%DD : Day (always 2 decimals, e.g. "06", "21")
# %%dd : Day (1 or 2 decimals, e.g. "6", "21")
file = /var/log/httpd/srvreport_%%YYYY-%%MM-%%DD
wholeFile = 1
# Warning: The following will delete the file after the report is generated!!!
deleteFile = 1
showHTTPStatus = 1
# Example:
# The following is the entry in the apache config-file:
# LogFormat "%v "%{Host}i" %h %t "%r" %>s %b" srvreport
#
# And here is an example of an log-entry:
# jesustotal.de "
www.jesustotal.de" 66.196.72.81 [07/Jan/2004:00:07:09 +0100] "GET /impressum.php HTTP/1.0" 200 9719
#
# The following patterns can be used:
# %o: Ignored
# %time1: Time in the form of "May 18 09:05:21 2003"
# %time2: Time in the form of "May 18 09:05:21"
# %time3: Time in the form of "[07/Jan/2004:00:07:09 +0100]" (" +0100" is optional)
# %time4: Time in the form of "Max 18"
# %time5: Time in the form of "2004-01-30 15:34:11"
# %state: State of the request (e.g. 200)
# %bytes: Bytes transfered (e.g. 9719)
# %vhost: Virtual host
#
# If right after the percent (%) a apastrophe (") is found, then this is used as 'encapsulated' character
pattern = %o %"vhost %o %time3 %"o %state %bytes
[FTPServer]
module = HttpdReport
description = FTP-Server
file = /var/log/xferlog
# Sun May 18 09:05:21 2003 2 62.46.204.237 49 /html/images/empty.gif b _ i r web2 ftp 0 * c
pattern = %o %time1 %o %o %bytes %o %o %o %o %o %vhost %o %state %o %o
showHTTPStatus = 0
[Postfix]
module = PostfixReport
description = Postfix
file = /var/log/mail
pattern = %time2
popperAnalyze = 1
showClientName = 1
pre = 1
# [ChkRootKit]
# module = LogReport
# description = Check for Rootkit
# file = /root/scripts/chkrootkit-0.43/chkrootkit |
# regex = INFECTED