summaryrefslogtreecommitdiffstats
path: root/etc/inc/rrd.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-07-16 14:14:10 -0400
committerjim-p <jimp@pfsense.org>2013-07-16 14:14:39 -0400
commit3ed917c7241b76eb6889ab75ddafb87e975a61db (patch)
treeb6e55e48cd84420b1c888c8c9146e5cfccb68f77 /etc/inc/rrd.inc
parent1c8faa89b9aab2d7ab7aef9837d9c9e436ada9c7 (diff)
downloadpfsense-3ed917c7241b76eb6889ab75ddafb87e975a61db.zip
pfsense-3ed917c7241b76eb6889ab75ddafb87e975a61db.tar.gz
Add an RRD graph for MBUFs under system. Tweaks welcome.
Diffstat (limited to 'etc/inc/rrd.inc')
-rw-r--r--etc/inc/rrd.inc39
1 files changed, 39 insertions, 0 deletions
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc
index 11fc4f3..e9d74e4 100644
--- a/etc/inc/rrd.inc
+++ b/etc/inc/rrd.inc
@@ -216,6 +216,7 @@ function enable_rrd_graphing() {
$spamd = "-spamd.rrd";
$proc = "-processor.rrd";
$mem = "-memory.rrd";
+ $mbuf = "-mbuf.rrd";
$cellular = "-cellular.rrd";
$vpnusers = "-vpnusers.rrd";
$captiveportalconcurrent = "-concurrent.rrd";
@@ -243,6 +244,7 @@ function enable_rrd_graphing() {
$rrdlbpoolinterval = 60;
$rrdprocinterval = 60;
$rrdmeminterval = 60;
+ $rrdmbufinterval = 60;
$rrdcellularinterval = 60;
$rrdvpninterval = 60;
$rrdcaptiveportalinterval = 60;
@@ -257,6 +259,7 @@ function enable_rrd_graphing() {
$lbpoolvalid = $rrdlbpoolinterval * 2;
$procvalid = $rrdlbpoolinterval * 2;
$memvalid = $rrdmeminterval * 2;
+ $mbufvalid = $rrdmbufinterval * 2;
$cellularvalid = $rrdcellularinterval * 2;
$vpnvalid = $rrdvpninterval * 2;
$captiveportalvalid = $rrdcaptiveportalinterval * 2;
@@ -688,6 +691,42 @@ function enable_rrd_graphing() {
/* End Memory statistics */
+ /* mbuf, create mbuf statistics database */
+ if(! file_exists("$rrddbpath$ifname$mbuf")) {
+ $rrdcreate = "$rrdtool create $rrddbpath$ifname$mbuf --step $rrdmbufinterval ";
+ $rrdcreate .= "DS:current:GAUGE:$mbufvalid:0:10000000 ";
+ $rrdcreate .= "DS:cache:GAUGE:$mbufvalid:0:10000000 ";
+ $rrdcreate .= "DS:total:GAUGE:$mbufvalid:0:10000000 ";
+ $rrdcreate .= "DS:max:GAUGE:$mbufvalid:0:10000000 ";
+ $rrdcreate .= "RRA:MIN:0.5:1:1200 ";
+ $rrdcreate .= "RRA:MIN:0.5:5:720 ";
+ $rrdcreate .= "RRA:MIN:0.5:60:1860 ";
+ $rrdcreate .= "RRA:MIN:0.5:1440:3652 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:1:1200 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:5:720 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:60:1860 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:1440:3652 ";
+ $rrdcreate .= "RRA:MAX:0.5:1:1200 ";
+ $rrdcreate .= "RRA:MAX:0.5:5:720 ";
+ $rrdcreate .= "RRA:MAX:0.5:60:1860 ";
+ $rrdcreate .= "RRA:MAX:0.5:1440:3652";
+
+ create_new_rrd($rrdcreate);
+ unset($rrdcreate);
+ }
+
+ /* enter UNKNOWN values in the RRD so it knows we rebooted. */
+ if($g['booting']) {
+ mwexec("$rrdtool update $rrddbpath$ifname$mbuf N:U:U:U:U:U");
+ }
+
+ /* the mbuf stats gathering function. */
+ $rrdupdatesh .= "MBUF=`$netstat -m | ";
+ $rrdupdatesh .= " $awk '/mbuf clusters in use/ { gsub(/\//, \":\", $1); print $1; }'`\n";
+ $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$mbuf N:\${MBUF}\n";
+
+ /* End mbuf statistics */
+
/* SPAMD, set up the spamd rrd file */
if (isset($config['installedpackages']['spamdsettings']) &&
$config['installedpackages']['spamdsettings']['config'][0]['enablerrd']) {
OpenPOWER on IntegriCloud