Ad Widget

Collapse

snmp interface via api

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • neorejdv76
    Junior Member
    • Nov 2021
    • 15

    #1

    snmp interface via api

    hi,

    I am trying to create a net snmp interface on a host. I've copied the expample code from the manual and made it suitable for my environment:

    Code:
    {
    "jsonrpc": "2.0",
    "method": "hostinterface.create",
    "params": {
    "hostid": "11816",
    "main": "1",
    "type": "2",
    "useip": "1",
    "ip": "127.0.0.1",
    "dns": "",
    "port": "161",
    "details": {
    "version": "2",
    "bulk": "1"
    }
    },
    "auth": "spuersecret",
    "id": 1
    }
    When i post this command i allways get a error:
    "message": "Parse error",
    "data": "Invalid JSON. An error occurred on the server while parsing the JSON text."

    So i understand that the json code is not correct, but i can't figureout what part is wrong. I've tried many thing now but nothing seems to work.
    I can create an agent interface via the api on the same host with out any troubles...... But a snmp interface keep failing.

    I'am using postman and zabbix 6.0.25.
    Any help would be appreciated
    Last edited by neorejdv76; 06-03-2024, 12:38.
  • Answer selected by neorejdv76 at 06-03-2024, 13:54.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    Does that host have any interfaces already? If it has, then "main" should be 0, I think...
    main integer Whether the interface is used as default on the host. Only one interface of some type can be set as default on a host.

    Possible values:
    0 - not default;
    1 - default.

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #2
      Does that host have any interfaces already? If it has, then "main" should be 0, I think...
      main integer Whether the interface is used as default on the host. Only one interface of some type can be set as default on a host.

      Possible values:
      0 - not default;
      1 - default.

      Comment

      • neorejdv76
        Junior Member
        • Nov 2021
        • 15

        #3
        Correct, that was the issue. Thanks!

        Comment

        Working...