User Tools

Site Tools


zabbix_-_построение_топологии_сети

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
zabbix_-_построение_топологии_сети [2019/06/10 14:21]
val [Протокол RSH]
zabbix_-_построение_топологии_сети [2019/06/10 14:32] (current)
val [Zabbix API]
Line 255: Line 255:
 server.corp1.un:​~#​ /​root/​zab_get_hosts.sh | jq '​.result | .[] | {hostid: .hostid, host: .host} | tostring'​ | grep switch | tr -d '​{}\\'​ | tr '"'​ ' ' | cut -d ' ' -f5,9  server.corp1.un:​~#​ /​root/​zab_get_hosts.sh | jq '​.result | .[] | {hostid: .hostid, host: .host} | tostring'​ | grep switch | tr -d '​{}\\'​ | tr '"'​ ' ' | cut -d ' ' -f5,9 
 </​code>​ </​code>​
-Добавляем конвеер в конец скрипта и записываем результат в файл:+Добавляем конвейер в конец скрипта и записываем результат в файл:
 <​code>​ <​code>​
 server.corp1.un:​~#​ /​root/​zab_get_hosts.sh | tee list_hostid_host.txt server.corp1.un:​~#​ /​root/​zab_get_hosts.sh | tee list_hostid_host.txt
Line 283: Line 283:
 } " http://​127.0.0.1/​zabbix/​api_jsonrpc.php | \ } " http://​127.0.0.1/​zabbix/​api_jsonrpc.php | \
 #jq #jq
 +###zabbix3
 jq '​.result | .[] | .selements | .[] | {elementid: .elementid, selementid: .selementid} | tostring'​ | tr -d '​{}\\'​ | tr '"'​ ' ' | cut -d ' ' -f5,9 jq '​.result | .[] | .selements | .[] | {elementid: .elementid, selementid: .selementid} | tostring'​ | tr -d '​{}\\'​ | tr '"'​ ' ' | cut -d ' ' -f5,9
 +###zabbix4
 +#jq '​.result[1].selements[] | {elements, selementid} | tostring'​ | tr -d '​{}\\'​ | tr '"'​ ' ' | cut -d ' ' -f7,11
 </​code><​code>​ </​code><​code>​
 server.corp1.un:​~#​ /​root/​zab_get_maps.sh | tee list_hostid_selementid.txt server.corp1.un:​~#​ /​root/​zab_get_maps.sh | tee list_hostid_selementid.txt
zabbix_-_построение_топологии_сети.1560165700.txt.gz · Last modified: 2019/06/10 14:21 by val