I am looking for loading multiple custom plugin files from directory /etc/telegraf/telegraf.d. But seems after following all the steps for influx2.x not able to get any dashboard in grafana related to custome endpoints. There is no error while executing the telegraf command
sudo telegraf --config-directory /etc/telegraf/telegraf.d &
[2] 5869
ashokd@nextgenmonitoring:/etc/telegraf$ 2020-11-29T12:57:30Z I! Starting Telegraf 1.16.2
2020-11-29T12:57:30Z I! Using config file: /etc/telegraf/telegraf.conf
2020-11-29T12:57:30Z I! Loaded inputs: exec (2x)
2020-11-29T12:57:30Z I! Loaded aggregators:
2020-11-29T12:57:30Z I! Loaded processors:
2020-11-29T12:57:30Z I! Loaded outputs: influxdb_v2
2020-11-29T12:57:30Z I! Tags enabled: host=nextgenmonitoring
2020-11-29T12:57:30Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“nextgenmonitoring”, Flush Interval:10s
Hello @adhaktode,
Can you please share your telegraf config file?
Here is all config dump
nextgenmonitoring:~$ influx config list
Active Name URL Org
default http://172.24.3.240:8086 Optum
[[outputs.influxdb_v2]]
The URLs of the InfluxDB cluster nodes.
Multiple URLs can be specified for a single cluster, only ONE of the
urls will be written to each interval.
urls exp: http://127.0.0.1:8086
urls = [“http://172.24.3.240:8086”]
Token for authentication.
token = “$INFLUX_TOKEN”
Organization is the name of the organization you wish to write to; must exist.
organization = “Optum”
Destination bucket to write into.
bucket = “telegraf”
##Debug Mode
debug=true
nextgenmonitoring:/etc/telegraf/telegraf.d$ ls -al
total 36
drwxr-xr-x 2 root root 4096 Dec 7 14:25 .
drwxr-xr-x 3 root root 4096 Dec 7 09:21 …
-rwxr-xr-x 1 root root 442 Dec 7 14:09 ACI_APIC.conf
-rwxr-xr-x 1 root root 607 Dec 7 14:13 ACI_Faults.conf
-rwxr-xr-x 1 root root 667 Dec 7 14:16 ACI_NodeHealth.conf
-rwxr-xr-x 1 root root 694 Dec 7 13:58 ACI_SystemHealth.conf
-rwxr-xr-x 1 root root 535 Dec 7 14:25 ACI_TenantHealth.conf
-rwxr-xr-x 1 root root 1391 Nov 29 13:06 apic_querysig.sh
-rwxr-xr-x 1 root root 504 Nov 29 12:20 LAB_L3Out_103_Eth1-8.conf
I am trying to get these conf files working. Below is one conf file.
nextgenmonitoring:/etc/telegraf/telegraf.d$ cat LAB_L3Out_103_Eth1-8.conf
[[inputs.exec]]
name_override = “ACI_interface”
commands = [“sh /etc/telegraf/apic_querysig.sh 10.11.166.177 "/api/node/mo/topology/pod-1/node-103/sys/phys-[eth1/8].json?query-target=children&target-subtree-class=ethpmPhysIf" telegraf telegraf.key”]
timeout = “10s”
data_format = “json”
json_query = “imdata”
tag_keys = [“ethpmPhysIf_attributes_dn”]
json_string_fields = [“*accessVlan”, “*operMode”, “*operSpeed”, “*operSt”, “*usage”]
[inputs.exec.tags]
apic = “10.11.166.177”
May be its something I am missing very basic!
Hello @adhaktode,
Since you’re using the exec plugin it’s hard to tell.
Have you tried using the test
command?
./telegraf -config telegraf.conf -test
I recommend giving it a go or writing your data to stdout with:
[[outputs.file]]
## Files to write to, "stdout" is a specially handled file.
files = ["stdout"]
## Data format to output.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format = "influx"
To see if your line protocol is correct. If it isn’t then you know how you need adjust your script.
Test config gives some hope, here is the test results. WIll give it a try with stdout if this does not help in your opinion!
nextgenmonitoring:~$ /usr/bin/telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d --test
2020-12-16T16:23:42Z I! Starting Telegraf 1.16.2
ACI_interface,apic=10.11.166.177,ethpmPhysIf_attributes_dn=topology/pod-1/node-103/sys/phys-[eth1/8]/phys,host=nextgenmonitoring ethpmPhysIf_attributes_accessVlan=“vlan-1”,ethpmPhysIf_attributes_operMode=“trunk”,ethpmPhysIf_attributes_operSpeed=“10G”,ethpmPhysIf_attributes_operSt=“up”,ethpmPhysIf_attributes_usage=“epg” 1608135823000000000
nextgenmonitoring:~$
Hello @adhaktode,
It looks like nextgenmonitoring:~$
at the end of your line protocol is unexpected. Also I notice you don’t have any fields. You need a field to write to influxdb.
You line protocol should look like:
measurement,tagkey1=tagvalue1,tagkey2=tagvalue2 field=10.0 1608135823000000000
I really recommend refreshing on some influxdb basics if you’re unfamiliar with line protocol and data schema design.