Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-19232

API: Runtime error while creating SSH item without "authtype" parameter

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 5.0.11rc1, 5.2.7rc1, 5.4.0beta3
    • API (A)
    • None

      Accordingly to Documentation for item.create "authtype" parameter is optional with default value 0.
      But if this parameter is not sent:

      {
          "jsonrpc": "2.0",
          "method": "item.create",
          "params": {
              "hostid": 40001,
              "name": "SSH",
              "key_": "ssh.run[]",
              "type": 13,
              "value_type" :1,
              "interfaceid" : 40011,
              "delay" : "22s",
      //        "authtype": 0,
              "username" : "username1",
              "params" : "executed script 1"
          },
          "auth": "cb2a371a0ea5cab5dd13eb7ded2e5f49",
          "id": 1
      }
      

      Runtime error appears in /apache2/error.log:

      [Fri Apr 09 11:54:00.742821 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP Notice:  Undefined index: authtype in /home/larisa/workspace/zabbix/ui/include/classes/api/services/CItemGeneral.php on line 504
      [Fri Apr 09 11:54:00.742846 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP Stack trace:
      [Fri Apr 09 11:54:00.742851 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP   1. {main}() /home/larisa/workspace/zabbix/ui/api_jsonrpc.php:0
      [Fri Apr 09 11:54:00.742856 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP   2. CJsonRpc->execute() /home/larisa/workspace/zabbix/ui/api_jsonrpc.php:63
      [Fri Apr 09 11:54:00.742859 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP   3. CLocalApiClient->callMethod() /home/larisa/workspace/zabbix/ui/include/classes/core/CJsonRpc.php:75
      [Fri Apr 09 11:54:00.742862 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP   4. CItem->create() /home/larisa/workspace/zabbix/ui/include/classes/api/clients/CLocalApiClient.php:113
      [Fri Apr 09 11:54:00.742865 2021] [php7:notice] [pid 2719230] [client ::1:41784] PHP   5. CItem->checkInput() /home/larisa/workspace/zabbix/ui/include/classes/api/services/CItem.php:448
      

            zabbix.dev Zabbix Development Team
            lgrigorjeva Larisa Grigorjeva
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: