Ad Widget

Collapse

Discussion thread for official Zabbix Template Asterisk

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsafin
    Junior Member
    • Mar 2021
    • 4

    #46
    Originally posted by max.ch.88

    Hello. Could you share the AMI output of commands "ss7 show channels" and "dahdi show status"? Your collaboration would help to improve the template. Thanks.
    Hello, I could not provide you AMI outputs, because Zabbix server don't connect to AMI interface, received 500 error. I think the reason is in Asterisk version.

    Comment

    • max.ch.88
      Senior Member
      • Oct 2018
      • 206

      #47
      Originally posted by rsafin

      Hello, I could not provide you AMI outputs, because Zabbix server don't connect to AMI interface, received 500 error. I think the reason is in Asterisk version.
      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

      • rsafin
        Junior Member
        • Mar 2021
        • 4

        #48
        Originally posted by max.ch.88

        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"?
        I don't use zabbix template, My zabbix server received data using custom scripts on monitored server.
        Command outputs you can see in snapshots.
        Attached Files

        Comment

        • max.ch.88
          Senior Member
          • Oct 2018
          • 206

          #49
          Originally posted by rsafin

          I don't use zabbix template, My zabbix server received data using custom scripts on monitored server.
          Command outputs you can see in snapshots.
          How do you discover E1 ports or analog (FXO) ports?

          Comment

          • rsafin
            Junior Member
            • Mar 2021
            • 4

            #50
            Originally posted by max.ch.88

            How do you discover E1 ports or analog (FXO) ports?
            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.
            Attached Files

            Comment

            • max.ch.88
              Senior Member
              • Oct 2018
              • 206

              #51
              Originally posted by shdwlynx
              First, 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.
              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-19344
              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

              • shdwlynx
                Junior Member
                • Apr 2021
                • 4

                #52
                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

                • thesNu
                  Junior Member
                  • May 2021
                  • 5

                  #53
                  Hello all, Zabbix version 5.4.0, latest template. Everything work OK, but, all time triggered "Asterisk: has been reloaded (uptime < 10m)" In graph view negative values.
                  Date on zabbix: Wed May 19 09:56:48 +10 2021
                  Date on Asterisk: Wed May 19 09:57:17 +10 2021
                  How to fix this?
                  Click image for larger version

Name:	2021-05-19_09-56-19.png
Views:	2248
Size:	26.0 KB
ID:	424842 Click image for larger version

Name:	2021-05-19_09-56-10.png
Views:	2223
Size:	37.6 KB
ID:	424843

                  Comment

                  • jrsemler
                    Junior Member
                    • May 2021
                    • 2

                    #54
                    Hello,

                    I'm experiencing some difficulty making it work properly, here is my scenario:
                    Zabbix server:
                    OS: Debian 10 (Buster)
                    Version: Zabbix 5.4.0
                    Asterisk server:
                    OS: CentOS
                    FreePBX 15.0.17.34
                    Asterisk 17.9.3
                    manager.conf
                    Code:
                    [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
                    Templates macros
                    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=SuperSecret
                    Response: 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:
                    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
                    Asterisk server log "asterisk -rvvv" + "manager set debug on" output:
                    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
                    Thanks for any help.

                    Comment


                    • jrsemler
                      jrsemler commented
                      Editing a comment
                      I still at the same point, every connection test was well succeded except for the connection (and data acquisition) of the zabbix-asterisk plugin.

                      Thanks for any help.
                  • max.ch.88
                    Senior Member
                    • Oct 2018
                    • 206

                    #55
                    Originally posted by jrsemler
                    Hello,

                    I'm experiencing some difficulty making it work properly, here is my scenario:
                    Zabbix server:
                    OS: Debian 10 (Buster)
                    Version: Zabbix 5.4.0
                    Asterisk server:
                    OS: CentOS
                    FreePBX 15.0.17.34
                    Asterisk 17.9.3

                    Thanks for any help.
                    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

                    • jrsemler
                      Junior Member
                      • May 2021
                      • 2

                      #56
                      Originally posted by max.ch.88

                      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.
                      max.ch.88 Here is the response that I get:

                      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

                      • max.ch.88
                        Senior Member
                        • Oct 2018
                        • 206

                        #57
                        Originally posted by thesNu
                        Hello all, Zabbix version 5.4.0, latest template. Everything work OK, but, all time triggered "Asterisk: has been reloaded (uptime < 10m)" In graph view negative values.
                        Date on zabbix: Wed May 19 09:56:48 +10 2021
                        Date on Asterisk: Wed May 19 09:57:17 +10 2021
                        How to fix this?
                        Click image for larger version

Name:	2021-05-19_09-56-19.png
Views:	2248
Size:	26.0 KB
ID:	424842 Click image for larger version

Name:	2021-05-19_09-56-10.png
Views:	2223
Size:	37.6 KB
ID:	424843
                        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

                        • thesNu
                          Junior Member
                          • May 2021
                          • 5

                          #58
                          Originally posted by max.ch.88

                          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?

                          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

                          Comment

                          • max.ch.88
                            Senior Member
                            • Oct 2018
                            • 206

                            #59
                            Originally posted by thesNu


                            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

                            • thesNu
                              Junior Member
                              • May 2021
                              • 5

                              #60
                              Originally posted by max.ch.88


                              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.
                              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 presents

                              Comment

                              Working...