Ad Widget

Collapse

How to change item type to "Zabbix Active Agent" using the JSON RPC API?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nagylzs
    Junior Member
    • Nov 2017
    • 8

    #1

    How to change item type to "Zabbix Active Agent" using the JSON RPC API?

    When I try to create a new item using item.create, then the interfaceid is required, unless the item type is "Zabbix Agent Active". This is written explicitely in the documentation. But how do I create an item that has "Zabbix Agent Active" type? I see no way for specifying the item type in the item.create API call. It is possible to give so called "applications", and apparently there are applications that are called "Zabbix Agent Active". However, there are lots of them. For example, if I call application.get(filter:{name:'Zabbix Agent Active'}) then I get 11 different items with different ids. All of them are named 'Zabbix Agent Active'. Which one should I apply? Or maybe I need to do something else to create an item without an interface?

    If I pass type=7 to the item.create API call then I get this error:

    pyzabbix.ZabbixAPIException: ('Error -32500: Application error., SQL statement execution has failed "INSERT INTO items (delay,hostid,key_,name,type,value_type,descriptio n,history,interfaceid,master_itemid,flags,params,i temid) VALUES (\'120\',\'10278\',\'vl.missing_deletions\',\'Hián yzó várólista törlések és halasztások\',\'7\',\'3\',\'Olyan előjegyzések, amiknél a tervezett időpont a mai nap előtt van, és [ van várólista azonosítója, vagy nincs vl. azonosítója, és nem magánpraxisos ].\',\'365d\',NULL,NULL,\'0\',\'\',\'29211\')".', -32500)

    Is this a bug?
    Last edited by nagylzs; 02-09-2018, 18:14.
  • nagylzs
    Junior Member
    • Nov 2017
    • 8

    #2
    Okay, so it seems that the mysql database encoding was wrong. ASCII name + description can be added without any problem.

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #3
      Originally posted by nagylzs
      pyzabbix.ZabbixAPIException: ('Error -32500: Application error., SQL statement execution has failed "INSERT INTO items (delay,hostid,key_,name,type,value_type,descriptio n,history,interfaceid,master_itemid,flags,params,i temid) VALUES (\'120\',\'10278\',\'vl.missing_deletions\',\'Hián yzó várólista törlések és halasztások\',\'7\',\'3\',\'Olyan előjegyzések, amiknél a tervezett időpont a mai nap előtt van, és [ van várólista azonosítója, vagy nincs vl. azonosítója, és nem magánpraxisos ].\',\'365d\',NULL,NULL,\'0\',\'\',\'29211\')".', -32500)
      IIRC JSON specs says that characters with codes >=128 must be passed in xNN format.
      Another thing is that on the interacting over API I would advise to use always locale C.
      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
      https://kloczek.wordpress.com/
      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
      My zabbix templates https://github.com/kloczek/zabbix-templates

      Comment

      Working...