diff --git a/net-mgmt/collectd/Makefile b/net-mgmt/collectd/Makefile
new file mode 100644
index 000000000..00cf87be7
--- /dev/null
+++ b/net-mgmt/collectd/Makefile
@@ -0,0 +1,8 @@
+PLUGIN_NAME= collectd
+PLUGIN_VERSION= 0.1
+PLUGIN_COMMENT= Collect system and application performance metrics periodically
+PLUGIN_DEPENDS= collectd5
+PLUGIN_MAINTAINER= m.muenz@gmail.com
+PLUGIN_DEVEL= yes
+
+.include "../../Mk/plugins.mk"
diff --git a/net-mgmt/collectd/pkg-descr b/net-mgmt/collectd/pkg-descr
new file mode 100644
index 000000000..ecc2df166
--- /dev/null
+++ b/net-mgmt/collectd/pkg-descr
@@ -0,0 +1,6 @@
+collectd is a daemon which collects system and application
+performance metrics periodically and provides mechanisms
+to store the values in a variety of ways, for example
+in RRD files.
+
+WWW: http://www.collectd.org
diff --git a/net-mgmt/collectd/src/etc/inc/plugins.inc.d/collectd.inc b/net-mgmt/collectd/src/etc/inc/plugins.inc.d/collectd.inc
new file mode 100644
index 000000000..1e941f556
--- /dev/null
+++ b/net-mgmt/collectd/src/etc/inc/plugins.inc.d/collectd.inc
@@ -0,0 +1,49 @@
+ gettext('collectd daemon'),
+ 'configd' => array(
+ 'restart' => array('collectd restart'),
+ 'start' => array('collectd start'),
+ 'stop' => array('collectd stop'),
+ ),
+ 'name' => 'collectd',
+ 'pidfile' => '/var/run/collectd.pid'
+ );
+ }
+
+ return $services;
+}
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/Api/GeneralController.php b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/Api/GeneralController.php
new file mode 100644
index 000000000..629cc7aca
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/Api/GeneralController.php
@@ -0,0 +1,76 @@
+request->isGet()) {
+ $mdlGeneral = new General();
+ $result['general'] = $mdlGeneral->getNodes();
+ }
+ return $result;
+ }
+
+ public function setAction()
+ {
+ $result = array("result"=>"failed");
+ if ($this->request->isPost()) {
+ // load model and update with provided data
+ $mdlGeneral = new General();
+ $mdlGeneral->setNodes($this->request->getPost("general"));
+
+ // perform validation
+ $valMsgs = $mdlGeneral->performValidation();
+ foreach ($valMsgs as $field => $msg) {
+ if (!array_key_exists("validations", $result)) {
+ $result["validations"] = array();
+ }
+ $result["validations"]["general.".$msg->getField()] = $msg->getMessage();
+ }
+
+ // serialize model to config and save
+ if ($valMsgs->count() == 0) {
+ $mdlGeneral->serializeToConfig();
+ Config::getInstance()->save();
+ $result["result"] = "saved";
+ }
+ }
+ return $result;
+ }
+}
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/Api/ServiceController.php b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/Api/ServiceController.php
new file mode 100644
index 000000000..a8e45e79b
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/Api/ServiceController.php
@@ -0,0 +1,148 @@
+request->isPost()) {
+ $backend = new Backend();
+ $response = $backend->configdRun("collectd start", true);
+ return array("response" => $response);
+ } else {
+ return array("response" => array());
+ }
+ }
+
+ /**
+ * stop collectd service
+ * @return array
+ */
+ public function stopAction()
+ {
+ if ($this->request->isPost()) {
+ $backend = new Backend();
+ $response = $backend->configdRun("collectd stop");
+ return array("response" => $response);
+ } else {
+ return array("response" => array());
+ }
+ }
+
+ /**
+ * restart collectd service
+ * @return array
+ */
+ public function restartAction()
+ {
+ if ($this->request->isPost()) {
+ $backend = new Backend();
+ $response = $backend->configdRun("collectd restart");
+ return array("response" => $response);
+ } else {
+ return array("response" => array());
+ }
+ }
+
+ /**
+ * retrieve status of collectd
+ * @return array
+ * @throws \Exception
+ */
+ public function statusAction()
+ {
+ $backend = new Backend();
+ $mdlGeneral = new General();
+ $response = $backend->configdRun("collectd status");
+
+ if (strpos($response, "not running") > 0) {
+ if ($mdlGeneral->enabled->__toString() == 1) {
+ $status = "stopped";
+ } else {
+ $status = "disabled";
+ }
+ } elseif (strpos($response, "is running") > 0) {
+ $status = "running";
+ } elseif ($mdlGeneral->enabled->__toString() == 0) {
+ $status = "disabled";
+ } else {
+ $status = "unkown";
+ }
+
+
+ return array("status" => $status);
+ }
+
+ /**
+ * reconfigure collectd, generate config and reload
+ */
+ public function reconfigureAction()
+ {
+ if ($this->request->isPost()) {
+ // close session for long running action
+ $this->sessionClose();
+
+ $mdlGeneral = new General();
+ $backend = new Backend();
+
+ $runStatus = $this->statusAction();
+
+ // stop collectd if it is running or not
+ $this->stopAction();
+
+ // generate template
+ $backend->configdRun('template reload OPNsense/collectd');
+
+ // (res)start daemon
+ if ($mdlGeneral->enabled->__toString() == 1) {
+ $this->startAction();
+ }
+
+ return array("status" => "ok");
+ } else {
+ return array("status" => "failed");
+ }
+ }
+}
+
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/GeneralController.php b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/GeneralController.php
new file mode 100644
index 000000000..ce74a7d76
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/GeneralController.php
@@ -0,0 +1,38 @@
+view->title = gettext("collectd settings");
+ $this->view->generalForm = $this->getForm("general");
+ $this->view->pick('OPNsense/collectd/general');
+ }
+}
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/forms/general.xml b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/forms/general.xml
new file mode 100644
index 000000000..1251032aa
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/controllers/OPNsense/collectd/forms/general.xml
@@ -0,0 +1,140 @@
+
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/ACL/ACL.xml b/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/ACL/ACL.xml
new file mode 100644
index 000000000..3dd4cf422
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/ACL/ACL.xml
@@ -0,0 +1,9 @@
+
+
+ Services: collectd
+
+ ui/collectd/*
+ api/collectd/*
+
+
+
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/General.php b/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/General.php
new file mode 100644
index 000000000..858b2ff6b
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/General.php
@@ -0,0 +1,34 @@
+
+ //OPNsense/collectd/general
+ collectd configuration
+
+
+ 0
+ Y
+
+
+
+ Y
+ /^.{1,64}$/u
+
+
+ 0
+ N
+
+
+ 10
+ N
+
+
+ 0
+ N
+
+
+
+ N
+ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
+
+
+
+ N
+ 1
+ 65535
+
+
+
+ N
+ /^([0-9a-zA-Z._\-]){1,128}$/u
+
+
+
+ N
+ /^([0-9a-zA-Z._\-\!\$\%\/\(\)\+\#\=]){1,128}$/u
+
+
+ 0
+ N
+
+
+ 0
+ N
+
+
+
+ N
+
+
+
+ N
+ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
+
+
+
+ N
+ 1
+ 65535
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+ 1
+ N
+
+
+
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/Menu/Menu.xml b/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/Menu/Menu.xml
new file mode 100644
index 000000000..bd6f8458f
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/models/OPNsense/collectd/Menu/Menu.xml
@@ -0,0 +1,5 @@
+
diff --git a/net-mgmt/collectd/src/opnsense/mvc/app/views/OPNsense/collectd/general.volt b/net-mgmt/collectd/src/opnsense/mvc/app/views/OPNsense/collectd/general.volt
new file mode 100644
index 000000000..27625a564
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/mvc/app/views/OPNsense/collectd/general.volt
@@ -0,0 +1,60 @@
+{#
+
+OPNsense® is Copyright © 2014 – 2017 by Deciso B.V.
+This file is Copyright © 2017 by Michael Muenz
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+#}
+
+ {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
+
+
+
+
+
+
+
+
diff --git a/net-mgmt/collectd/src/opnsense/scripts/Collectd/setup.sh b/net-mgmt/collectd/src/opnsense/scripts/Collectd/setup.sh
new file mode 100644
index 000000000..72443b1bd
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/scripts/Collectd/setup.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+mkdir -p /var/db/collectd
+chown -R root:wheel /var/db/collectd
+chmod 750 /var/db/collectd
\ No newline at end of file
diff --git a/net-mgmt/collectd/src/opnsense/service/conf/actions.d/actions_collectd.conf b/net-mgmt/collectd/src/opnsense/service/conf/actions.d/actions_collectd.conf
new file mode 100644
index 000000000..b5680d7e1
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/service/conf/actions.d/actions_collectd.conf
@@ -0,0 +1,29 @@
+[start]
+command:/usr/local/opnsense/scripts/collectd/setup.sh;/usr/local/etc/rc.d/collectd start
+parameters:
+type:script
+message:starting collectd
+
+[stop]
+command:/usr/local/etc/rc.d/collectd stop; exit 0
+parameters:
+type:script
+message:stopping collectd
+
+[restart]
+command:/usr/local/opnsense/scripts/collectd/setup.sh;/usr/local/etc/rc.d/collectd restart
+parameters:
+type:script
+message:restarting collectd
+
+[reconfigure]
+command:/usr/local/opnsense/scripts/collectd/setup.sh;/usr/local/etc/rc.d/collectd restart
+parameters:
+type:script
+message:reconfigure collectd
+
+[status]
+command:/usr/local/etc/rc.d/collectd status;exit 0
+parameters:
+type:script_output
+message:request collectd status
diff --git a/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/+TARGETS b/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/+TARGETS
new file mode 100644
index 000000000..cba437dd6
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/+TARGETS
@@ -0,0 +1,2 @@
+collectd:/etc/rc.conf.d/collectd
+collectd.conf:/usr/local/etc/collectd.conf
diff --git a/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/collectd b/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/collectd
new file mode 100644
index 000000000..2f8a9c7c9
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/collectd
@@ -0,0 +1 @@
+collectd_enable="{% if helpers.exists('OPNsense.collectd.general.enabled') and OPNsense.collectd.general.enabled == '1' %}YES{% else %}NO{% endif %}"
diff --git a/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/collectd.conf b/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/collectd.conf
new file mode 100644
index 000000000..4e578e019
--- /dev/null
+++ b/net-mgmt/collectd/src/opnsense/service/templates/OPNsense/collectd/collectd.conf
@@ -0,0 +1,110 @@
+{% if helpers.exists('OPNsense.collectd.general.enabled') and OPNsense.collectd.general.enabled == '1' %}
+
+{% if helpers.exists('OPNsense.collectd.general.hostname') and OPNsense.collectd.general.hostname != '' %}
+Hostname "{{ OPNsense.collectd.general.hostname }}"
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.fqdnlookup') and OPNsense.collectd.general.fqdnlookup == '1' %}
+FQDNLookup true
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.interval') and OPNsense.collectd.general.interval != '' %}
+Interval {{ OPNsense.collectd.general.interval }}
+{% endif %}
+
+
+
+
+LoadPlugin syslog
+
+ LogLevel err
+
+
+{% if helpers.exists('OPNsense.collectd.general.p_contextswitch_enable') and OPNsense.collectd.general.p_contextswitch_enable == '1' %}
+LoadPlugin contextswitch
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_cpu_enable') and OPNsense.collectd.general.p_cpu_enable == '1' %}
+LoadPlugin cpu
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_df_enable') and OPNsense.collectd.general.p_df_enable == '1' %}
+LoadPlugin df
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_interface_enable') and OPNsense.collectd.general.p_interface_enable == '1' %}
+LoadPlugin interface
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_load_enable') and OPNsense.collectd.general.p_load_enable == '1' %}
+LoadPlugin load
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_memory_enable') and OPNsense.collectd.general.p_memory_enable == '1' %}
+LoadPlugin memory
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_network_enable') and OPNsense.collectd.general.p_network_enable == '1' %}
+LoadPlugin network
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_processes_enable') and OPNsense.collectd.general.p_processes_enable == '1' %}
+LoadPlugin processes
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_uptime_enable') and OPNsense.collectd.general.p_uptime_enable == '1' %}
+LoadPlugin uptime
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_users_enable') and OPNsense.collectd.general.p_users_enable == '1' %}
+LoadPlugin users
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_graphite_enable') and OPNsense.collectd.general.p_graphite_enable == '1' %}
+LoadPlugin write_graphite
+{% endif %}
+
+##############################################################################
+# Plugin configuration #
+#----------------------------------------------------------------------------#
+# In this section configuration stubs for each plugin are provided. A desc- #
+# ription of those options is available in the collectd.conf(5) manual page. #
+##############################################################################
+
+{% if helpers.exists('OPNsense.collectd.general.p_network_enable') and OPNsense.collectd.general.p_network_enable == '1' %}
+{% if helpers.exists('OPNsense.collectd.general.p_network_host') and OPNsense.collectd.general.p_network_host != '' %}
+{% if helpers.exists('OPNsense.collectd.general.p_network_port') and OPNsense.collectd.general.p_network_port != '' %}
+
+
+{% if helpers.exists('OPNsense.collectd.general.p_network_username') and OPNsense.collectd.general.p_network_username != '' %}
+ Username "{{ OPNsense.collectd.general.p_network_username }}"
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_network_password') and OPNsense.collectd.general.p_network_password != '' %}
+ Password "{{ OPNsense.collectd.general.p_network_password }}"
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_network_username') and OPNsense.collectd.general.p_network_username != '' %}
+{% if helpers.exists('OPNsense.collectd.general.p_network_encryption') and OPNsense.collectd.general.p_network_encryption == '1' %}
+ SecurityLevel Encrypt
+{% endif %}
+{% endif %}
+
+
+{% endif %}
+{% endif %}
+{% endif %}
+
+{% if helpers.exists('OPNsense.collectd.general.p_graphite_enable') and OPNsense.collectd.general.p_graphite_enable == '1' %}
+{% if helpers.exists('OPNsense.collectd.general.p_graphite_node') and OPNsense.collectd.general.p_graphite_node != '' %}
+
+
+{% if helpers.exists('OPNsense.collectd.general.p_graphite_host') and OPNsense.collectd.general.p_graphite_host != '' %}
+ Host "{{ OPNsense.collectd.general.p_graphite_host }}"
+{% endif %}
+{% if helpers.exists('OPNsense.collectd.general.p_graphite_port') and OPNsense.collectd.general.p_graphite_port != '' %}
+ Port "{{ OPNsense.collectd.general.p_graphite_port }}"
+{% endif %}
+ Protocol "tcp"
+ ReconnectInterval 0
+ LogSendErrors true
+ Prefix "collectd"
+ Postfix "collectd"
+ StoreRates true
+ AlwaysAppendDS false
+ EscapeCharacter "_"
+ SeparateInstances false
+ PreserveSeparator false
+ DropDuplicateFields false
+
+
+{% endif %}
+{% endif %}
+
+{% endif %}