diff options
author | Phil Davis <phil.davis@inf.org> | 2015-02-10 17:46:44 +0545 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2015-02-10 11:19:35 -0500 |
commit | 3339d6164c2333f1a6f529fe346466e90d94194e (patch) | |
tree | 56e5c0be2abc9ca17a772af9337496e098268545 | |
parent | 2dd0d10d8eb7e9208cd0a02fa6ee02d47a554a8f (diff) | |
download | pfsense-packages-3339d6164c2333f1a6f529fe346466e90d94194e.tar.gz pfsense-packages-3339d6164c2333f1a6f529fe346466e90d94194e.tar.bz2 pfsense-packages-3339d6164c2333f1a6f529fe346466e90d94194e.zip |
Support mail report of mbuf usage graph
Forum report: https://forum.pfsense.org/index.php?topic=82571.0
-rw-r--r-- | config/mailreport/mail_reports.inc | 51 | ||||
-rw-r--r-- | config/mailreport/mail_reports_generate.php | 2 | ||||
-rw-r--r-- | config/mailreport/mailreport.xml | 2 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml.amd64 | 2 |
6 files changed, 53 insertions, 8 deletions
diff --git a/config/mailreport/mail_reports.inc b/config/mailreport/mail_reports.inc index 6dddf7cd..669b1541 100644 --- a/config/mailreport/mail_reports.inc +++ b/config/mailreport/mail_reports.inc @@ -286,7 +286,7 @@ function mail_report_generate_graph($database, $style, $graph, $start, $end) { /* this should never happen */ if($end < $start) { - log_error("start $start is smaller than end $end"); + log_error("start $start is greater than end $end"); $end = $now; } @@ -392,7 +392,7 @@ function mail_report_generate_graph($database, $style, $graph, $start, $end) { $speedlimit = ($upstream + $downstream); - /* Set default colors explicity, the theme can then override them below. + /* Set default colors explicitly, the theme can then override them below. This prevents missing colors in themes from crashing the graphs. */ $colortrafficup = array("666666", "CCCCCC"); $colortrafficdown = array("990000", "CC0000"); @@ -402,6 +402,7 @@ function mail_report_generate_graph($database, $style, $graph, $start, $end) { $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); + $colormbuf = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorqueuesup = array('000000','7B0000','990000','BB0000','CC0000','D90000','EE0000','FF0000','CC0000'); $colorqueuesdown = array('000000','7B7B7B','999999','BBBBBB','CCCCCC','D9D9D9','EEEEEE','FFFFFF','CCCCCC'); $colorqueuesdropup = array('000000','7B0000','990000','BB0000','CC0000','D90000','EE0000','FF0000','CC0000'); @@ -718,7 +719,7 @@ function mail_report_generate_graph($database, $style, $graph, $start, $end) { $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; } elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { - /* define graphcmd for packets stats */ + /* define graphcmd for wireless stats */ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; $graphcmd .= "--start $start --end $end "; $graphcmd .= "--vertical-label \"snr/channel/rate\" "; @@ -927,6 +928,50 @@ function mail_report_generate_graph($database, $style, $graph, $start, $end) { $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; } + elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { + /* define graphcmd for mbuf usage stats */ + $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; + $graphcmd .= "--start $start --end $end "; + $graphcmd .= "--vertical-label \"utilization, percent\" "; + $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--title \"`hostname` - {$prettydb} clusters - {$hperiod} - {$havg} average\" "; + $graphcmd .= "--height 200 --width 620 "; + $graphcmd .= "DEF:\"current=$rrddbpath$curdatabase:current:AVERAGE\" "; + $graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE\" "; + $graphcmd .= "DEF:\"total=$rrddbpath$curdatabase:total:AVERAGE\" "; + $graphcmd .= "DEF:\"max=$rrddbpath$curdatabase:max:AVERAGE\" "; + $graphcmd .= "LINE2:\"current#{$colormbuf[0]}:current\" "; + $graphcmd .= "LINE2:\"cache#{$colormbuf[1]}:cache\" "; + $graphcmd .= "LINE2:\"total#{$colormbuf[2]}:total\" "; + $graphcmd .= "LINE2:\"max#{$colormbuf[3]}:max\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" "; + $graphcmd .= "COMMENT:\"Current. \" "; + $graphcmd .= "GPRINT:\"current:MIN:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"current:AVERAGE:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"current:MAX:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"current:LAST:%7.2lf %S \" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"Cache. \" "; + $graphcmd .= "GPRINT:\"cache:MIN:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"cache:AVERAGE:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"cache:MAX:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"cache:LAST:%7.2lf %S \" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"Total. \" "; + $graphcmd .= "GPRINT:\"total:MIN:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"total:AVERAGE:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"total:MAX:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"total:LAST:%7.2lf %S \" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"Max. \" "; + $graphcmd .= "GPRINT:\"max:MIN:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"max:AVERAGE:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"max:MAX:%7.2lf %s \" "; + $graphcmd .= "GPRINT:\"max:LAST:%7.2lf %S \" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; + } elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { /* define graphcmd for queue stats */ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; diff --git a/config/mailreport/mail_reports_generate.php b/config/mailreport/mail_reports_generate.php index c31909c9..55a23283 100644 --- a/config/mailreport/mail_reports_generate.php +++ b/config/mailreport/mail_reports_generate.php @@ -2,7 +2,7 @@ <?php /* $Id$ */ /* - mail_reports.inc + mail_reports_generate.php Part of pfSense Copyright (C) 2011 Jim Pingle <jimp@pfsense.org> Portions Copyright (C) 2007-2011 Seth Mos <seth.mos@dds.nl> diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml index 803e205b..1c6880bd 100644 --- a/config/mailreport/mailreport.xml +++ b/config/mailreport/mailreport.xml @@ -37,7 +37,7 @@ ]]> </copyright> <name>mailreport</name> - <version>2.1</version> + <version>2.2</version> <title>Status: Email Reports</title> <additional_files_needed> <prefix>/usr/local/bin/</prefix> diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 55e6b24f..fd75e618 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -1176,7 +1176,7 @@ <name>mailreport</name> <descr>Allows you to setup periodic e-mail reports containing command output, log file contents, and RRD graphs.</descr> <category>Network Management</category> - <version>2.1</version> + <version>2.2</version> <status>Stable</status> <required_version>2.2</required_version> <config_file>https://packages.pfsense.org/packages/config/mailreport/mailreport.xml</config_file> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 11982156..f4c0161d 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1586,7 +1586,7 @@ <name>mailreport</name> <descr>Allows you to setup periodic e-mail reports containing command output, log file contents, and RRD graphs.</descr> <category>Network Management</category> - <version>2.1</version> + <version>2.2</version> <status>Stable</status> <required_version>2.0</required_version> <config_file>https://packages.pfsense.org/packages/config/mailreport/mailreport.xml</config_file> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index cb63afc2..985e3c85 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1573,7 +1573,7 @@ <name>mailreport</name> <descr>Allows you to setup periodic e-mail reports containing command output, log file contents, and RRD graphs.</descr> <category>Network Management</category> - <version>2.1</version> + <version>2.2</version> <status>Stable</status> <required_version>2.0</required_version> <config_file>https://packages.pfsense.org/packages/config/mailreport/mailreport.xml</config_file> |