Ad Widget

Collapse

How to create a database monitor item with api

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KBlasz
    Junior Member
    • Apr 2020
    • 20

    #1

    How to create a database monitor item with api

    Hello,

    I am a bit stuck. i cant seem to find a way to create a database monitor item via the API.

    I have working ODBC checks but i would like to automate the createtion with the API

    This is the json code i am trying to use but no luck. i am just getting "data=incorrect arguements" message (i am using powershell to convert the json, so error might be different for you)
    { "jsonrpc": "2.0", "method": "item.create", "params": { "name": "SQL Check", "key_": "db.obdc.select[testapi,sqlserver]", "hostid": "30074", "username": name, "password": pass, "type": "11", "delay": "30s" "param": "SQL query" }, "auth": "", "id": 1 } Thank you in advance
  • KBlasz
    Junior Member
    • Apr 2020
    • 20

    #2
    if anyone has a example json script they could provide, it would be immensely helpful

    Comment

    • KBlasz
      Junior Member
      • Apr 2020
      • 20

      #3
      figured it out in the end. I was missing a few fields, here is a example json using MSSQL OBDC driver :

      Code:
      "hostid":"your host id",
      "type":"11",
      "name":"Database check name",
      "key_":"db.odbc.get[MSSQL,,Driver=/usr/lib/libmsodbcsql-17.so;Server=192.168.0.10",
      "username":"sql username",
      "password":"sql password",
      "delay":"30s",
      "value_type":"4",
      "params":"your query"

      Comment

      Working...