summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/rrd.inc
diff options
context:
space:
mode:
authorheper <heper@users.noreply.github.com>2015-11-06 17:58:04 +0100
committerheper <heper@users.noreply.github.com>2015-11-06 17:58:04 +0100
commit89f3ec04dc4c0c9847b4603e28bd660881ef0a50 (patch)
tree604e61e6d6b5a016fc406adba8d14fd1f07487a6 /src/etc/inc/rrd.inc
parentc5b3bb016dbd41027fc3d916fdaeda6045241fe7 (diff)
downloadpfsense-89f3ec04dc4c0c9847b4603e28bd660881ef0a50.zip
pfsense-89f3ec04dc4c0c9847b4603e28bd660881ef0a50.tar.gz
add dhcpd rrd graph
Diffstat (limited to 'src/etc/inc/rrd.inc')
-rw-r--r--src/etc/inc/rrd.inc43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc
index 8d4f194..b0f8f77 100644
--- a/src/etc/inc/rrd.inc
+++ b/src/etc/inc/rrd.inc
@@ -229,6 +229,7 @@ function enable_rrd_graphing() {
$captiveportalconcurrent = "-concurrent.rrd";
$captiveportalloggedin = "-loggedin.rrd";
$ntpd = "ntpd.rrd";
+ $dhcpd = "-dhcpd.rrd";
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
$netstat = "/usr/bin/netstat";
@@ -241,6 +242,7 @@ function enable_rrd_graphing() {
$spamd_gather = "/usr/local/bin/spamd_gather_stats.php";
$ifconfig = "/sbin/ifconfig";
$captiveportal_gather = "/usr/local/bin/captiveportal_gather_stats.php";
+ $dhcpd_gather = "/usr/local/bin/dhcpd_gather_stats.php";
$ntpq = "/usr/local/sbin/ntpq";
$rrdtrafficinterval = 60;
@@ -258,6 +260,7 @@ function enable_rrd_graphing() {
$rrdvpninterval = 60;
$rrdcaptiveportalinterval = 60;
$rrdntpdinterval = 60;
+ $rrddhcpdinterval = 60;
$trafficvalid = $rrdtrafficinterval * 2;
$wirelessvalid = $rrdwirelessinterval * 2;
@@ -274,7 +277,8 @@ function enable_rrd_graphing() {
$vpnvalid = $rrdvpninterval * 2;
$captiveportalvalid = $rrdcaptiveportalinterval * 2;
$ntpdvalid = $rrdntpdinterval * 2;
-
+ $dhcpdvalid = $rrddhcpdinterval * 2;
+
/* Assume 2*10GigE for now */
$downstream = 2500000000;
$upstream = 2500000000;
@@ -911,6 +915,43 @@ function enable_rrd_graphing() {
}
/* End NTP statistics */
+
+ /* Start dhcpd statistics */
+ foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
+ if (isset($config['dhcpd'][$dhcpif]['statsgraph'])) {
+ if (!file_exists("$rrddbpath$dhcpif$dhcpd")) {
+ $rrdcreate = "$rrdtool create $rrddbpath$dhcpif$dhcpd --step $rrddhcpdinterval ";
+ $rrdcreate .= "DS:leases:GAUGE:$dhcpdvalid:0:100000 ";
+ $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:2284 ";
+ $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:2284 ";
+ $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:2284 ";
+ create_new_rrd($rrdcreate);
+ unset($rrdcreate);
+ }
+
+ /* enter UNKNOWN values in the RRD so it knows we rebooted. */
+ if (platform_booting()) {
+ mwexec("$rrdtool update $rrddbpath$dhcpif$dhcpd N:U:U:U:U:U:U:U:U");
+ }
+
+ $rrdupdatesh .= "\n";
+ $rrdupdatesh .= "# polling leases for dhcp \n";
+ $rrdupdatesh .= "DHCP=`${php} -q ${dhcpd_gather} '${dhcpif}'`\n";
+ $rrdupdatesh .= "$rrdtool update $rrddbpath$dhcpif$dhcpd \${DHCP}\n";
+
+ }
+ }
+
+ /* END dhcpd statistics */
$rrdupdatesh .= "sleep 60\n";
$rrdupdatesh .= "done\n";
OpenPOWER on IntegriCloud