Code Monkey home page Code Monkey logo

influxer's Introduction

Influxer

A C# console application to parse log files (currently only Windows Perfmon format) and push data to Influx for later visualization. It uses InfluxDB.Client.Net to interact with Influx.

InfluxDB is a very nice time series database, and is supported by many data visualizers (mainly grafana). But if you have other tools which are producing the data in csv format (mainly PerfMon in windows, or enterprise reporting tools) which are not designed for Influx era, you will have to develop own tools to pull from one tool and to push to other.

Meet Influxer, a small C# console application, which will take any text files with time series and upload it to any Influx instance. It has special handling for Microsoft Windows Perfmon file format. It can be configured (via command line or by configuration files) to handle any type of text files.

Steps to generate configuration file
  1. Find out the time format for the input file
  2. Run the Influxer with -timeformat -input /export /autolayout
  3. Once you see the configuration output on screen, rerun with output redirect (> somefile) to save the configuration

Build Status

Build status

 	Supported command line arguments
--help /? or /help  shows this help text


/export to print possible config section, pipe it to a file to edit and reuse the config

-config <configuration file path> to load the config file.

Any configuration entries can be overridden by command line switches shown below

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Required flags
-format <format>                                        Input file format. Supported: Perfmon, Generic                                                      -input <file name>                                  Input file name                                                                                     ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
InfluxDB related flags
-dbName <name>                                          Influx database Name, will be created if not present                                                     Default:InfluxerDB
-influx <Url>                                           Influx DB Url including port                                                                             Default:http://localhost:8086
-table <table name>                                     Measurement name in InfluxDB                                                                             Default:InfluxerData
-pass <password>                                        Password for InfluxDB
-batch <number of points>                               No of points to send to InfluxDB in one request                                                          Default:128
-retentionDuration <number of minutes>                  No of minutes that the data will be retained by InfluxDB, if noneof the plcies match, a new one will be created
-retention <policy name>                                Name of the InfluxDB retention policy where the taget measurements will be created. RetentionDuration takes precedence over this
-uname <username>                                       User name for InfluxDB
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Perfmon file format related flags
-columns <column list>                                  Comma seperated list of Columns to import                                                                Default:
-splitter <regex>                                       RegEx used for splitting rows into columns                                                               Default:,(?=(?:[^"]*"[^"]*")*[^"]*$)
-tags <tag=value,tag2=value>                            Tags to be passed with every value,Comma seperated key value pairs                                       Default:
-filter <filter>                                        Filter input data file, Supported:Measurement (import preexisting measurements), Field (import preexisting fields), Columns (import specified columns)   Default:
-MultiMeasurements                                      Push each Performance counter into their own Measurements                                                Default:
-Precision <precision>                                  Supported:Hours<1>,Minutes<2>,Seconds<3>,MilliSeconds<4>,MicroSeconds<5>,NanoSeconds<6>                  Default:Seconds
-TimeFormat <format>                                    Time format used in input files                                                                          Default:MM/dd/yyyy HH:mm:ss.fff
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Generic delimited file format related flags
-ignore <char>                                          Lines starting with <char> are considered as comments, and ignored
-noheader                                               Input file does not have column headers, configuration file should provide a column header mapping       Default:
-header <Row No>                                        Indicates which row to use to get column headers                                                         Default:1
-ignoreerrors                                           Ignore too many errors due to invalid data or config file                                                Default:
-skip <Row No>                                          Indicates how may roaws should be skipped after header row to get data rows                              Default:
-timetype <type>                                        Type of Time format used in input files, String, Epoch or Binary                                         Default:String
-utcoffset <No of Minutes>                              Offset in minutes to UTC, each line in input will be adjusted to arrive time in UTC                      Default:
-validate <No of Rows>                                  Validates n rows for consistent column data types                                                        Default:10
-columns <column list>                                  Comma seperated list of Columns to import                                                                Default:
-splitter <regex>                                       RegEx used for splitting rows into columns                                                               Default:,(?=(?:[^"]*"[^"]*")*[^"]*$)
-tags <tag=value,tag2=value>                            Tags to be passed with every value,Comma seperated key value pairs                                       Default:
-filter <filter>                                        Filter input data file, Supported:Measurement (import preexisting measurements), Field (import preexisting fields), Columns (import specified columns)   Default:
-MultiMeasurements                                      Push each Performance counter into their own Measurements                                                Default:
-Precision <precision>                                  Supported:Hours<1>,Minutes<2>,Seconds<3>,MilliSeconds<4>,MicroSeconds<5>,NanoSeconds<6>                  Default:Seconds
-TimeFormat <format>                                    Time format used in input files                                                                          Default:MM/dd/yyyy HH:mm:ss.fff

influxer's People

Contributors

mvadu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

influxer's Issues

Same name for field and tag is not valid

Currently Influxer just read column by column, and tries to convert each cell into a double. If that fails, that cell is treated as a tag value. It does not have any idea on which columns were treated as tag columns and field column in previous rows of the same file. This is fine as long as all column values are consistent across all rows.

However if for some reason a given column has textual values as well as numeric values, it will lead to a measurement in InfluxDB with same name for field and tag. Influx does not reject the write, but will cause issues in querying #3783. Influxer should be able to scan first couple of rows (10-25) to get an idea on column types, and throw an error if any inconsistencies found within those rows or any future rows which are not matching the initial pattern.

All textual output is sent to stdout

Everything that the program outputs is going to stdout. This makes autopilot installations a pain, since if we pipe the stdout to a file, the progress messages quickly fill the whole thing!

Issues with arguments

Trying to print possible config section fails: Influxer.exe /export
   Error processing arguments NullReferenceException: Object reference not set to an instance of an object.

Trying to add some parameters fails i.e.: Influxer.exe -uname test
   Error processing arguments :ArgumentException, Invalid commandline arguments!! Use /help to see valid ones

Trying to add some more parameters fails i.e.: Influxer.exe -format Perfmon -input \Bench\Test01.csv -influx http://192.168.1.7:8086 -dbName Perfmon -uname test
   Unknown command line arguments: -influx, -dbname, -uname

Support for Epoch and Binary time formats

Currently Influxer supports only string time formats, which can be parsed by ParseExact method. Idea is to support Epoch (with a varying precision) and Binary(A 64-bit signed integer that encodes the Kind property in a 2-bit field and the Ticks property in a 62-bit field.) types.

'Can't parse as Number' error

I have a case when influxDB 1.7.8-1 and Influxer latest version couldn't parse the data from CSV and fails with the following error:

d:\Downloads\Grafana\InfluxerLatest>Influxer.exe -input "MP_DataCollector.csv"
Failed to process d:\Downloads\Grafana\InfluxerLatest\MP_DataCollector.csv
Error!! InvalidDataException:\SCOM2016\Process_wmiprvse__Processor_Time has inconsistent data, Can't parse 0.15612238088219549 as Number - at AdysTech.Influxer.GenericFile.ValidateData(String InputFileName) in C:\projects\influxer\Influxer\GenericFile.cs:line 497
at AdysTech.Influxer.GenericFile.d__13.MoveNext() in C:\projects\influxer\Influxer\GenericFile.cs:line 245
Finished!! Processed 0 points (Success: 0, Failed:0) in 00:00:00.4922178

It looks like some kind of incompatibility on my PC because on the other PC everything went well with the same CSV file.
Could you please take a look at this error?

Download link broken

Hi,
I tried to download latest version and I got error message:
The specified blob does not exist.

Do you know where can be a problem?
Thanks,
Jan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.