zabbix_export: version: '5.4' date: '2021-11-21T21:32:03Z' groups: - uuid: 0c29308bb70a4a5c9e682c09fa8e049d name: 'Custom templates' templates: - uuid: 9c8ae094594045baac5a93c4c8ec869e template: Asterisk name: Asterisk description: | ## Description Asterisk IP PBX template ## Overview ``` Zabbix template for Asterisk IP PBX Finds out the total number of concurrent channels on trunks. Each thunk's name should start with "tru\_" Installation: - Put userparameter\_asterisk.conf in /etc/zabbix/zabbix\_agentd.d/ , restart zabbix agent - Put asterisk\_trunks and asterisk\_calls scripts in /etc/zabbix/externalscripts/ and add execute privileges - Set up cronjob for asterisk\_trunks script like this: # crontab -l SHELL=/bin/bash # update Asterisk trunks info for zabbix 2 * * * * /etc/zabbix/externalscripts/asterisk\_trunks - (Optional) If there're no enough permissions for /var/run/asterisk/asterisk.ctl then add following line in /etc/asterisk/asterisk.conf: astctlpermissions = 775 , and restart Asterisk. Add zabbix user to group asterisk. - Import Asterisk.xml template in Zabbix. Adjust values if necessary. ``` ## Author Oleg groups: - name: 'Custom templates' discovery_rules: - uuid: 5755bb99122d4ab3a7dd03cd764d452b name: 'Asterisk trunks' key: asterisk.calls.discovery delay: '6;6/1-7,07:55-21:05;30/1-7,00:00-07:54;30/1-7,21:06-23:59' description: 'Finds out number of channels sorted by trunks. Each thunk''s name should start with "tru_"' item_prototypes: - uuid: 5ace55f5c757489082958145654ae489 name: 'Calls in {#TRUNK}' type: CALCULATED key: 'asterisk.calls[{#TRUNK}]' delay: '6' params: '{#CALLS}' tags: - tag: Application value: Asterisk trigger_prototypes: - uuid: 813498ddd1514932ae43b83c08d67b43 expression: 'last(/Asterisk/asterisk.calls[{#TRUNK}])>40' name: 'Number of calls in {#TRUNK} is {#CALLS}' priority: AVERAGE tags: - tag: VoIP graph_prototypes: - uuid: b42eb4a9e90143ab9cb5e5c5b8ac56ad name: 'Calls in {#TRUNK}' width: '600' height: '100' ymin_type_1: FIXED graph_items: - drawtype: GRADIENT_LINE color: EE0000 item: host: Asterisk key: 'asterisk.calls[{#TRUNK}]' dashboards: - uuid: 0d23ab1d89cd493684d1c9b489ff78a3 name: Calls pages: - widgets: - type: GRAPH_PROTOTYPE width: '24' height: '5' fields: - type: INTEGER name: source_type value: '2' - type: INTEGER name: columns value: '1' - type: INTEGER name: rows value: '1' - type: GRAPH_PROTOTYPE name: graphid value: name: 'Calls in {#TRUNK}' host: Asterisk