Project

General

Profile

Actions

Feature #12711

open

Add InfluxDB V2 support

Added by Viktor Gurov almost 3 years ago. Updated 6 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Telegraf
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:

Description

Added support for the InfluxDB V2 protocol and made some improvements to the UI


Files

influxdbv2.jpg (88 KB) influxdbv2.jpg Craig Coonrad, 03/09/2024 09:00 PM
data.jpg (203 KB) data.jpg Craig Coonrad, 03/09/2024 09:02 PM
Actions #2

Updated by Per-Arne Hellarvik almost 2 years ago

Is it possible to get some TLC on this? I use Telegraf and InfluxDB V2 for my metrics from my homelab, so this is a bit of a showstopper for me getting metrics from my Netgate-device.

Actions #3

Updated by Craig Coonrad 10 months ago

pfSense : 23.09.1-RELEASE
Telegraf : 0.9_6

Telegraf can be configured to provide influxdb v2 metrics. Under Services --> Telegraf. Add the following to the custom input field at the bottom of the page: Additional configuration for Telegraf.

[[outputs.influxdb_v2]]
    urls = ["https://192.168.1.140:8086"]
    token = "yourtokengoeshere" 
    organization = "yourorggoeshere" 
    bucket = "yourbucketgoeshere" 
        insecure_skip_verify = true

Adjust as needed for http or https.

Reference:
https://github.com/influxdata/telegraf/blob/master/plugins/outputs/influxdb_v2/README.md

Actions #4

Updated by Marc Walter 6 months ago

Hi mmendoza / marcos-ng
It would be nice if you can update to the latest Telegraf version and update the package and then we can make some changes to the UI and also have a look at the configuration of Telegraf.
The Telegraf process is also not stable at the moment. I can also test and help you.

The fix from Craig Coonrad works but there is a problem when Telegraf restart so the config gets overwritten.

Thank you for make this high prio :).

Actions #5

Updated by Marcos M 6 months ago

[...] there is a problem when Telegraf restart so the config gets overwritten

Please open a new redmine (or follow up on the forum) with reproducible steps.

FWIW the current version in pfSense+ 24.03 is 1.29.1, and 1.30.3 in dev snapshots.

Actions #6

Updated by Craig Coonrad 6 months ago

I did not encounter any issues with the Telegraf config being overwritten.
I did experience Telegraf going down. So I used Service_Watchdog to keep an eye on it.

Actions #7

Updated by Marc Walter 6 months ago

Hi Marcos M

Please open a new redmine (or follow up on the forum) with reproducible steps.

If I configure Telegraf and send data to Influx DB V.2.0 this happens:
https://forum.netgate.com/topic/188496/telegraf-configuration-for-influxdb-2/3?_=1720372300856

I have the same as Craig Coonrad. Maybe it will be fixed with a new Telegraf version.
This is my additional Configuration:

[[inputs.exec]]
    commands = [
        "/usr/local/bin/telegraf_pfifgw.php",
        "sh /usr/local/bin/telegraf_temperature.sh" 
    ]
    data_format = "influx" 

[[inputs.tail]]
    files = ["/var/log/pfblockerng/dnsbl.log"]
    data_format = "grok" 
    from_beginning = false
    name_suffix = "_dnsbl_log" 
    grok_timezone = "Local" 
    grok_patterns = ["^%{WORD:blocktype}-%{WORD:blocksubtype},%{SYSLOGTIMESTAMP:timestamp:ts-syslog},%{IPORHOST:domain},%{IPORHOST:src_ip:tag},%{GREEDYDATA:req_agent},%{WORD:blockmethod},%{WORD:blocklist:tag},%{IPORHOST:tld:tag},%{WORD:feed_name:tag},%{GREEDYDATA:duplicateeventstatus}"]

[[inputs.tail]]
    files = ["/var/log/pfblockerng/ip_block.log"]
    data_format = "grok" 
    from_beginning = false
    name_suffix = "_ip_block_log" 
    grok_timezone = "Local" 
    grok_patterns = ["^%{SYSLOGTIMESTAMP:timestamp:ts-syslog},%{NUMBER:rulenum},%{DATA:interface},%{WORD:friendlyname},%{WORD:action},%{NUMBER:ip_version},%{NUMBER:protocolid},%{DATA:protocol:tag},%{IPORHOST:src_ip:tag},%{IPORHOST:dest_ip:tag},%{WORD:src_port:tag},%{NUMBER:dest_port:tag},%{WORD:direction},%{WORD:geoip_code:tag},%{DATA:ip_alias_name},%{DATA:ip_evaluated},%{DATA:feed_name:tag},%{HOSTNAME:resolvedhostname},%{GREEDYDATA:clienthostname},%{GREEDYDATA:ASN},%{GREEDYDATA:duplicateeventstatus}"]

[[outputs.influxdb_v2]]
   urls = ["http://192.168.XX.XX:8086"]
   token = "XXXXXXXXXXXXXXXXXXXX" 
   organization = "XXXX" 
   bucket = "XXXX" 

Maybe I should do a test with, step by step. It is also possible that the problem ist comming from: "telegraf_pfifgw.php" or "telegraf_temperature.sh".

Actions

Also available in: Atom PDF