Newbee: Installed telegraf and enabled inputs.mem but cannot read total memory

Dear all,

I am new to influxdb and telegraf and need your help please.
I installed telegraf on my Windows machine. Basically it works well so far.
I can read and and monitor cpu utilization etc. using grafana.
My problem now is I want to obtain total memory and available memory of my windows machine.
I enabled [[inputs.mem]] in influxdb.conf and restarted the telegraf service.
But there is no difference.

Where please I can get total memory and available memory now from?
influxdb still just shows the measurements win_cpu, win_disk, wind_diskio, win_mem, etc.
win_mem does not show total memory and available memory.

So please how to get total memory and available memory and grab it by grafana?

Thanks a lot…

Hi,

In the win_mem config setting there is an additional option commented out by default

 [[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=false #Set to true to include _Total instance when querying for all (*).

Change the line #IncludeTotal=false to

IncludeTotal=true

Windows Perofmance Counters examples

You can provide other memory based counters by checking the available perf mon metrics on your windows machine.

My config:

 [[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",
       "Available MBytes",
       "Cache Faults/sec",
       "Demand Zero Faults/sec",
       "Page Faults/sec",
       "Pages/sec",
       "Transition Faults/sec",
       "Pool Nonpaged Bytes",
       "Pool Paged Bytes",
       "Pages Input/sec",
       "% Committed Bytes In Use"
     ]
     # 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=true

Hope that helps

1 Like

There are two different input plugins that you can use for Windows monitoring.
Either the plugin inputs.win_perf_counters described above by @philb or the simpler plugin inputs.mem mentioned by you.

The plugin inputs.win_perf_counters is a bit more extensive and complicated in terms of configuration.

If you enabled the plugin [[inputs.mem]] in your Telegraf config, you should see in InfluxDB (if you select the right bucket):

A measurement mem with the following fields:

  • available
  • available_percent
  • total
  • used
  • used_percent

Hi,

thanks for reply.
@philb: How do I know the available perf mon metrics on my windows machine?
@Franky1: if you select the right bucket - What does that mean please?

You can have several buckets in one InfluxDB 2.0.
If you send the data from Telegraf to an InfluxDB 2.0, you have to specify a bucket.
For a query in InfluxDB or Grafana, of course, the correct bucket must be specified.
I just wanted to express that.

I am not an expert in Windows system monitoring.
But you can display the possible performance counters.
Open a console and run the command typeperf -q
Or write them to a file with typeperf -q > counters.txt
However, the output names seem to depend on the language set in Windows.
So this might not match the settings in Telegraf.

Hi Franky,

thanks again, previously I was on influxdb 1.8.4. Now I migrated to 2.0.4 but since a lot is different I have a problem.
I created a new config using the web based UI. This config I put inside the telegraf folder of my windows machine to measure. I also created a token and set environment variable INFLUX_TOKEN accordingly. Then I restarted the telegraf windows service. So far no problem.
In the UI I can see the bucket but not the measurements I set in the config file:

It seems to me no data is written into influxdb.
How do I get the memory metrics from inputs.mem now?
What metrics are available under inputs.mem for a windows machine?

Yes that could be.

  • Does your TOKEN have write permissions for this bucket? This is a common error.
  • Furthermore please use debug option in Telegraf and check the Telegraf log for error messages.

Hi Franky,

I just copied the token out of the UI - so don’t know if it has write permissions.
Anyway I could get one step ahead.
I got a command from the UI to run telegraf using powershell:

./telegraf --config http://172.29.111.222:8086/api/v2/telegrafs/123456789012345

This works now.
But for influxdb 1.x I used a windows service to run telegraf.
And if I exit powershell and start the service then I do not get any more data.

I am not familiar with influxdb 2.0, what does this parameter mean?:

–config http://172.29.111.222:8086/api/v2/telegrafs/123456789012345

Is there any way to get telegraf and influxdb working together using my windows service again?

This way Telegraf loads the config file directly from the InfluxDB instance instead of a local config file.
Hm, this works, but in my opinion not a solution for productive use.
I would stick to getting the config from a local file:

telegraf.exe --config telegraf.conf

But the local config file must of course have the correct entries. Best is to copy the generated config snippets from the GUI into the local config.

https://docs.influxdata.com/telegraf/v1.17/administration/windows_service/

Thanks ,

copying the config file from the UI and creating a telegraf.conf worked!