Ad Widget

Collapse

Obtaining values from zabbix database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eleonb94
    Junior Member
    • May 2018
    • 5

    #1

    Obtaining values from zabbix database


    We seek to process monitoring data of some particular items in the database, but filtering by itemid in the Trends or History table tells us that there is no data for that item, however when plotting that item from the zabbix web interface the graphic shows values ​​from quite some time ago, so it must be stored somewhere, but we have not found where it can be. Also there are some items that do have their values ​​in the tables of the database, only they are not the ones that interest us for the work we are doing. Please,any suggestions will be well received.
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2

    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • eleonb94
      Junior Member
      • May 2018
      • 5

      #3
      When trying to make any request it gives us the following error, both when doing it remotely and directly on the server, the version of zabbix that we are using is 3:
      {"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error","data":"Invalid JSON. An error occurred on the server while parsing the JSON text."},"id":null}
      There is a possibility that with this API you will receive the data, even if they do not appear by directly surveying the database?


      Comment

      • eleonb94
        Junior Member
        • May 2018
        • 5

        #4

        Is it possible that the data is in the history-cache and not in the history table of the database? If so, in what way can I obtain the data from that cache to process them?


        Comment

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #5
          Error message is clear.
          Your input json string has some syntax issue(s).
          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
          https://kloczek.wordpress.com/
          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
          My zabbix templates https://github.com/kloczek/zabbix-templates

          Comment

          • eleonb94
            Junior Member
            • May 2018
            • 5

            #6
            Originally posted by kloczek
            Error message is clear.
            Your input json string has some syntax issue(s).

            I don't understand what errors can be, if the syntax is copying directly from the documentation to test the API. {"jsonrpc":"2.0","method":"apiinfo.version","id":1 ,"auth":null,"params":{}}

            Comment

            • kloczek
              Senior Member
              • Jun 2006
              • 1771

              #7
              Code:
              $ curl --silent -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"apiinfo.version","params":{"filter":{"params":[]}},"id":0}' http://localhost/api_jsonrpc.php; echo
              {"jsonrpc":"2.0","result":"3.4.9","id":0}
              $ curl --silent -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"apiinfo.version","params":{"filter":{"params":[]}},"auth":null,"id":0}' http://localhost/api_jsonrpc.php; echo
              {"jsonrpc":"2.0","result":"3.4.9","id":0}
              params must be not the record ("{}"} but the array ("[]").
              Last edited by kloczek; 17-05-2018, 08:59.
              http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
              https://kloczek.wordpress.com/
              zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
              My zabbix templates https://github.com/kloczek/zabbix-templates

              Comment

              • eleonb94
                Junior Member
                • May 2018
                • 5

                #8
                Originally posted by kloczek
                Code:
                $ curl --silent -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"apiinfo.version","params":{"filter":{"params":[]}},"id":0}' http://localhost/api_jsonrpc.php; echo
                {"jsonrpc":"2.0","result":"3.4.9","id":0}
                $ curl --silent -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"apiinfo.version","params":{"filter":{"params":[]}},"auth":null,"id":0}' http://localhost/api_jsonrpc.php; echo
                {"jsonrpc":"2.0","result":"3.4.9","id":0}
                params must be not the record ("{}"} but the array ("[]").
                the syntax error was fixed with that, but now the output of the command gives me: <p>The requested URL /api_jsonrpc.php was not found on this server.</p> it seems that the API is not available on my server

                Comment

                Working...