This is an old revision of the document!
Решение прислал Кузьмин Алексей Михайлович
# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 ubuntu
# docker inspect zabbix-docker-zabbix-server-1 # cat /etc/zabbix/zabbix_agentd.d/my.conf
Server=172.16.M.N UserParameter=asterisk.activecalls,sudo /usr/sbin/asterisk -x "core show channels" | grep "active call" | awk '{print $1}' UserParameter=asterisk.processedcalls,sudo /usr/sbin/asterisk -x "core show channels" | grep "calls processed" | awk '{print $1}' UserParameter=asterisk.lines[*],sudo /usr/sbin/asterisk -x "core show channels" | grep '^$1' | wc -l UserParameter=asterisk.chansip.discovery,sudo /usr/local/bin/asterisk.chansip.discovery.py
# zabbix_agentd -t asterisk.activecalls
Item prototype ... Name: asterisk lines {#CHANNAME} ... Key: asterisk.lines[{#CHANNAME}] ...
IP=192.168.M.N wget "http://$IP:8088/rawman?action=login&username=admin&secret=admin" --save-cookies cookies.txt -q -O - wget "http://$IP:8088/rawman?action=ping" --load-cookies cookies.txt -q -O - wget "http://$IP:8088/rawman?action=logoff" --load-cookies cookies.txt -q -O -
{$AMI.HOST}: 192.168.M.N {$AMI.URL}: http://192.168.M.N:8088/rawman {$AMI.USERNAME}: admin {$AMI.SECRET}: admin
server# ip route add blackhole 195.19.40.152
# cat /etc/asterisk/prometheus.conf
... enabled = yes ...
# curl http://$IP:8088/metrics
... asterisk_calls_count ... asterisk_endpoints_channels_count ...
# cat /etc/prometheus/prometheus.yml
... - job_name: asterisk metrics_path: /metrics static_configs: - targets: ['192.168.M.N:8088']