net-mgmt/telegraf: new plugin (#321)

This commit is contained in:
Michael
2017-10-13 19:56:39 +02:00
committed by Franco Fichtner
parent b6691d1ee5
commit 309998d430
28 changed files with 1349 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
PLUGIN_NAME= telegraf
PLUGIN_VERSION= 0.1
PLUGIN_COMMENT= Agent for collecting metrics and data
PLUGIN_DEPENDS= telegraf
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes
.include "../../Mk/plugins.mk"
+10
View File
@@ -0,0 +1,10 @@
Telegraf is the Agent for Collecting & Reporting Metrics & Data.
Telegraf has plugins or integrations to source a variety of
metrics directly from the system its running on, pull metrics
from third-party APIs, or even listen for metrics via a StatsD
and Kafka consumer services. It also has output plugins to send
metrics to a variety of other datastores, services, and message
queues, including InfluxDB, Graphite, OpenTSDB, Datadog, Librato,
Kafka, MQTT, NSQ, and many others.
WWW: https://www.influxdata.com/time-series-platform/telegraf/
@@ -0,0 +1,49 @@
<?php
/*
Copyright (C) 2017 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.
*/
function telegraf_services()
{
global $config;
$services = array();
if (isset($config['OPNsense']['telegraf']['general']['enabled']) && $config['OPNsense']['telegraf']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('telegraf agent'),
'configd' => array(
'restart' => array('telegraf restart'),
'start' => array('telegraf start'),
'stop' => array('telegraf stop'),
),
'name' => 'telegraf',
'pidfile' => '/var/run/telegraf.pid'
);
}
return $services;
}
@@ -0,0 +1,77 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 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.
*
*/
namespace OPNsense\Telegraf\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Telegraf\General;
use \OPNsense\Core\Config;
class GeneralController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->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;
}
}
@@ -0,0 +1,77 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 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.
*
*/
namespace OPNsense\Telegraf\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Telegraf\Input;
use \OPNsense\Core\Config;
class InputController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlInput = new Input();
$result['input'] = $mdlInput->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlInput = new Input();
$mdlInput->setNodes($this->request->getPost("input"));
// perform validation
$valMsgs = $mdlInput->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["input.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlInput->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
}
@@ -0,0 +1,77 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 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.
*
*/
namespace OPNsense\Telegraf\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Telegraf\Output;
use \OPNsense\Core\Config;
class OutputController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlOutput = new Output();
$result['output'] = $mdlOutput->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlOutput = new Output();
$mdlOutput->setNodes($this->request->getPost("output"));
// perform validation
$valMsgs = $mdlOutput->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["output.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlOutput->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
}
@@ -0,0 +1,149 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 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.
*
*/
namespace OPNsense\Telegraf\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Core\Backend;
use \OPNsense\Telegraf\General;
/**
* Class ServiceController
* @package OPNsense\Telegraf
*/
class ServiceController extends ApiControllerBase
{
/**
* start telegraf service (in background)
* @return array
*/
public function startAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("telegraf start", true);
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
* stop telegraf service
* @return array
*/
public function stopAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("telegraf stop");
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
* restart telegraf service
* @return array
*/
public function restartAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("telegraf restart");
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
* retrieve status of telegraf
* @return array
* @throws \Exception
*/
public function statusAction()
{
$backend = new Backend();
$mdlGeneral = new General();
$response = $backend->configdRun("telegraf 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 telegraf, 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 telegraf if it is running or not
$this->stopAction();
// generate template
$backend->configdRun('template reload OPNsense/Telegraf');
// (res)start daemon
if ($mdlGeneral->enabled->__toString() == 1) {
$this->startAction();
}
return array("status" => "ok");
} else {
return array("status" => "failed");
}
}
}
@@ -0,0 +1,39 @@
<?php
/*
Copyright (C) 2017 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.
*/
namespace OPNsense\Telegraf;
class GeneralController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("Telegraf Settings");
$this->view->generalForm = $this->getForm("general");
$this->view->pick('OPNsense/Telegraf/general');
}
}
@@ -0,0 +1,39 @@
<?php
/*
Copyright (C) 2017 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.
*/
namespace OPNsense\Telegraf;
class InputController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("Telegraf Inputs");
$this->view->inputForm = $this->getForm("input");
$this->view->pick('OPNsense/Telegraf/input');
}
}
@@ -0,0 +1,39 @@
<?php
/*
Copyright (C) 2017 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.
*/
namespace OPNsense\Telegraf;
class OutputController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("Telegraf Outputs");
$this->view->outputForm = $this->getForm("output");
$this->view->pick('OPNsense/Telegraf/output');
}
}
@@ -0,0 +1,62 @@
<form>
<field>
<id>general.enabled</id>
<label>Enable Telegraf Agent</label>
<type>checkbox</type>
<help>This will activate the telegraf agent.</help>
</field>
<field>
<id>general.interval</id>
<label>Interval</label>
<type>text</type>
<help>Default data collection interval for all inputs in seconds.</help>
</field>
<field>
<id>general.roundinterval</id>
<label>Round Interval</label>
<type>checkbox</type>
<help>Rounds collection interval to 'interval', e.g. if interval="10s" then always collect on :00, :10, :20, etc.</help>
</field>
<field>
<id>general.metric_batch_size</id>
<label>Metric Batch Size</label>
<type>text</type>
<help>Telegraf will send metrics to outputs in batches of at most metric_batch_size metrics. This controls the size of writes that Telegraf sends to output plugins.</help>
</field>
<field>
<id>general.metric_buffer_limit</id>
<label>Metric Buffer Limit</label>
<type>text</type>
<help>For failed writes, Telegraf will cache metric_buffer_limit metrics for each output, and will flush this buffer on a successful write.</help>
</field>
<field>
<id>general.collection_jitter</id>
<label>Collection Jitter</label>
<type>text</type>
<help>Collection jitter is used to jitter the collection by a random amount. Each plugin will sleep for a random time within jitter before collecting. Input value are seconds.</help>
</field>
<field>
<id>general.flush_interval</id>
<label>Flush Interval</label>
<type>text</type>
<help>Default flushing interval for all outputs. You should not set this below interval.</help>
</field>
<field>
<id>general.flush_jitter</id>
<label>Flush Jitter</label>
<type>text</type>
<help>Jitter the flush interval by a random amount. This is primarily to avoid large write spikes for users running a large number of telegraf instances.</help>
</field>
<field>
<id>general.hostname</id>
<label>Hostname</label>
<type>text</type>
<help>Override default hostname, if empty use system hostname.</help>
</field>
<field>
<id>general.omit_hostname</id>
<label>Omit Hostname</label>
<type>checkbox</type>
<help>If set to true, do no set the "host" tag in the Telegraf agent.</help>
</field>
</form>
@@ -0,0 +1,74 @@
<form>
<field>
<id>input.cpu</id>
<label>CPU</label>
<type>checkbox</type>
<help>Read metrics about CPU usage.</help>
</field>
<field>
<id>input.cpu_percpu</id>
<label>Per-CPU</label>
<type>checkbox</type>
<help>Whether to report Per-CPU stats or not.</help>
</field>
<field>
<id>input.cpu_totalcpu</id>
<label>Total CPU</label>
<type>checkbox</type>
<help>Whether to report total system CPU stats or not.</help>
</field>
<field>
<id>input.cpu_collect_cpu_time</id>
<label>Collect CPU Time</label>
<type>checkbox</type>
<help>If true, collect raw CPU time metrics.</help>
</field>
<field>
<id>input.disk</id>
<label>Disk</label>
<type>checkbox</type>
<help>Read metrics about disk usage by mount point.</help>
</field>
<field>
<id>input.disk_mount_points</id>
<label>Disk Mount Points</label>
<type>text</type>
<help>By default, Telegraf gather stats for all mountpoints. Setting mountpoints will restrict the stats to the specified mountpoints.</help>
</field>
<field>
<id>input.disk_ignore_fs</id>
<label>Disk Ignore FS</label>
<type>text</type>
<help>Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually present on /run, /var/run, /dev/shm or /dev).</help>
</field>
<field>
<id>input.diskio</id>
<label>Disk IO</label>
<type>checkbox</type>
<help>Read metrics about disk IO by device.</help>
</field>
<field>
<id>input.mem</id>
<label>Memory</label>
<type>checkbox</type>
<help>Read metrics about memory usage.</help>
</field>
<field>
<id>input.processes</id>
<label>Processes</label>
<type>checkbox</type>
<help>Get the number of processes and group them by status.</help>
</field>
<field>
<id>input.swap</id>
<label>Swap</label>
<type>checkbox</type>
<help>Read metrics about swap memory usage.</help>
</field>
<field>
<id>input.system</id>
<label>System</label>
<type>checkbox</type>
<help>Read metrics about system load and uptime.</help>
</field>
</form>
@@ -0,0 +1,38 @@
<form>
<field>
<id>output.influx_enable</id>
<label>Enable Influx</label>
<type>checkbox</type>
<help>This will enable InfluxDB as output.</help>
</field>
<field>
<id>output.influx_url</id>
<label>Influx URL</label>
<type>text</type>
<help>Set the URL where metrics shoud be sent to.</help>
</field>
<field>
<id>output.influx_database</id>
<label>Database</label>
<type>text</type>
<help>Set the name of the database on InfluxDB.</help>
</field>
<field>
<id>output.influx_timeout</id>
<label>Timeout</label>
<type>text</type>
<help>Write timeout (for the InfluxDB client), formatted as a string. If not provided, will default to 5s. 0s means no timeout (not recommended).</help>
</field>
<field>
<id>output.influx_username</id>
<label>Username</label>
<type>text</type>
<help>Set the username for authentication.</help>
</field>
<field>
<id>output.influx_password</id>
<label>Password</label>
<type>text</type>
<help>Set the password for authentication.</help>
</field>
</form>
@@ -0,0 +1,9 @@
<acl>
<page-services-telegraf>
<name>Services: Telegraf</name>
<patterns>
<pattern>ui/telegraf/*</pattern>
<pattern>api/telegraf/*</pattern>
</patterns>
</page-services-telegraf>
</acl>
@@ -0,0 +1,35 @@
<?php
/*
Copyright (C) 2017 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.
*/
namespace OPNsense\Telegraf;
use OPNsense\Base\BaseModel;
class General extends BaseModel
{
}
@@ -0,0 +1,47 @@
<model>
<mount>//OPNsense/telegraf/general</mount>
<description>Telegraf general configuration</description>
<version>1.0.0</version>
<items>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
<interval type="IntegerField">
<default>10</default>
<Required>Y</Required>
</interval>
<roundinterval type="BooleanField">
<default>1</default>
<Required>Y</Required>
</roundinterval>
<metric_batch_size type="IntegerField">
<default>1000</default>
<Required>Y</Required>
</metric_batch_size>
<metric_buffer_limit type="IntegerField">
<default>10000</default>
<Required>Y</Required>
</metric_buffer_limit>
<collection_jitter type="IntegerField">
<default>0</default>
<Required>Y</Required>
</collection_jitter>
<flush_interval type="IntegerField">
<default>10</default>
<Required>Y</Required>
</flush_interval>
<flush_jitter type="IntegerField">
<default>0</default>
<Required>Y</Required>
</flush_jitter>
<hostname type="TextField">
<default></default>
<Required>N</Required>
</hostname>
<omit_hostname type="BooleanField">
<default>0</default>
<Required>Y</Required>
</omit_hostname>
</items>
</model>
@@ -0,0 +1,35 @@
<?php
/*
Copyright (C) 2017 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.
*/
namespace OPNsense\Telegraf;
use OPNsense\Base\BaseModel;
class Input extends BaseModel
{
}
@@ -0,0 +1,55 @@
<model>
<mount>//OPNsense/telegraf/input</mount>
<description>Telegraf inputs configuration</description>
<version>1.0.0</version>
<items>
<cpu type="BooleanField">
<default>1</default>
<Required>N</Required>
</cpu>
<cpu_percpu type="BooleanField">
<default>1</default>
<Required>N</Required>
</cpu_percpu>
<cpu_totalcpu type="BooleanField">
<default>1</default>
<Required>N</Required>
</cpu_totalcpu>
<collect_cpu_time type="BooleanField">
<default>0</default>
<Required>N</Required>
</collect_cpu_time>
<disk type="BooleanField">
<default>1</default>
<Required>N</Required>
</disk>
<disk_mount_points type="TextField">
<default></default>
<Required>N</Required>
</disk_mount_points>
<disk_ignore_fs type="TextField">
<default></default>
<Required>N</Required>
</disk_ignore_fs>
<diskio type="BooleanField">
<default>1</default>
<Required>N</Required>
</diskio>
<mem type="BooleanField">
<default>1</default>
<Required>N</Required>
</mem>
<processes type="BooleanField">
<default>1</default>
<Required>N</Required>
</processes>
<swap type="BooleanField">
<default>0</default>
<Required>N</Required>
</swap>
<system type="BooleanField">
<default>1</default>
<Required>N</Required>
</system>
</items>
</model>
@@ -0,0 +1,9 @@
<menu>
<Services>
<Telegraf cssClass="fa fa-area-chart">
<General order="10" url="/ui/telegraf/general/index"/>
<Input order="20" url="/ui/telegraf/input/index"/>
<Output order="30" url="/ui/telegraf/output/index"/>
</Telegraf>
</Services>
</menu>
@@ -0,0 +1,35 @@
<?php
/*
Copyright (C) 2017 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.
*/
namespace OPNsense\Telegraf;
use OPNsense\Base\BaseModel;
class Output extends BaseModel
{
}

Some files were not shown because too many files have changed in this diff Show More