Появилась задача, добавить в мониторинг несколько Asterisk серверов, на которых было от 10 до 30 транков, которые в свою очередь так же необходимо было мониторить. Недоделанно
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
/etc/zabbix/zabbix_agentd.d/trunk.sh #!/bin/bash sudo /usr/sbin/asterisk -rvvvx 'sip show peers' | grep ^$1 | grep OK | wc -l UserParameter=asterisk.calls.active,sudo /usr/sbin/asterisk -r -x "core show calls" | grep active | cut -d" " -f1 UserParameter=asterisk.calls.processed,sudo /usr/sbin/asterisk -r -x "core show calls" | grep processed | cut -d" " -f1 UserParameter=asterisk.channels.active,sudo /usr/sbin/asterisk -r -x "core show channels" | grep "active channels" | cut -d" " -f1 UserParameter=asterisk.sip.total,sudo /usr/sbin/asterisk -r -x "sip show peers" | grep "sip peers" | cut -d" " -f1 UserParameter=asterisk.sip.online,sudo /usr/sbin/asterisk -r -x "sip show peers" | grep "sip peers" | sed 's/.* \([0-9]*\) online.*/\1/' UserParameter=asterisk.discovery[*],cat /etc/zabbix/zabbix_agentd.d/trunk.txt UserParameter=asterisk.registry[*],/etc/zabbix/zabbix_agentd.d/trunk.sh $1 /usr/sbin/asterisk -rx "sip show peers" | awk 'BEGIN{print "{\n\"data\":["; } NF>6 {print "\t{ \"{#TRUNKNAME}\":\""$1"\" },";} END {print "\t] }";}' /etc/zabbix/zabbix_agentd.d/trunk.txt { "data":[ { "{#TRUNKNAME}":"F_Piter_SIP" }, { "{#TRUNKNAME}":"from-000121370/000121370" }, { "{#TRUNKNAME}":"from-000123898/000123898" }, { "{#TRUNKNAME}":"from-00060488/00060488" }, { "{#TRUNKNAME}":"from-veles/000120946" }, { "{#TRUNKNAME}":"k-8800/2119386244" }, { "{#TRUNKNAME}":"kkont-out/2282121887" }, { "{#TRUNKNAME}":"multicom/NewSercons" }, { "{#TRUNKNAME}":"to-000121370/000121370" }, { "{#TRUNKNAME}":"to-000123898/000123898" }, { "{#TRUNKNAME}":"to-000128910/000128910" }, { "{#TRUNKNAME}":"to-00060488/00060488" }, { "{#TRUNKNAME}":"to-88003336470/000128720" }, { "{#TRUNKNAME}":"to-Veles/000120946" } ] } |