[ZBX-4880] Issue with zabbix 2.0.0rc2 API Created: 2012 Apr 16  Updated: 2017 May 30  Resolved: 2012 May 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.0.0rc2
Fix Version/s: 2.0.0rc4

Type: Incident report Priority: Major
Reporter: Simon Kerckhof Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian with MySQL
API: v1.4



 Description   

When we create a host trough the API the JSON-error "no such error" is generated:

JSON request that is sent:
{"jsonrpc":"2.0","method":"host.create","params":{"host":"store3.internal.test","interfaces":[

{"type":"2","main":"1","useip":"1","ip":"192.168.17.210","dns":"","port":"161"}

,

{"type":"1","main":"1","useip":"1","ip":"192.168.17.210","dns":"","port":"10050"}

,

{"type":"1","main":"0","useip":"1","ip":"172.16.80.26","dns":"","port":"10050"}

],"groups":

{"groupid":"6"}

,"templates":[

{"templateid":"10047"}

,

{"templateid":"10134"}

,

{"templateid":"10130"}

,

{"templateid":"10049"}

]},"auth":"24aedcb501e25f50eac653fe183c6708","id":1}

(all templateid's, groupid's and auth.hash are valid)

Received:
Got response from API: ({"jsonrpc":"2.0","error":

{"code":-32400,"message":"System error.","data":"JSON-rpc error generation failed. No such error \"\"."}

,"id":1}) Response decoded: (Array ( [jsonrpc] => 2.0 [error] => Array ( [code] => -32400 [message] => System error. [data] => JSON-rpc error generation failed. No such error "". ) [id] => 1 )

When I shorten the name to store3 and run it again, the host is succesfully added.
(With the Zabbix php-frontend I can create a host with the name store3.internal.test and same templates/groups without issue).

Is there a limitation on the hostname length for the host.create method?
If my JSON is faulty, it would be nice to have an error different than just "System Error".

Thanks for checking this out.



 Comments   
Comment by richlv [ 2012 Apr 16 ]

if you enable frontend debug for your user, create a host and view the debug, does the json, generated by the frontend, differ from yours significantly ?

(note that "JSON-rpc error generation failed" must be fixed anyway, of course)

Comment by Simon Kerckhof [ 2012 Apr 17 ]

richlv, how do I enable the frontend debug?
and where can I view the JSON output?

Comment by Simon Kerckhof [ 2012 Apr 17 ]

I've tried to add this host again and now I accually do get an error:

Value "'{store3.belgovault.internal:IfOut.[\"

{#SNMPINDEX}\"].last(0)}>{$MAXOUT}&{store3.belgovault.internal:IPAdrEntIP.[\"{#SNMPINDEX}

\"].regexp(@PublicIP)}&{store3.belgovault.internal:IfOut.[\"

{#SNMPINDEX}\"].time(0)}>{$TRAFFICSTOP}&{store3.belgovault.internal:IfOut.[\"{#SNMPINDEX}

\"].time(0)}<{$TRAFFICSTART}'" is too long for field "expression" - 295 characters. Allowed length is 255 characters. [CHost.create -> CHost.massAdd -> CTemplate.massAdd -> CTemplate.link -> CTriggerPrototype.syncTemplates -> CTriggerGeneral.inherit -> CTriggerGeneral.inheritOnHost -> CTriggerPrototype.createReal -> DB.insert -> DB.checkValueTypes]

So there is accually a limit to the hostname lenght if you have long trigger statements.
Can this be altered?

I am using a Debian (6.0.4) with MySQL (Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (x86_64) using readline 6.1)
+ Zabbix 2.0.0rc2 (revision 26343)

Comment by Simon Kerckhof [ 2012 Apr 17 ]

Could be related to: ZBX-4302

Comment by Alexey Fukalov [ 2012 Apr 25 ]

dev branch: svn://svn.zabbix.com/branches/dev/ZBX-4880

Comment by Toms (Inactive) [ 2012 May 02 ]

TESTED

Comment by Alexey Fukalov [ 2012 May 02 ]

svn://svn.zabbix.com/trunk 27226

Comment by Alexander Vladishev [ 2012 May 03 ]

(1) Hudson tests failed after fixing the given issue

PHP Fatal error: Class 'DB' not found in /home/hudson/public_html/trunk-FRONTEND-MYSQL/frontends/php/include/schema.inc.php on line 4

<Sasha> CLOSED Should be fixed in ZBXNEXT-686

Generated at Sat Apr 27 02:40:03 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.