Ad Widget

Collapse

Oracle custom query with Agent 2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pierreb
    Junior Member
    • Nov 2009
    • 9

    #1

    Oracle custom query with Agent 2

    I specified a directory and created a file that i can query.
    select count(*) from bla.

    The value i get back is however not a number. it returns the number/result but also other things.
    [{"COUNT(*)":"2106"}]
    I would have liked to only return 2106 and/if possible bind "ID" to Units if that is possible.
    select count(*) as "id" from table where id = 55;

    Anyone know how i can solve this?
  • Devon
    Junior Member
    • Feb 2024
    • 1

    #2
    Hello,
    not sure if this can help, but temporary solved my problem ( I have to check the number of records in a table)

    I was able to solve using on the item the type of information=Text and in the corresponding trigger the function trim in order to cut the strings part of the result and obtain the number, like this:
    trim(custom.query.syntaxblabla]),"[{"COUNT(*):}]") >=NUMBER
    Last edited by Devon; 01-02-2024, 18:34.

    Comment

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

      #3
      you get json back... use preprocessing to extract that value (https://www.zabbix.com/documentation..._functionality)

      Comment


      • Devon
        Devon commented
        Editing a comment
        you can use the same function TRIM in preprocessing, or you talks about something else?
    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #4
      Well yea.. you can of course take the value, cut off part of it and you will be left with, what you need...I just wanted to point out other ways are possible also. Also at which point you want to do this... in trigger or in item.

      And please do not use that comment feature.. it makes impossible to quote properly and it looks like I'm talking to myself, at one point noone understands to what this particular answer might refer...

      Comment

      Working...