Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a math processor plugin #3709

Closed
rakshith-b91 opened this issue Jan 22, 2018 · 5 comments · Fixed by #7660
Closed

Create a math processor plugin #3709

rakshith-b91 opened this issue Jan 22, 2018 · 5 comments · Fixed by #7660
Labels
feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@rakshith-b91
Copy link

rakshith-b91 commented Jan 22, 2018

Bug report

As of now conversion supports only float, can we do the same for divide and multiply the data before output.

Steps to reproduce:

  1. Run telegraf conf with snmp input plugin, the output of timestamp is given in timeticks, we need to divide it by 6000 to get in minutes, we are not able do any conversion other than float in snmp plugin.
@danielnelson
Copy link
Contributor

I think the solution to this would be a processor that can do mathematical operations, this is lightly discussed in #2667 (comment). In the meantime you should be able to do this conversion on query.

@danielnelson danielnelson added the feature request Requests for new plugin and for new features to existing plugins label Jan 26, 2018
@danielnelson danielnelson changed the title telegraf data conversion in snmp plugin Create a math processor plugin Jan 26, 2018
@cruscio
Copy link
Contributor

cruscio commented Jan 8, 2019

Additional use case - Calculating % of total CPU utilization of a Windows process.

Windows Perfmon provides process-level CPU utilization in Process\% Processor Time: The sum of processor time on each processor. This needs to be multiplied by the number of logical CPU cores to get a % of total CPU used by a process. ([Process(x)\% Processor Time] * ([Logical CPU Cores] * 100)) * 100. It'd be ideal to perform this calculation locally at time of collection.

@sslupsky
Copy link

sslupsky commented Mar 8, 2019

Another use case: Merging two fields/tags into one. For instance, the high byte and low byte of a 16 bit integer. ie: result = high_byte * 256 + low_byte.

@simoelmou
Copy link

simoelmou commented Apr 14, 2019

This type of mathematical processing would be very useful in the case of the use of some types of time series databases such as OpenTSDB which doesn't support a lot of aggregation expressions, and it'll help to calculate SLAs as an option.

@TimurDela
Copy link
Contributor

Unit conversions can be done in queries because they always use the exact same operation but mathematical operations that may change in time cannot be done after the data has been logged.
For instance, I have a device that provides analogue signals (always between 4 and 20mA).
Initially, I set it so that 4mA means 0kW and 20mA means 1000kW.
After a while, I realise that my power never drops below 10kW nor exceeds 20kW so in order to increase the precision of the measurement, I set my device so that 4mA means 10kW and 20mA means 20kW.
Logging the analogue signal in mA is meaningless, I want Telegraf to directly log the quantity I am interested, without having to change all my queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants