更新zabbix screen报错The Y coordinate of screen element xxx is too big

参见博文http://john88wang.blog.51cto.com/2165294/1538456     利用zabbix api根据主机分组来添加screen

当一个Screen中的Item数量需要增加时,执行Screen会报错

The Y coordinate of screen element xxx is too big

这个问题一直存在了好久,以前都是先删除原来的Screen,再重新创建新的Screen临时解决,今天总算一次性解决了。

原来的代码

      print "Updating Screen Name %s  Screen ID %s" %(screen_name,update_screenid)
       values1 = {
               "jsonrpc" : "2.0",
               "method"  : "screen.update",
               "params"  : {
                       "screenid" : update_screenid,
                       "screenitems": []
                           },
               "auth"    : auth,
               "id"      : 2               
                 }
       output1 = requestJson(url,values1)


关键就在于使用screen.update这里,没有把hsize和vsize这两个参数写上,因为如果当需要添加的Screen中的Item需要增加时,这两个参数也会跟着变动,如果保持原来的不变,那么的新增的Item就添加不进去,没有办法更新Screen,所以报错The Y coordinate of screen element xxx is too big


解决办法:

 values1 = {
               "jsonrpc" : "2.0",
               "method"  : "screen.update",
               "params"  : {
                       "screenid" : update_screenid,
                       "screenitems": [],
                       "hsize": columns,
                       "vsize": vsize,
                           },
               "auth"    : auth,
               "id"      : 2
                 }


Zabbix API官方说明


https://www.zabbix.com/documentation/2.2/manual/api/reference/screen/update

https://www.zabbix.com/documentation/2.2/manual/api/reference/screen/object#screen

https://www.zabbix.com/documentation/2.2/manual/api/reference/screenitem/object#screen_item




你可能感兴趣的:(api,zabbix,screen,zabbxi)