Ad Widget

Collapse

convert floating point in little endian order

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jvgenderen
    Member
    • Nov 2014
    • 37

    #1

    convert floating point in little endian order

    hi ..
    i need to convert tis value "7D 99 5A 41" in to zabbix that i kan work with it ..
    it is the value of the power supply of an transmitter ..
    the voltage is 13.6volt ..

    a friend told me that it is an floating point value in litle-endian order ..

    any help ;-)

    grt Joost
    Last edited by jvgenderen; 02-03-2015, 15:47.
  • jan.garaj
    Senior Member
    Zabbix Certified Specialist
    • Jan 2010
    • 506

    #2
    Python black box magic code :-):

    Code:
    >>> import binascii, struct
    >>> little_endian_string="7D 99 5A 41"                                             
    >>> float_value = struct.unpack('<f',binascii.unhexlify(big_endian_string.replace(' ','')))[0]
    >>> print "Little Endian String: %s, Float: %s" % (little_endian_string, float_value)  
    Little Endian String: 7D 99 5A 41, Float: 13.6624727249
    Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.
    My DevOps stack: Docker / Kubernetes / Mesos / ECS / Terraform / Elasticsearch / Zabbix / Grafana / Puppet / Ansible / Vagrant

    Comment

    • jvgenderen
      Member
      • Nov 2014
      • 37

      #3
      hi jan ..
      thanks for the formule ;-)

      but my knowledge is a bit limited to implement this ..

      the value is grabbed by means of snmp-read but what is next ??


      grt Joost .

      Comment

      • jan.garaj
        Senior Member
        Zabbix Certified Specialist
        • Jan 2010
        • 506

        #4
        You can't convert/parse metric data on Zabbix server -> server must have float value already. Where do you convert it it's up to you. You can create some script, which will convert it and send it to zabbix-server by zabbix server (IMHO the best solution for you). You can modify your device, SNMP daemon, ....
        Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.
        My DevOps stack: Docker / Kubernetes / Mesos / ECS / Terraform / Elasticsearch / Zabbix / Grafana / Puppet / Ansible / Vagrant

        Comment

        Working...