Thats right its writing
Post your telegraf config file.
Here
# Telegraf Configuration
#
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
#
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
#
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.
#
# Environment variables can be used anywhere in this config file, simply prepend
# them with $. For strings the variable must be within quotes (ie, "$STR_VAR"),
# for numbers and booleans they should be plain (ie, $INT_VAR, $BOOL_VAR)
# Global tags can be specified here in key="value" format.
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
# user = "$USER"
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## 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.
metric_batch_size = 1000
## Maximum number of unwritten metrics per output.
metric_buffer_limit = 10000
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. Maximum flush_interval will be
## flush_interval + flush_jitter
flush_interval = "60s"
## 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.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
## By default or when set to "0s", precision will be set to the same
## timestamp order as the collection interval, with the maximum being 1s.
## ie, when interval = "10s", precision will be "1s"
## when interval = "250ms", precision will be "1ms"
## Precision will NOT be used for service inputs. It is up to each individual
## service input to set the timestamp at the appropriate precision.
## Valid time units are "ns", "us" (or "Āµs"), "ms", "s".
precision = ""
## Logging configuration:
## Run telegraf with debug log messages.
debug = false
## Run telegraf in quiet mode (error log messages only).
quiet = false
## Specify the log file name. The empty string means to log to stderr.
logfile = "/Program Files/Telegraf/telegraf.log"
## The logfile will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed.
# logfile_rotation_interval = "0d"
## The logfile will be rotated when it becomes larger than the specified
## size. When set to 0 no size based rotation is performed.
# logfile_rotation_max_size = "0MB"
## Maximum number of rotated archives to keep, any older logs are deleted.
## If set to -1, no archives are removed.
# logfile_rotation_max_archives = 5
## Override default hostname, if empty use os.Hostname()
hostname = ""
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
###############################################################################
# OUTPUTS #
###############################################################################
[[outputs.socket_writer]]
address = "udp4://127.0.0.1:8094"
data_format = "json"
# Configuration for sending metrics to InfluxDB
[[outputs.file]]
## Files to write to, "stdout" is a specially handled file.
## Output to \logs\telegraf-output.log, make sure c:\logs exists first.
files = ["/logs/telegraf-output.log", "stdout"]
## The file will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed.
# rotation_interval = "0h"
## The logfile will be rotated when it becomes larger than the specified
## size. When set to 0 no size based rotation is performed.
# rotation_max_size = "0MB"
## Maximum number of rotated archives to keep, any older logs are deleted.
## If set to -1, no archives are removed.
# rotation_max_archives = 5
## 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 = "json"
## OR use "influx" instead of "json" for simpler output
## Optional TLS Config for use on HTTP connections.
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## HTTP Proxy override, if unset values the standard proxy environment
## variables are consulted to determine which proxy, if any, should be used.
# http_proxy = "http://corporate.proxy:3128"
## Additional HTTP headers
# http_headers = {"X-Special-Header" = "Special-Value"}
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "identity"
## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: "42u". You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false
###############################################################################
# INPUTS #
###############################################################################
# Windows Performance Counters plugin.
# These are the recommended method of monitoring system metrics on windows,
# as the regular system plugins (inputs.cpu, inputs.mem, etc.) rely on WMI,
# which utilize more system resources.
#
# See more configuration examples at:
# https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters
[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"
Instances = ["*"]
Counters = [
"% Idle Time",
"% Interrupt Time",
"% Privileged Time",
"% User Time",
"% Processor Time",
"% DPC Time",
]
Measurement = "win_cpu"
# Set to true to include _Total instance when querying for all (*).
IncludeTotal=true
[[inputs.win_perf_counters.object]]
# Disk times and queues
ObjectName = "LogicalDisk"
Instances = ["*"]
Counters = [
"% Idle Time",
"% Disk Time",
"% Disk Read Time",
"% Disk Write Time",
"Current Disk Queue Length",
"% Free Space",
"Free Megabytes",
]
Measurement = "win_disk"
# Set to true to include _Total instance when querying for all (*).
#IncludeTotal=false
[[inputs.win_perf_counters.object]]
ObjectName = "PhysicalDisk"
Instances = ["*"]
Counters = [
"Disk Read Bytes/sec",
"Disk Write Bytes/sec",
"Current Disk Queue Length",
"Disk Reads/sec",
"Disk Writes/sec",
"% Disk Time",
"% Disk Read Time",
"% Disk Write Time",
]
Measurement = "win_diskio"
[[inputs.win_perf_counters.object]]
ObjectName = "Network Interface"
Instances = ["*"]
Counters = [
"Bytes Received/sec",
"Bytes Sent/sec",
"Packets Received/sec",
"Packets Sent/sec",
"Packets Received Discarded",
"Packets Outbound Discarded",
"Packets Received Errors",
"Packets Outbound Errors",
]
Measurement = "win_net"
[[inputs.win_perf_counters.object]]
ObjectName = "System"
Counters = [
"Context Switches/sec",
"System Calls/sec",
"Processor Queue Length",
"System Up Time",
]
Instances = ["------"]
Measurement = "win_system"
# Set to true to include _Total instance when querying for all (*).
#IncludeTotal=false
[[inputs.win_perf_counters.object]]
# Example query where the Instance portion must be removed to get data back,
# such as from the Memory object.
ObjectName = "Memory"
Counters = [
"Available Bytes",
"Cache Faults/sec",
"Demand Zero Faults/sec",
"Page Faults/sec",
"Pages/sec",
"Transition Faults/sec",
"Pool Nonpaged Bytes",
"Pool Paged Bytes",
"Standby Cache Reserve Bytes",
"Standby Cache Normal Priority Bytes",
"Standby Cache Core Bytes",
]
# Use 6 x - to remove the Instance bit from the query.
Instances = ["------"]
Measurement = "win_mem"
# Set to true to include _Total instance when querying for all (*).
#IncludeTotal=false
[[inputs.win_perf_counters.object]]
# Example query where the Instance portion must be removed to get data back,
# such as from the Paging File object.
ObjectName = "Paging File"
Counters = [
"% Usage",
]
Instances = ["_Total"]
Measurement = "win_swap"
# Windows system plugins using WMI (disabled by default, using
# win_perf_counters over WMI is recommended)
# # Read metrics about cpu usage
# [[inputs.cpu]]
# ## Whether to report per-cpu stats or not
# percpu = true
# ## Whether to report total system cpu stats or not
# totalcpu = true
# ## If true, collect raw CPU time metrics.
# collect_cpu_time = false
# ## If true, compute and report the sum of all non-idle CPU states.
# report_active = false
# # Read metrics about disk usage by mount point
# [[inputs.disk]]
# ## By default stats will be gathered for all mount points.
# ## Set mount_points will restrict the stats to only the specified mount points.
# # mount_points = ["/"]
#
# ## Ignore mount points by filesystem type.
# ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"]
# # Read metrics about disk IO by device
# [[inputs.diskio]]
# ## By default, telegraf will gather stats for all devices including
# ## disk partitions.
# ## Setting devices will restrict the stats to the specified devices.
# # devices = ["sda", "sdb", "vd*"]
# ## Uncomment the following line if you need disk serial numbers.
# # skip_serial_number = false
# #
# ## On systems which support it, device metadata can be added in the form of
# ## tags.
# ## Currently only Linux is supported via udev properties. You can view
# ## available properties for a device by running:
# ## 'udevadm info -q property -n /dev/sda'
# # device_tags = ["ID_FS_TYPE", "ID_FS_USAGE"]
# #
# ## Using the same metadata source as device_tags, you can also customize the
# ## name of the device via templates.
# ## The 'name_templates' parameter is a list of templates to try and apply to
# ## the device. The template may contain variables in the form of '$PROPERTY' or
# ## '${PROPERTY}'. The first template which does not contain any variables not
# ## present for the device is used as the device name tag.
# ## The typical use case is for LVM volumes, to get the VG/LV name instead of
# ## the near-meaningless DM-0 name.
# # name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME"]
# # Read metrics about memory usage
# [[inputs.mem]]
# # no configuration
# # Read metrics about swap memory usage
# [[inputs.swap]]
# # no configuration
Is node-red running on the PC or another machine?
If a different machine are they on the same network?
Node red- running only raspberry PI and no more device or PC doesnt have node red
Are they on the same network?
Assuming they are on the same network then, on the pi, run
sudo tcpdump port 8094
and see if it shows anything. If not then the udp messages are not getting to the pi for some reason. Possibly telegraf is not generating them, or the Windows firewall is stopping them.
If tcpdump is not installed then
sudo apt-get install tcpdump
They both are on the same network.
Pi IP address : 192.168.2.110
PC IP address : 192.168.2.111
Also tcpdump result is this
pi@raspberrypi:~$ sudo tcpdump port 8094
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
So nothing coming through. Either telegraf is not generating them or they are not getting onto the network for some reason, or they are not getting into the Pi. I think you need a telegraf/windows expert, which I am not.
Thanks for your effort and helps OK I wil try to do it.
Recap:
- Telegraf on windows device
- inputs: windows system
- outputs: UDP port on localhost
- Node-RED on windows device
- udp-in node configured to same port as the Telegraf output
- debug node attached to udp-in output
This configuration is working for me and I even tested a different telegraf config file to make sure.
2 notes:
- Most of the windows system inputs for Telegraf require admin rights to run. This shouldn't be an issue when running as a service since services run under the special SYSTEM rights which are admin by definition. If you run Telegraf manually however, you will need to run it from a command prompt with elevated (admin) rights.
- Does the telegraf config file need UNIX line endings? This is a common problem with tooling developed primarily in Linux/Mac. When you edit the file in Notepad++, check the status bar which tells you whether line endings are "LF" or "CRLF". You need them to be "LF" so if they aren't, change that in the edit menu & re-save.
What antivirus are you running on the windows PC ?
What firewall are you running on the windows PC ?
Try using Netstat to ensure you have connections happening
Craig
I am also looking for this.
Looking for data about CPU usage, CPU Temp, Uptime, MB Temp, free disk
Is it https://github.com/eschava/psmqtt thats the answer ?
Well that does need you to run scripts on yet another scripting language (Python). Telegraf works fine for me.
Dear @TotallyInformation I also still didnt succeed it, telegraf also didnt Work for me,
Worked fine setting it up and make influxDB and now changed my .conf file to output to my Mosquitto server.
But how do you work with the messages, mine looks like this:
telegraf/SERVER/win_cpu win_cpu,host=SERVER,instance=5,objectname=Processor Percent_Idle_Time=96.15957641601562,Percent_Interrupt_Time=0,Percent_Privileged_Time=0.6948911547660828,Percent_User_Time=1.0423367023468018,Percent_Processor_Time=1.6729010343551636 1578418420000000000
and:
telegraf/SERVER/win_disk win_disk,host=SERVER,instance=HarddiskVolume2,objectname=LogicalDisk Percent_Idle_Time=99.99114227294922,Percent_Disk_Time=0,Percent_Disk_Read_Time=0,Percent_Disk_Write_Time=0,Current_Disk_Queue_Length=0,Percent_free_space=71.57894897460938,free_megabytes=68 1578418440000000000
You need to set the appropriate output format.
JSON being the most likely I would think.
What you currently have is the default output format which is the InfluxDB Line Protocol.
Could you please share your basic node-red project for looking settings
This is how my conf file on my windows machine looks like now.
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
[[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:9999
urls = ["http://192.168.1.12:9999"]
## Token for authentication.
token = "$INFLUX_TOKEN"
## Organization is the name of the organization you wish to write to; must exist.
organization = "Org.name"
## Destination bucket to write into.
bucket = "bucket"
[[outputs.mqtt]]
## URLs of mqtt brokers
servers = ["192.168.1.12:1883"]
## topic for producer messages
topic_prefix = "telegraf"
## QoS policy for messages
## 0 = at most once
## 1 = at least once
## 2 = exactly once
qos = 2
## username and password to connect MQTT server.
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
## client ID, if not set a random ID is generated
# client_id = ""
## Timeout for write operations. default: 5s
# timeout = "5s"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## When true, metrics will be sent in one MQTT message per flush. Otherwise,
## metrics are written one metric per MQTT message.
# batch = false
## When true, messages will have RETAIN flag set.
# retain = false
## Data format to output.
data_format = "json"
###############################################################################
# INPUT PLUGINS #
###############################################################################
[[inputs.win_perf_counters.object]]
ObjectName = "PhysicalDisk"
Instances = ["*"]
Counters = ["Avg. disk sec/read","Avg. disk sec/write"]
Measurement = "win_disk"
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"
Instances = ["*"]
Counters = ["% Idle Time", "% Interrupt Time", "% Privileged Time", "% User Time", "% Processor Time"]
Measurement = "win_cpu"
IncludeTotal=true #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# Disk times and queues
ObjectName = "LogicalDisk"
Instances = ["*"]
Counters = ["% Idle Time", "% Disk Time","% Disk Read Time", "% Disk Write Time", "% User Time", "Current Disk Queue Length", "% free space", "free megabytes"]
Measurement = "win_disk"
IncludeTotal=true #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
ObjectName = "System"
Counters = ["Context Switches/sec","System Calls/sec", "Processor Queue Length"]
Instances = ["------"]
Measurement = "win_system"
IncludeTotal=true #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# Example query where the Instance portion must be removed to get data back, such as from the Memory object.
ObjectName = "Memory"
Counters = ["Available Bytes","Cache Faults/sec","Demand Zero Faults/sec","Page Faults/sec","Pages/sec","Transition Faults/sec","Pool Nonpaged Bytes","Pool Paged Bytes"]
Instances = ["------"] # Use 6 x - to remove the Instance bit from the query.
Measurement = "win_mem"
IncludeTotal=true #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# more counters for the Network Interface Object can be found at
# https://msdn.microsoft.com/en-us/library/ms803962.aspx
ObjectName = "Network Interface"
Counters = ["Bytes Received/sec","Bytes Sent/sec","Packets Received/sec","Packets Sent/sec","Output queue length"]
Instances = ["*"] # Use 6 x - to remove the Instance bit from the query.
Measurement = "win_net"
IncludeTotal=true #Set to true to include _Total instance when querying for all (*).