Ad Widget

Collapse

Specifying the wrong parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PetrK
    Junior Member
    • May 2023
    • 3

    #1

    Specifying the wrong parameter

    Hi, I'd like some advice. I call the host.create api method in zabbix (version 5.0). The response is "code": -32602, "message": "Invalid params.", "data": "Incorrect arguments passed to function."
    Is there any way to get zabbix to tell me specifically which parameter is wrong?
    Thank you.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Umm... "data" ??

    But seriously... we have no clue, what you entered there, so we cannot really tell, what can be wrong...

    Comment

    • PetrK
      Junior Member
      • May 2023
      • 3

      #3
      I didn't send the data on purpose :-)
      Because my question is not what is wrong in my particular case. The question is whether it is possible for Zabbix to say what specifically it doesn't like.
      That is, that instead of "Invalid params. Incorrect arguments passed to function", to say for example "Invalid params. Incorrect arguments Interfaces passed to function"...​

      Comment

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

        #4
        I don't think thee is any way to alter what API gives back to you...

        but...It would still be better to see, what you send and how (python script or something else). For some guys it might be very obvious from the example, what was wrong and maybe help you out from there forward (not me.. I have not done anything with API stuff for ages.. )...

        Just a cheeky suggestion... Maybe it points out that you send a parameter called "data" and it considers it wrong? .. So everything is as you expect, just too obvious?​

        Comment


        • PetrK
          PetrK commented
          Editing a comment
          Thank you. I deal with these situations more often, so I'm looking for a general solution. I use php.
          Here's an example: I send to the api the request shown in the example here: https://www.zabbix.com/documentation...ce/host/create
          But in interfaces/type I will put not 1-4 but 0. This is an error.
          The Zabbix answer is: {"jsonrpc": "2.0", "error":{"code":-32602, "message": "Invalid params.", "data": "Incorrect arguments passed to function."}, "id":1}
          So the question is whether zabbix could tell that the error is in interfaces/type. Personally, I also think it probably can't, but I prefer to ask if I've missed something...
      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #5
        But there is no interface type 0...
        type
        (required)
        integer Interface type.

        Possible values are:
        1 - agent;
        2 - SNMP;
        3 - IPMI;
        4 - JMX.
        But there is no better explanation in error messages possible, I think...

        Comment


        • PetrK
          PetrK commented
          Editing a comment
          This was an example. Multiple parameters are sent and it can be tedious to figure out which one is wrong. I find it easy to add information to the error message, in which parameter (e.g. interfaces) the error occurred...
          However, apparently there is no way to get this information directly from the response, that's what I wanted to know, thanks :-)
      Working...