Ad Widget

Collapse

API history.get

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stevenwright_tsys
    Junior Member
    • Jul 2014
    • 2

    #1

    API history.get

    Hi,
    I have been tasked with getting metric data from Zabbix and pushing it into Graphite. From the documentation it seems that the API call I want is history.get(). The return for history.get() is:

    "result": [
    {
    "itemid": "24242",
    "clock": "1406211422",
    "value": "72.1399",
    "ns": "620647725"
    },

    I'd really like to be able to have the query return the item name as well. Right now the only way I see to do this is to do the history.get() query and then iterate the results and make another query to get the item name. This is very inefficient.

    Is there a better way to do this?

    Thank you.

    Zabbix version 2.2.5 running on Redhat.
  • stevenwright_tsys
    Junior Member
    • Jul 2014
    • 2

    #2
    This how I ended up solving it:

    49 q = json.dumps({
    50 "jsonrpc":"2.0",
    51 "method":"host.get",
    52 "params": {
    53 "output":["host","items"],
    54 "sortfield": "name",
    55 "selectItems":["itemid","name","key_","lastvalue","lastclock"]
    56 },
    57 "auth":"023a5244e624098836d8ca88554265d0",
    58 "id": 1
    59 })

    Comment

    Working...