1}, 'JSON::RPC::R。zabbix 添加主机成功失败判断。" />

zabbix 添加主机成功失败判断

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\n" unless $response->content->{error}->{data};


【zabbix 添加主机成功失败判断】转载于:https://www.cnblogs.com/zhaoyangjian724/p/6200104.html

    推荐阅读