Ad Widget
Collapse
Discussion thread for official Zabbix Template Asterisk
Collapse
X
-
Then I don't understand how you're using the template.
Could you show console output of commands "ss7 show channels" and "dahdi show status"?Comment
-
I don't use zabbix template, My zabbix server received data using custom scripts on monitored server.
Command outputs you can see in snapshots.Comment
-
I will describe all scheme.
1. I have several PC with E1 cards(physical cards), each card have 4 E1 trunks. For example we take PC with 16 E1 trunks.
2. E1 trunks working through Asterisk 11.25.1. And monitored PC have Zabbix_agent v. 2.2
3. Zabbix server have version 5.0
4. In monitored PC were created 2 python scripts, which execute asterisk command and write the result in separate text file.
- 1-st script checks status of asterisk. And write in text file number 1 - if asterisk running, number 0 - if asterisk down. And makes it one time in a minute by crontab. Zabbix agent read text file one time in a minute, get number and send it to zabbix server. Zabbix server biult grafs and statistics.
- 2-nd script cheks status of E1 trunks by following command "/usr/sbin/asterisk -rx 'dahdi show status' | grep OK | wc -l > /etc/zabbix/scripts/dahdi.txt" in this way script write in text file number 16 - that means 16 E1 trunks are UP. The same action as previous script send info to zabbix_server each minutes.
- Also 2-nd script checks active E1 channels by command: "/usr/sbin/asterisk -rx 'ss7 show channels' | grep Connect | wc -l > /etc/zabbix/scripts/ss7.txt" In this scenario script write in a file number of active channels.
Aster command outputs you can find in previous message.Comment
-
Hello. The official template is changed. Now it uses the "core show channels concise" command to get a list of active channels with full names. Also added items sip.active_channels, pjsip.active_channels, iax.active_channels. https://support.zabbix.com/browse/ZBX-19344First, I'd like to thank everyone over the years who posted to this forum. While the Zabbix documentation is very useful, seeing actual real-life examples in context really helps.
To that end, I modified the 5.2 template to add a new value. In our case, we need to know not just how many channels are active per SIP trunk, but the sum total of all active channels across all SIP trunks.
Added new data value: "Asterisk: SIP all trunks active channels" (asterisk.sip.all_trunks_active_channels)
Added two new triggers (and Macros) for above, both a warning threshold and a max threshold.
In the process, I also addressed a minor issue that only affects those of us foolish mortals who use SIP trunk names that are longer than 16 characters. The "fix" is only useful if your SIP trunk names do not have unique characters at the end of them because the "core show channels" command used by the template to get a list of active channels only provides the first 16 characters.
I've attached the YAML if anyone is interested (just do a compare/diff vs. the 5.2 YAML to see what I changed/added). I had to zip it up so that the forum would allow me to attach it.
But I doubt that trigger for total active channels of all trunks is useful. It may never get fire. The template has a trigger for active channels of each trunk. You'll always know that the free capacity of the trunk is finished or closed to that.
The trigger for total maybe makes sense only if you have a call balancing between trunks.Comment
-
Glad to hear that the Zabbix team has updated the template. Our SIP provider does not limit active channels per trunk. Instead, they have an overall total limit, hence why we needed a data value (and, more importantly, triggers/macros) to monitor that sum of active channels across all trunks. We did test it, varying the number of active channels per trunk, but changing the total active channels across all trunks together, and it worked like a charm.Comment
-
Comment
-
Hello,
I'm experiencing some difficulty making it work properly, here is my scenario:Zabbix server:OS: Debian 10 (Buster)
Version: Zabbix 5.4.0Asterisk server:OS: CentOSmanager.conf
FreePBX 15.0.17.34
Asterisk 17.9.3
Templates macrosCode:[general] enabled = yes webenabled = yes port = 5038 bindaddr = 0.0.0.0 [admin] secret = SuperSecret deny=0.0.0.0/0.0.0.0 permit=127.0.0.1/255.255.255.0 read = system,call,log,verbose,agent,user,config,dtmf,rep orting,cdr,dialplan write = system,call,agent,user,config,command,reporting,or iginate,message writetimeout = 5000 [zabbix] secret = SuperSecret deny=0.0.0.0/0.0.0.0 permit=<Zabbix_IP>/255.255.0.0 permit=127.0.0.1/255.255.255.0 read = system,call,log,verbose,command,agent,user,originate write = system,call,log,verbose,command,agent,user,originate #include manager_additional.conf #include manager_custom.conf
Macro Value {$AMI.PORT} 5038 {$AMI.QUEUE_CALLERS.MAX.WARN} 10 {$AMI.RESPONSE_TIME.MAX.WARN} 10 {$AMI.SECRET} SuperSecret {$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN} 28 {$AMI.TRUNK_REGEXP} trunk {$AMI.URL} http://ASTERISK_IP:8088/rawman {$AMI.USERNAME} zabbix
Here is some debug procedure/information:
Postman (or Browser) HTTP (GET) request to:
http://ASTERISK_IP:8088/rawman?actio...et=SuperSecretResponse: Success
Message: Authentication accepted
Telnet to Asterisk from Zabbix server root@zabbix-srv:~# telnet ASTERISK_IP 5038
Trying ASTERISK_IP...
Connected to ASTERISK_IP.
Escape character is '^]'.
Asterisk Call Manager/6.0.1
Action: Login
ActionID: 1
Username: zabbix
Secret: SuperSecret
Response: Success
ActionID: 1
Message: Authentication accepted
Event: FullyBooted
Privilege: system,all
Uptime: 5460
LastReload: 2493
Status: Fully Booted
Asterisk server "asterisk -rvvv" output:
Asterisk server log "asterisk -rvvv" + "manager set debug on" output:Code:[2021-05-18 22:28:36] NOTICE[22281]: manager.c:3560 authenticate: [B]ZABBIX_IP[/B] failed to authenticate as 'zabbix' == HTTP Connect attempt from '[B]ZABBIX_IP[/B]' unable to authenticate == Connect attempt from '[B]ZABBIX_IP[/B]' unable to authenticate == Connect attempt from '[B]ZABBIX_IP[/B]' unable to authenticate
Thanks for any help.Code:<--- Examining AMI action: --> action: login username: zabbix Secret: <redacted from logging> [2021-05-18 22:31:36] NOTICE[22781]: manager.c:3560 authenticate: [B]ZABBIX_IP[/B] failed to authenticate as 'zabbix' <-- Examining AMI event: --> Event: InvalidPassword Privilege: security,all SequenceNumber: 1 File: manager.c Line: 1864 Func: manager_default_msg_cb EventTV: 2021-05-18T22:31:36.632-0300 Severity: Error Service: AMI EventVersion: 2 AccountID: zabbix SessionID: 0x7f52280b4d50 LocalAddress: IPV4/TCP/[B]ZABBIX_IP[/B]/8088 RemoteAddress: IPV4/TCP/[B]ASTERISK_IP[/B]/60096 SessionTV: 1969-12-31T21:00:00.000-0300 <-- Examining AMI event: --> Event: InvalidPassword Privilege: security,all SequenceNumber: 1 File: manager.c Line: 1864 Func: manager_default_msg_cb EventTV: 2021-05-18T22:31:36.632-0300 Severity: Error Service: AMI EventVersion: 2 AccountID: zabbix SessionID: 0x7f52280b4d50 LocalAddress: IPV4/TCP/[B]ZABBIX_IP[/B]/8088 RemoteAddress: IPV4/TCP/[B]ASTERISK_IP[/B]/60096 SessionTV: 1969-12-31T21:00:00.000-0300
Comment
-
Hello.
The request curl -I http://ASTERISK_IP:8088/rawman?actio...et=SuperSecret from your Zabbix server console should get a response something like this:
HTTP/1.1 200 OK
Server: Asterisk/13.32.0
Date: Wed, 19 May 2021 12:50:27 GMT
Cache-Control: no-cache, no-store
Content-type: text/plain
Set-Cookie: mansession_id="181cbc7a"; Version=1; Max-Age=3600
Pragma: SuppressEvents
Content-Length: 51
The response code is 200, the mansession_id field should have some value.Comment
-
max.ch.88 Here is the response that I get:
Hello.
The request curl -I http://ASTERISK_IP:8088/rawman?actio...et=SuperSecret from your Zabbix server console should get a response something like this:
HTTP/1.1 200 OK
Server: Asterisk/13.32.0
Date: Wed, 19 May 2021 12:50:27 GMT
Cache-Control: no-cache, no-store
Content-type: text/plain
Set-Cookie: mansession_id="181cbc7a"; Version=1; Max-Age=3600
Pragma: SuppressEvents
Content-Length: 51
The response code is 200, the mansession_id field should have some value.
Code:root@zabbix-srv:~# curl -I http://[B]ZABBIX_IP[/B]:8088/rawman?action=login&userman=zabbix&secret=SuperSecret [1] 15794 [2] 15795 root@zabbix-srv:~# HTTP/1.1 200 OK Server: Asterisk/17.9.3 Date: Wed, 19 May 2021 13:19:02 GMT Cache-Control: no-cache, no-store Content-type: text/plain Set-Cookie: mansession_id="0a915a0b"; Version=1; Max-Age=60 Pragma: SuppressEvents Content-Length: 51
Comment
-
Hello.
Please execute these requests with your values for <ASTERISK_IP>, <LOGIN>, <PASSWORD> in any browser:
http://<ASTERISK_IP>:8088/rawman?action=login&username=<LOGIN>&secret=<PASSW ORD>
http://<ASTERISK_IP>:8088/rawman?action=CoreStatus
What response do you get?Comment
-
http://<ASTERISK_IP>:8088/rawman?action=login&username=<LOGIN>&secret=<PASSW ORD>
Response: Success
Message: Authentication accepted
http://<ASTERISK_IP>:8088/rawman?action=CoreStatus
Response: Error
Message: Permission denied
But all option for read is on
read = system,call,log,verbose,command,agent,user,config, command,dtmf,reporting,cdr,dialplan,originate,mess age👍 1Comment
-
http://<ASTERISK_IP>:8088/rawman?action=login&username=<LOGIN>&secret=<PASSW ORD>
Response: Success
Message: Authentication accepted
http://<ASTERISK_IP>:8088/rawman?action=CoreStatus
Response: Error
Message: Permission denied
But all option for read is on
read = system,call,log,verbose,command,agent,user,config, command,dtmf,reporting,cdr,dialplan,originate,mess age
Unfortunately, read permission is not enough. Asterisk requires "system" and "command" write permissions to get the AMI response for "CoreStatus" and "core show channels" requests.Comment
-
Thanks for reply, i've set all permissions, now CoreStatus shows
Response: Success
CoreStartupDate: 2021-02-11
CoreStartupTime: 16:28:40
CoreReloadDate: 2021-05-20
CoreReloadTime: 16:15:05
CoreCurrentCalls: 26
but Asterisk: has been reloaded (uptime < 10m) problem still presentsComment
Comment