Coder Social home page Coder Social logo

Comments (20)

srebhan avatar srebhan commented on May 20, 2024 1

@powersj the problem here is that the plugin wants to be too clever as it will detect enabled and disabled strings and convert them to booleans. However, there are multiple non-binary strings also containing other things like muted... So again auto-typing bites us. :-(

The correct way would be to not do any auto-type conversions for strings, but this certainly breaks backward compatibility...

@masterwishx you might use the enum processor to convert the value. Here an untested suggestion

[[processors.enum]]
  [[processors.enum.mapping]]
    field = "ups_beeper_status"
    default = false
    [processors.enum.mapping.value_mappings]
      enabled = true
      disabled = false
      muted = false

from telegraf.

srebhan avatar srebhan commented on May 20, 2024 1

@masterwishx we will discuss this with the team to see what's the best way forward... Will come back to you next week.

from telegraf.

srebhan avatar srebhan commented on May 20, 2024 1

@masterwishx we discussed within the team and think the best way forward is to document the current behavior including an example of how to convert back the booleans to strings using the enum processor.

The reason for not trying to "solve" it in code is because the issue comes from the underlying library that is out of our control. Even if we are trying to be smart and convert the booleans back to strings we will break existing users. So there is really nothing we can do here. :-(

from telegraf.

srebhan avatar srebhan commented on May 20, 2024 1

@masterwishx please check if the documentation in #14938 is comprehensible! :-)

from telegraf.

powersj avatar powersj commented on May 20, 2024 1

So if influxdata has already written the value as a boolean, then you need to continue to pass it as a boolean.

from telegraf.

srebhan avatar srebhan commented on May 20, 2024 1

@masterwishx or you convert / drop the existing series containing the booleans...

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024 1

@masterwishx or you convert / drop the existing series containing the booleans...

Sure , i made new bucket ,working fine . also will try maybe to convert/drop old data ...

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

from https://networkupstools.org/docs/developer-guide.chunked/apas02.html
image

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

it seems error appear when muted instead of enabled or disabled

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

@srebhan @powersj can you please check this out ....

from telegraf.

powersj avatar powersj commented on May 20, 2024

I did not think we did any transformation of enabled/disabled to true or false. Were you using another collector before?

@masterwishx can you set dump_raw_variables = false please I want to see an entry with both a disabled/enabled and one with muted.

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

I did not think we did any transformation of enabled/disabled to true or false. Were you using another collector before?

@masterwishx can you set dump_raw_variables = false please I want to see an entry with both a disabled/enabled and one with muted.

Do you mean to test on windows? I was tested on windows befor...
I can check disabled/muted enabled somehow not working for me now becose of some kind of bug in upsd, when I set enabled it's goes to mute value but in real the sound is working so it's enabled

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

@powersj

disabled:

image

image

mute:

image

image

from telegraf.

powersj avatar powersj commented on May 20, 2024

In line protocol false and true are booleans, not strings. As a result, your very first value was probably either false or true and InfluxDB went "that's a boolean". Then you sent a "muted" string, which InfluxDB rejects becuase of the type conflict.

My suggestion is for you to is to use a processor in telegraf to convert the values to booleans, and/or drop your data and use a processor to convert them all to strings. For the first, you could use the strings processor to match on "muted" and change it to true/false.

@srebhan any other thoughts?

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

In line protocol false and true are booleans, not strings. As a result, your very first value was probably either false or true and InfluxDB went "that's a boolean". Then you sent a "muted" string, which InfluxDB rejects becuase of the type conflict.

My suggestion is for you to is to use a processor in telegraf to convert the values to booleans, and/or drop your data and use a processor to convert them all to strings. For the first, you could use the strings processor to match on "muted" and change it to true/false.

@srebhan any other thoughts?

can you give an example for it please?

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

@powersj @srebhan this should be as global variable? like this or inside the [[inputs.upsd]] ?

image

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

@powersj the problem here is that the plugin wants to be too clever as it will detect enabled and disabled strings and convert them to booleans. However, there are multiple non-binary strings also containing other things like muted... So again auto-typing bites us. :-(

The correct way would be to not do any auto-type conversions for strings, but this certainly breaks backward compatibility...

@masterwishx you might use the enum processor to convert the value. Here an untested suggestion

[[processors.enum]]
  [[processors.enum.mapping]]
    field = "ups_beeper_status"
    default = false
    [processors.enum.mapping.value_mappings]
      enabled = true
      disabled = false
      muted = false

Yes , This Working fine ... but if it possible to convert to string like : enabled ,disabled,muted ?

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

@masterwishx please check if the documentation in #14938 is comprehensible! :-)

Working Fine ,Thanks

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

@srebhan @powersj its not working in 1.29.5 ?

from telegraf.

masterwishx avatar masterwishx commented on May 20, 2024

image

from telegraf.

Related Issues (20)

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.