How can add new metrics to telegraf

I have installed telegraf 1.17 on my redhat7 actually it send data to other app (vmware vrealize operation ) and I can see metrics such as CPU , disk , memory in vrops such as attach pic but I cannot see anything about network status (send , receive , …) how can add these metrics to my telegraf ?
Also I have attached telegraf.conf
telegraf.txt (272.4 KB)
met

2 - According to attach pic we have some metrics for cpu such as usage guest , usage guest nice, usage nice, usage … How can understand what is each one ? for example which one show how much my cpu usage now ?

Hi @baber,
I hope you are doing well. With regards to network usage check out the following input plugins:

For more information on the CPU plugin check out the man proc docs: proc(5) - Linux manual page

Thanks, but would you please advice me how can use it ?
Do I have to just add follow code to telegraf.conf ?

# Collect response time of a TCP or UDP connection
[[inputs.net_response]]
  ## Protocol, must be "tcp" or "udp"
  ## NOTE: because the "udp" protocol does not respond to requests, it requires
  ## a send/expect string pair (see below).
  protocol = "tcp"
  ## Server address (default localhost)
  address = "localhost:80"

  ## Set timeout
  # timeout = "1s"

  ## Set read timeout (only used if expecting a response)
  # read_timeout = "1s"

  ## The following options are required for UDP checks. For TCP, they are
  ## optional. The plugin will send the given string to the server and then
  ## expect to receive the given 'expect' string back.
  ## string sent to the server
  # send = "ssh"
  ## expected string in answer
  # expect = "ssh"

  ## Uncomment to remove deprecated fields; recommended for new deploys
  # fielddrop = ["result_type", "string_found"]

Hi @baber,
You are correct. If you would like to add the input plugin. Add this to your current config file:

# Collect response time of a TCP or UDP connection
# TCP example
[[inputs.net_response]]
  protocol = "tcp"
  ## Server address (default localhost)
  address = "localhost:80"

# UDP Example:
# Collect response time of a TCP or UDP connection
[[inputs.net_response]]
  protocol = "UDP"
  ## Server address (default localhost)
  address = "localhost:80"

  ## The following options are required for UDP checks. For TCP, they are
  ## optional. The plugin will send the given string to the server and then
  ## expect to receive the given 'expect' string back.
  ## string sent to the server
   send = "ssh"
  ## expected string in answer
   expect = "ssh"

I added above to my telegraf.conf file but when restart telegraf it shows follow error :

"2021-11-23T06:30:00Z E! [inputs.net_response]: Error in plugin: Bad protocol
2021-11-23T06:30:41Z E! Output [wavefront] unexpected type: string, with value: connection_failed, for: net.response.result.type
2021-11-23T06:35:00Z E! [inputs.net_response]: Error in plugin: Bad protocol
2021-11-23T06:35:41Z E! Output [wavefront] unexpected type: string, with value: connection_failed, for: net.response.result.type "

and did not add any metric about network .

Would you please help me about it ?

I added this to my telegraf.conf

 [[inputs.net_response]]
#   ## Protocol, must be "tcp" or "udp"
#   ## NOTE: because the "udp" protocol does not respond to requests, it requires
#   ## a send/expect string pair (see below).
   protocol = "tcp"
#   ## Server address (default localhost)
   address = "localhost:80"
#
#   ## Set timeout
    timeout = "1s"
#
#   ## Set read timeout (only used if expecting a response)
    read_timeout = "1s"
#
#   ## The following options are required for UDP checks. For TCP, they are
#   ## optional. The plugin will send the given string to the server and then
#   ## expect to receive the given 'expect' string back.
#   ## string sent to the server
    send = "ssh"
#   ## expected string in answer
    expect = "ssh"
#
#   ## Uncomment to remove deprecated fields
    fielddrop = ["result_type", "string_found"]

and start telegraf without any error . Now my problems is cannot see network metric in my monitoring app
met2

Hi @baber,
sorry I missed this. Give me 10 minutes to make a working config on my end.

Hi @baber,
I have run and tested two config examples for net, net_stats (config 1) and net_response (config 2). Could you try and run config 1 for me? These plugins I believe will provide stats closer to what you are looking for.

Configs found here: Telegraf_Configs/net at master · InfluxCommunity/Telegraf_Configs · GitHub

With regards to not seeing metrics can you please check the rest of your config for *pass or *drop as these will prevent metrics from reaching your DB instance since they provide filtering functionality.

Thanks. But confuse. in above links I can just see 2 files:
telegraf-net.conf and telegraf-netResponse.conf . and as I previously said I want add network metrics to previous metrics so Is that your means add contents to telegraf.conf ? which file’s content ? telegraf-net.conf or telegraf-netResponse.conf ?

Hi @baber,
They are two example config files. Please copy the contexts of the input section to your own config like so:

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################
[[inputs.netstat]]
  name_override = "netstat"
[[inputs.net]]
  name_override = "net"

if you do not mind sending me your full config. I can add them for you. :slight_smile:

Thanks . This is my file

telegraf.txt (272.6 KB)

Would you please help me about that ?

@baber,
I am a little confused. In the config file, you sent me you don’t have any output plugins? Can you let me know where you plan to output your data? I have added the input plugins to the config nevertheless:
telegraf_baber_altered.txt (272.7 KB)

Actually I don’t know I just did according to a doc

because I am a virtual engineer and want use this method . also I replaced the new telegraf.conf file with previously but another not happened and my metrics did not changed

also there is other file with the name httpd.conf with follow content :

[[outputs.http]]
url = “https://10.10.10.10/arc/default/metric
insecure_skip_verify = true
tls_ca = “/usr/telegraf/etc/telegraf/ca.cert.pem”
tls_cert = “/usr/telegraf/etc/telegraf/cert.pem”
tls_key = “/usr/telegraf/etc/telegraf/key.pem”
data_format = “wavefront”
[outputs.http.headers]
uuid = “34a739bf-d920-486c-b5f8-a75b4ae74b9b”
ip = “$IP”

Ah, that must be your output plugin and how you are collecting metrics in VMware. Was this located in the Telegraf.d directory?

Could you provide the Telegraf service logs? We can check to see why you are not seeing the new metrics

Yes. That file located in Telegraf.d folder
Unfortunately could not find telegraf.log file and show that output

I run telegraf with follow command :

[root@ptest1 telegraf]# /usr/telegraf/usr/bin/telegraf -config /usr/telegraf/etc/telegraf/telegraf.conf -config-directory /usr/telegraf/etc/telegraf/telegraf.d &
[1] 158348
[root@ptest1 telegraf]# 2021-11-30T10:11:06Z I! Starting Telegraf 1.17.0
2021-11-30T10:11:06Z I! Loaded inputs: cpu disk diskio kernel mem net net_response netstat processes swap system
2021-11-30T10:11:06Z I! Loaded aggregators:
2021-11-30T10:11:06Z I! Loaded processors:
2021-11-30T10:11:06Z I! Loaded outputs: http
2021-11-30T10:11:06Z I! Tags enabled: host=ptest1
2021-11-30T10:11:06Z I! [agent] Config: Interval:5m0s, Quiet:false, Hostname:“ptest1”, Flush Interval:1m0s
2021-11-30T10:11:06Z I! Unable to create the error logger!

Would you please help me about it ?