Ad Widget

Collapse

Convert incoming data from text to float value.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xobnis
    Junior Member
    • Mar 2007
    • 14

    #1

    Convert incoming data from text to float value.

    I have a windows program that probes a server room temperature sensor called sensor_check.exe. The program spits back the following example output to a specified file and to the console.

    Device Model = Temperature Sensor
    Device Status = Normal
    Firmware Version = 3.22
    Number of variables = 3
    Variable 1: TEMPERATURE (0.5 C RESOLUTION) 20 C
    Variable 2: TEMPERATURE (0.1 C RESOLUTION) 19.9 C
    Variable 3: HASH ID 998


    I have created the following check to parse out the Variable2: temperature value of 19.2. Note I added the windows ports of grep and cut.

    UserParameter=system.tempcheck,c:\sensor_check.exe -L tempcheck.log -C COM 1 | grep "TEMPERATURE (0.1" | cut -C:44 -L:4

    The check works fine and from a dos prompt I can enter the following

    c:\>zabbix_agentd -t sytem.tempcheck

    and receive the following response,

    system.tempcheck [t|19.8]

    I can tell from the "t" that the value returned is text but this does not allow me to graph or trend these values. Is there anyway to have the agent or server change or cast this value from text to a double? Alternatively is there a better way of cutting the value out of the returned text or the file that is created?
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Originally posted by xobnis
    system.tempcheck [t|19.8]

    I can tell from the "t" that the value returned is text but this does not allow me to graph or trend these values. Is there anyway to have the agent or server change or cast this value from text to a double? Alternatively is there a better way of cutting the value out of the returned text or the file that is created?
    I believe ZABBIX server will automatically convert this value to numeric.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    Working...