Skip to content

Turbostat input plugin #16866

Open
Open
@marcv81

Description

@marcv81

Use Case

Turbostat is a widely available Linux CLI utility. It displays processor statistics, such as core frequency and power consumption. It is compatible with all recent Intel and AMD processors. Ref: https://manpages.ubuntu.com/manpages/xenial/man8/turbostat.8.html. A Telegraf input plugin to collect these metrics would be nice!

Sample output.

Core	CPU	Avg_MHz	Busy%	Bzy_MHz	TSC_MHz	IPC	IRQ	POLL	C1	C2	C3	POLL%	C1%	C2%	C3%	CorWatt	PkgWatt
-	-	22	0.63	3479	3793	0.79	17901	796	1982	6328	9767	0.04	0.12	3.47	95.87	0.58	23.34
0	0	20	0.61	3282	3793	1.39	1135	33	194	497	513	0.02	0.20	3.81	95.45	0.04	23.34
0	8	5	0.17	2845	3793	0.41	299	3	8	66	219	0.00	0.01	0.61	99.26
1	1	87	2.25	3872	3793	0.72	2031	92	91	767	952	0.07	0.37	7.22	90.28	0.11
1	9	23	0.60	3794	3793	0.85	796	45	12	263	443	0.03	0.01	2.47	96.99
2	2	24	0.68	3468	3793	0.61	2113	98	74	1031	898	0.07	0.23	8.87	90.36	0.10
2	10	9	0.25	3371	3793	0.54	827	41	14	288	479	0.03	0.03	3.02	96.77
3	3	23	0.73	3194	3793	0.64	1748	75	59	707	887	0.05	0.17	5.89	93.34	0.07
3	11	17	0.51	3406	3793	1.29	759	6	18	212	481	0.00	0.06	1.37	98.14
4	4	30	0.82	3688	3793	0.99	2471	211	76	852	1303	0.16	0.13	7.15	92.06	0.12
4	12	17	0.48	3534	3793	1.71	697	7	19	226	420	0.01	0.07	2.02	97.50
5	5	28	0.81	3465	3793	0.57	1261	47	84	374	760	0.03	0.33	3.65	95.30	0.08
5	13	34	1.07	3200	3793	0.41	1425	82	1255	487	799	0.06	0.30	4.36	94.40
6	6	8	0.31	2722	3793	0.78	811	21	44	130	615	0.01	0.03	1.28	98.45	0.03
6	14	9	0.28	3044	3793	0.41	754	19	5	179	534	0.01	0.00	1.50	98.28
7	7	7	0.23	2868	3793	0.48	567	5	19	189	353	0.00	0.03	1.55	98.25	0.03
7	15	9	0.24	3636	3793	0.59	207	11	10	60	111	0.01	0.01	0.67	99.10

Expected behavior

An input plugin captures all the metrics that Turbostat displays on stdout. CPU and Core are tags, the other values are fields.

Actual behavior

Not implemented.

Additional info

As a proof of concept, I wrote an external plugin: https://github.com/marcv81/turbostat-telegraf-plugin. It uses the shim, so it should be relatively easy to convert to an internal plugin.

Questions

  1. Are we interested in such a feature?
  2. Should we prefer and internal or an external plugin? I can prepare a PR either way.
  3. The proof of concept is a service input plugin, which I understand is discouraged. Start() forks Turbostat which streams stats to stdout at regular intervals. Start() also starts long-lived goroutines which process stdout/stderr. I believe a service input plugin is appropriate in this case, but I'm happy to discuss. We could instead fork Turbostat at regular intervals, but forking and initialising Turbostat each time would be wasteful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions