Ad Widget

Collapse

Get Integer value from a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RadicalEd
    Junior Member
    • Nov 2017
    • 16

    #1

    Get Integer value from a file

    Hi,

    I'm currently trying to get an integer value from a file. In my situation I have a file which contents nothing more as a number. The problem is that this value is always handled as a string and I didn't found a way to convert it into an integer value. Pre-Processing didn't gave me an option to covert or manipulate it.
    Also I've searched through the board and the only ideas that I found was to create custom commands (simply cat the file). For me this is more a workaround as a real solution for the problem. I have multiple hosts where I need to read out such files and I don't really want to create a custom command on each host. Also I would have to repeat this step if the file location change or if i want to add an additional item.

    Is there maybe now a solution for this problem as the threads that I've read through where pretty old (+5 years)? An other idea that I had was to manipulate the script which creates these files to use zabbix_sender. But the non existing security checks for zabbix_sender let me drop this idea.
  • RadicalEd
    Junior Member
    • Nov 2017
    • 16

    #2
    The topic can be closed. My problem was that vfs.file.contents returned a string instead of an integer. I thought that this was a default behaviour but instead it was a control character which caused the Zabbix Agent to return a string.

    Comment

    Working...