zabbix4.2绘制网络拓扑图-添加链路速率

G0/0/4⬇️{HW_3F_L2_SW_01:net.if.in[ifHCInOctets.8].last(0)}

G0/0/4是交换机接口,HW_3F_L2_SW_01(最好写成IP地址,有时候主机名不成功)是交换机名字 :net.if.in[ifHCInOctets.8]是交换机建值 .last(0)是zabbix的函数

配置->主机->点开对应主机->监控项,进入监控项,查看监控接口的键值。

 

posted on 2019-05-30 11:38 fanlong0212 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/fanlong0212/p/10948683.html

以下是使用 Zabbix API 获取网络拓扑图配置的示例代码: ```python import json import requests # Zabbix API credentials url = 'http://your_zabbix_url/api_jsonrpc.php' username = 'your_username' password = 'your_password' # Zabbix API request headers headers = { 'Content-Type': 'application/json-rpc' } # Zabbix API request body data = { 'jsonrpc': '2.0', 'method': 'map.get', 'params': { 'output': 'extend', 'selectSelements': 'extend', 'selectLinks': 'extend', 'selectIconMap': 'extend' }, 'auth': None, 'id': 1 } # Authenticate with Zabbix API auth_data = { 'jsonrpc': '2.0', 'method': 'user.login', 'params': { 'user': username, 'password': password }, 'id': 1, 'auth': None } auth_response = requests.post(url, headers=headers, data=json.dumps(auth_data)) auth_result = json.loads(auth_response.text) auth_token = auth_result['result'] # Add authentication token to request body data['auth'] = auth_token # Send request to Zabbix API response = requests.post(url, headers=headers, data=json.dumps(data)) result = json.loads(response.text) # Print topology maps for map in result['result']: print('Map name: ' + map['name']) print('Map id: ' + map['sysmapid']) print('Elements: ') for element in map['selements']: print(element['elementid'] + ': ' + element['label']) print('Links: ') for link in map['links']: print(link['linkid'] + ': ' + link['label']) print('Icon map: ') for icon in map['iconmap']['mappings']: print(icon['iconid'] + ': ' + icon['expression'] + ' -> ' + icon['iconid']) ``` 注意:在代码中,需要将“your_zabbix_url”替换为您的Zabbix URL,“your_username”替换为您的Zabbix用户名,“your_password”替换为您的Zabbix密码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值