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
推荐阅读
- 云原生微服务技术趋势解读
- 韵达基于云原生的业务中台建设 | 实战派
- python|8. 文件系统——文件的删除、移动、复制过程以及链接文件
- 运维|如何限制IP 通过 SSH连接服务器
- 运维|Linux 禁止用户或 IP通过 SSH 登录
- linux|apt update和apt upgrade命令 - 有什么区别()
- 服务器|用旧手机搭建服务器并实现内网穿透不需要root(本人亲测很多次最简单的一个)
- GitHub|7 款可替代 top 命令的工具
- Linux系统网络编程|Linux系统(权限管理)
- 企业实战|Linux 五种IO模型详细图解