Telegraf: Input - Windows Performance Counters: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
 
(3 dazwischenliegende Versionen des gleichen Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
 
 
== Error ==
 
== Error ==
 
'''E! [telegraf] Error running agent: Error loading config file <PATH_TO_YOUR_CONFIG>.conf: Error parsing data: line x: table `inputs.win_perf_counters.tags' is in conflict with table in line x'''
 
'''E! [telegraf] Error running agent: Error loading config file <PATH_TO_YOUR_CONFIG>.conf: Error parsing data: line x: table `inputs.win_perf_counters.tags' is in conflict with table in line x'''
Zeile 6: Zeile 4:
  
 
== Cause ==
 
== Cause ==
''This is because of an syntax error. You will setting two different tags on the same win_perf_stanza (<code>[[inputs.win_perf_counters]]</code>).'' <br>
+
''This is because of an syntax error. You will setting two different tags on the same win_perf_stanza (<nowiki>[[inputs.win_perf_counters]]</nowiki>).'' <br>
''In the Telegraf input plugin "win_perf_counters" you cannot set the tags under the [[inputs.win_perf_counters.'''object''']] stanza.'' <br>
+
''In the Telegraf input plugin "win_perf_counters" you cannot set the tags under the <nowiki>[[inputs.win_perf_counters.object]]</nowiki> stanza (object stanza).'' <br>
''You have to set the tags under the [[inputs.win_perf_counters]] stanza and cannot define it twice like the following image:'' <br>
+
''You have to set the tags under the <nowiki>[[inputs.win_perf_counters]]</nowiki> stanza and cannot define it twice like the following image:'' <br>
 
[[Datei:01-telegraf win perf counters wrong tag.png]]
 
[[Datei:01-telegraf win perf counters wrong tag.png]]
  
  
 
== Solution ==
 
== Solution ==
*Create a new [[inputs.win_perf_counters]] stanza foreach input that should have different tags. Like this: <br>
+
*Because the tags are defined under <nowiki>[[inputs.win_perf_counters]]</nowiki> I recommend you to move the tag definiton direct to the stanza definition.
 
+
*Create a new <nowiki>[[inputs.win_perf_counters]]</nowiki> stanza foreach input that should have different tags. Like the following example. <br>
 
+
 
+
 
+
 
+
  
 +
'''Example'''
 +
''In the following example it makes no sense to collect the same Performance Counter twice, but it is only to show how it is working with tags.''
 +
<pre>
 
[[inputs.win_perf_counters]]
 
[[inputs.win_perf_counters]]
 +
  [inputs.win_perf_counters.tags]
 +
    TestTag = "testvalue1"
 
   [[inputs.win_perf_counters.object]]
 
   [[inputs.win_perf_counters.object]]
 
     ObjectName = "Hyper-V Hypervisor Virtual Processor"
 
     ObjectName = "Hyper-V Hypervisor Virtual Processor"
Zeile 28: Zeile 27:
 
     ]
 
     ]
 
     Measurement = "hyperv_vm_hypercalls_demo"
 
     Measurement = "hyperv_vm_hypercalls_demo"
[inputs.win_perf_counters.tags]
+
   
      TestTag = "testvalue1"
+
  
 
[[inputs.win_perf_counters]]
 
[[inputs.win_perf_counters]]
 +
  [inputs.win_perf_counters.tags]
 +
    TestTag = "testvalue2"
 
   [[inputs.win_perf_counters.object]]
 
   [[inputs.win_perf_counters.object]]
 
     ObjectName = "Hyper-V Hypervisor Virtual Processor"
 
     ObjectName = "Hyper-V Hypervisor Virtual Processor"
Zeile 39: Zeile 39:
 
     ]
 
     ]
 
     Measurement = "hyperv_vm_hypercalls_demo"
 
     Measurement = "hyperv_vm_hypercalls_demo"
[inputs.win_perf_counters.tags]
+
</pre>
      TestTag = "testvalue2"
+
  
  

Aktuelle Version vom 8. Februar 2022, 08:53 Uhr

Error

E! [telegraf] Error running agent: Error loading config file <PATH_TO_YOUR_CONFIG>.conf: Error parsing data: line x: table `inputs.win_perf_counters.tags' is in conflict with table in line x


Cause

This is because of an syntax error. You will setting two different tags on the same win_perf_stanza ([[inputs.win_perf_counters]]).
In the Telegraf input plugin "win_perf_counters" you cannot set the tags under the [[inputs.win_perf_counters.object]] stanza (object stanza).
You have to set the tags under the [[inputs.win_perf_counters]] stanza and cannot define it twice like the following image:
01-telegraf win perf counters wrong tag.png


Solution

  • Because the tags are defined under [[inputs.win_perf_counters]] I recommend you to move the tag definiton direct to the stanza definition.
  • Create a new [[inputs.win_perf_counters]] stanza foreach input that should have different tags. Like the following example.

Example In the following example it makes no sense to collect the same Performance Counter twice, but it is only to show how it is working with tags.

[[inputs.win_perf_counters]]
  [inputs.win_perf_counters.tags]
    TestTag = "testvalue1"
  [[inputs.win_perf_counters.object]]
    ObjectName = "Hyper-V Hypervisor Virtual Processor"
    Instances = ["*"]
    Counters = [
      "Hypercalls/sec",
    ]
    Measurement = "hyperv_vm_hypercalls_demo"
    

[[inputs.win_perf_counters]]
  [inputs.win_perf_counters.tags]
    TestTag = "testvalue2"
  [[inputs.win_perf_counters.object]]
    ObjectName = "Hyper-V Hypervisor Virtual Processor"
    Instances = ["*"]
    Counters = [
      "Hypercalls/sec",
    ]
    Measurement = "hyperv_vm_hypercalls_demo"