Ad Widget

Collapse

how to get lastest value from mysql?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • heimouren
    Junior Member
    • Nov 2014
    • 7

    #1

    how to get lastest value from mysql?

    I am a newer.
    I configured a item,I want to get lastest value from mysql.
    I don't know how to get the value.
    some one help me.
    I use the zabbix version that is 2.4.0.
  • tchjts1
    Senior Member
    • May 2008
    • 1605

    #2
    Why would you want to get it from MySql?
    Instead, go to Monitoring --> Latest Data and click on the "Graph" link all the way out to the right for your specific item. After the graph comes up, you can change the upper right dropdown box from "Graph" to Latest Values"

    Comment

    • heimouren
      Junior Member
      • Nov 2014
      • 7

      #3
      Originally posted by tchjts1
      Why would you want to get it from MySql?
      Instead, go to Monitoring --> Latest Data and click on the "Graph" link all the way out to the right for your specific item. After the graph comes up, you can change the upper right dropdown box from "Graph" to Latest Values"
      I want to show the latest data in map.and I have integrated with google map.
      so I want to get the latest Data from mysql

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        The short answer - for the map you can use the structure:
        Code:
        {hostname:itemname.last(0)}
        Please, feel free to use the real Hostname and the real Itemname in the theoretical structure.
        Sincerely yours,
        Aleksey

        Comment

        • heimouren
          Junior Member
          • Nov 2014
          • 7

          #5
          Originally posted by aib
          The short answer - for the map you can use the structure:
          Code:
          {hostname:itemname.last(0)}
          Please, feel free to use the real Hostname and the real Itemname in the theoretical structure.
          you don't understand what I mean.
          you give the expression that is not I want.



          you can see the picture above.

          so you will understand.

          I want to show infos in google map.

          some one help me!!!!

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            OK

            You cannot describe what you want - because of that I use the general answer.

            1) You would like to "show infos on the graph". Which kind of "infos" ? CPU idle time? CPU user time? Free space on C: drive? Free inodes on \ ?
            Be more precise and ask a smart question

            For example, to show information about CPU Load for CDN-5 on Zabbix map, you can use expression:
            Code:
            {cnd-5:system.cpu.util[,idle].last(0)}
            2) About Google maps integration. In the topic https://www.zabbix.com/forum/showthread.php?t=14434 it was requested 5 years ago. Is still not finished. You can ask the developers team to pay more attention for that, but nobody can guarantee that it will be done soon.

            Sorry, I cannot really help you.
            Sincerely yours,
            Aleksey

            Comment

            • heimouren
              Junior Member
              • Nov 2014
              • 7

              #7
              Originally posted by aib
              OK

              You cannot describe what you want - because of that I use the general answer.

              1) You would like to "show infos on the graph". Which kind of "infos" ? CPU idle time? CPU user time? Free space on C: drive? Free inodes on \ ?
              Be more precise and ask a smart question

              For example, to show information about CPU Load for CDN-5 on Zabbix map, you can use expression:
              Code:
              {cnd-5:system.cpu.util[,idle].last(0)}
              2) About Google maps integration. In the topic https://www.zabbix.com/forum/showthread.php?t=14434 it was requested 5 years ago. Is still not finished. You can ask the developers team to pay more attention for that, but nobody can guarantee that it will be done soon.

              Sorry, I cannot really help you.

              first of all,thank you for your reply.
              I just want to know how to get the specify item latest data from mysql.
              If I get that I will know how to show infos in google map.
              In mysql there is a table named history_uint,some items that there are no datas in this table.I know there is relation between items , history* and trend*.
              But I don't know how.
              Last edited by heimouren; 18-11-2014, 18:15.

              Comment

              • aib
                Senior Member
                • Jan 2014
                • 1615

                #8
                Try to use Zabbix API

                and API Libraries
                Join the friendly and open Zabbix community on our forums and social media platforms.

                I hope it helps.
                Sincerely yours,
                Aleksey

                Comment

                • heimouren
                  Junior Member
                  • Nov 2014
                  • 7

                  #9
                  Originally posted by aib
                  Try to use Zabbix API

                  and API Libraries
                  Join the friendly and open Zabbix community on our forums and social media platforms.

                  I hope it helps.
                  I use api to get the latest value.
                  for example,
                  request:

                  Code:
                  { "jsonrpc": "2.0", "method": "history.get", "params": { "output": "extend", "history": 0, "itemids": "23985", "sortfield": "clock", "sortorder": "DESC", "limit": 10 }, "auth": "a4fa1a7d7db775ec975df2fcb9daa876", "id": 32 }
                  result:

                  Code:
                  { "jsonrpc": "2.0", "method": "history.get", "params": { "output": "extend", "history": 0, "itemids": "23985", "sortfield": "clock", "sortorder": "DESC", "limit": 10 }, "auth": "a4fa1a7d7db775ec975df2fcb9daa876", "id": 32 }
                  
                  array(3) { ["jsonrpc"]=> string(3) "2.0" ["result"]=> array(0) { } ["id"]=> int(32) }
                  no result.

                  but this request return result,
                  request:
                  Code:
                  { "jsonrpc": "2.0", "method": "history.get", "params": { "output": "extend", "history": 0, "itemids": "23698", "sortfield": "clock", "sortorder": "DESC", "limit": 10 }, "auth": "872d494bdd4c1249c2ca56f2129927ff", "id": 2 }
                  result:
                  Code:
                  array(3) { ["jsonrpc"]=> string(3) "2.0" ["result"]=> array(10) { [0]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416369358" ["value"]=> string(6) "0.1212" ["ns"]=> string(9) "608058291" } [1]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416369298" ["value"]=> string(6) "0.2465" ["ns"]=> string(9) "568117856" } [2]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416369238" ["value"]=> string(6) "0.0627" ["ns"]=> string(9) "649285866" } [3]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416369178" ["value"]=> string(6) "0.0835" ["ns"]=> string(9) "655900119" } [4]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416369118" ["value"]=> string(6) "0.0502" ["ns"]=> string(9) "798489016" } [5]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416369058" ["value"]=> string(6) "0.0251" ["ns"]=> string(9) "986785041" } [6]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416368998" ["value"]=> string(6) "0.0711" ["ns"]=> string(9) "488228193" } [7]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416368938" ["value"]=> string(6) "0.0376" ["ns"]=> string(9) "945367472" } [8]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416368879" ["value"]=> string(6) "0.0418" ["ns"]=> string(8) "13008726" } [9]=> array(4) { ["itemid"]=> string(5) "23698" ["clock"]=> string(10) "1416368818" ["value"]=> string(6) "0.0418" ["ns"]=> string(9) "425590063" } } ["id"]=> int(2) }

                  I found that their value_types are different.

                  Code:
                  mysql> select value_type from items where itemid in('23698','23985'); 
                  +------------+
                  | value_type |
                  +------------+
                  |          0 |
                  |          3 |
                  +------------+
                  why?
                  Last edited by heimouren; 19-11-2014, 06:07.

                  Comment

                  • Colttt
                    Senior Member
                    Zabbix Certified Specialist
                    • Mar 2009
                    • 878

                    #10
                    maybe you want something like this: https://support.zabbix.com/browse/ZBXNEXT-1332 ?
                    Debian-User

                    Sorry for my bad english

                    Comment

                    Working...