2025年8月5日 星期二

Postman以webapi抓取zabbix資料

  • 在zabbix新增API token (只要做一次,要把token存下來)

  • 查詢zabbix中,遠端管理設備的Host name

  • 在Postman設定zabbix API token

 

  • 用host name查詢hostid

JSON的內容
{
  "jsonrpc": "2.0",
  "method": "host.get",
  "params": {
    "filter": {
      "host": ["120210_01"]
    }
  },
  "id": 1
}

  • 轉為powershell script

  • 用hostid查詢last value

 JSON的內容
{
  "jsonrpc": "2.0",
  "method": "item.get",
  "params": {
    "output": ["itemid", "name", "lastvalue"],
    "hostids": "10670",  // 請換成你查到的 hostid
    "sortfield": "name"
  },
  "id": 2
}

 

 

沒有留言:

張貼留言