zabbix 成功添加后: $VAR1 = bless( { 'version' => 0, 'content' => { 'jsonrpc' => '2.0', 'id' => 1, 'result' => { 'hostids' => [ '10228' ] } }, 'jsontext' => '{"jsonrpc":"2.0","result":{"hostids":["10228"]},"id":1}', 'is_success' => 1 }, 'JSON::RPC::ReturnObject' ); ---------------------- HASH(0x2857fd0) zabbix 添加是失败的情况: $VAR1 = bless( { 'version' => 0, 'content' => { 'jsonrpc' => '2.0', 'error' => { 'data' => 'Host with the same name "zjtest9-app" already exists.', 'message' => 'Invalid params.', 'code' => -32602 }, 'id' => 1 }, 'jsontext' => '{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Host with the same name \"zjtest9-app\" already exists."},"id":1}', 'is_success' => 0 }, 'JSON::RPC::ReturnObject' ); 通过判断: die "host.get failed " unless $response->content->{error}->{data};