Ad Widget

Collapse

adding constant value to macro in key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ccaron
    Junior Member
    • Jan 2025
    • 2

    #1

    adding constant value to macro in key

    Hi,

    Do I have a way to add a constant value to key values in template

    I tried modbus.get[{$ENDPOINT},,3,{?{$REGISTER}+14},1,float,,] and a lot of other options but always receive an error

    Thanks for your help
  • Blevar
    Member
    • Jan 2025
    • 68

    #2
    You cant perform direct aritmethic operations in this case. Try changing the {$REGISTER} value in preprocessing.

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4806

      #3
      Originally posted by Blevar
      You cant perform direct aritmethic operations in this case. Try changing the {$REGISTER} value in preprocessing.
      You cannot really do that either...

      But if you are using user macros, what you define by yourself... why you cannot define correct value right away?

      Comment

      • ccaron
        Junior Member
        • Jan 2025
        • 2

        #4
        Originally posted by cyber

        You cannot really do that either...

        But if you are using user macros, what you define by yourself... why you cannot define correct value right away?
        My m-bus adapter can read up to 500 counters. Each counter use a separate set of 20 registers.

        I can create 20 macro with the address of each register but il will be easier to create one macro for the base address and add an offset for each key
        Last edited by ccaron; 31-01-2025, 18:58.

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4806

          #5
          I guess you could write a JS item that produces json, required for LLD as output and then you can run a discovery on top of that to create all required items.
          Or at least have that file somewhere to be read with vfs.file.content item or something ..

          Comment

          Working...