Ad Widget

Collapse

Zabbix with FreePBX, can't connect to server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ashcor
    Junior Member
    • Oct 2023
    • 8

    #1

    Zabbix with FreePBX, can't connect to server

    Brand new to zabbix and trying to use it to monitor my FreePBX system. I've got it set up with the asterisk template and everything seems correct but the zabbix server cannot connect to asterisk over http. Using the standard 8088 port, I've added that to services in the freePBX firewall and whitelisted the zabbix server ip. Kind of stuck now.

    Any help on where to go next would be greatly appreciated!
  • Ashcor
    Junior Member
    • Oct 2023
    • 8

    #2
    some progress… from the Zabbix server I can.....

    [root@AshcorPBX asterisk]# curl 'http://mypbx:8088/rawman?action=login&username=zabbixuser&secret=zab bixsecret'
    Response: Success
    Message: Authentication accepted

    and:

    [root@vultr zabbix]# curl -I http://mypbx:8088/rawman?action=logi...t=zabbixsecret
    [1] 11474
    [2] 11475
    [2]+ Done username=zabbixuser
    [root@vultr zabbix]# HTTP/1.1 200 OK
    Server: Asterisk/18.17.1
    Date: Sat, 14 Oct 2023 22:09:18 GMT
    Cache-Control: no-cache, no-store
    Content-type: text/plain
    Set-Cookie: mansession_id=“bb561041”; Version=1; Max-Age=60
    Pragma: SuppressEvents


    Still can’t get results in the zabbix interface though. error: could not perform request: couldn’t connect to server

    Comment

    • vijayk
      Senior Member
      • May 2023
      • 305

      #3
      Check the logs in zabbix server.

      Comment

      • Ashcor
        Junior Member
        • Oct 2023
        • 8

        #4
        in the zabbix_server.log I see this...

        1135:20231014:180640.105 error reason for "MyPBX:asterisk.get_stats" changed: Cannot perform request: URL using bad/illegal format or missing URL
        1135:20231014:180640.106 error reason for "MyPBX:asterisk.active_calls" changed: Cannot perform request: URL using bad/illegal format or missing URL
        1135:20231014:180640.106 error reason for "MyPBX:asterisk.active_channels" changed: Cannot perform request: URL using bad/illegal format or missing URL

        for all the checks...

        Comment

        • Ashcor
          Junior Member
          • Oct 2023
          • 8

          #5
          in the template macro I have:

          {$AMI.URL} = http://xxx.xxx.xxx.xxx:8088/rawman (IP obscurred, but it's correct)

          tried
          {$AMI.URL} = http://xxx.xxx.xxx.xxx:8088/asterisk/rawman as well.... ​

          Comment

          • vijayk
            Senior Member
            • May 2023
            • 305

            #6
            I have never used asterisk/FreePBX but just thought that there is an issue with some formatting in presence of requested URL.

            Is FreePBX have setting to permit the Zabbix IP?

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4807

              #7

              Do you have selinux active? https://www.systutorials.com/docs/li...abbix_selinux/
              you may need to allow zabbix to connect to all ports...
              If you want to determine whether zabbix can connect to all TCP ports, you must turn on the zabbix_can_network boolean. Disabled by default.

              setsebool -P zabbix_can_network 1

              Comment

              • Ashcor
                Junior Member
                • Oct 2023
                • 8

                #8

                Originally posted by vijayk
                I have never used asterisk/FreePBX but just thought that there is an issue with some formatting in presence of requested URL.

                Is FreePBX have setting to permit the Zabbix IP?
                Yes, the zabbix server IP is whitelisted. Also, the zabbix server can see the zabbix agent on the PBX and get all the info for the CPU, memory etc...

                Comment

                • Ashcor
                  Junior Member
                  • Oct 2023
                  • 8

                  #9
                  Originally posted by cyber
                  Do you have selinux active? https://www.systutorials.com/docs/li...abbix_selinux/
                  you may need to allow zabbix to connect to all ports...

                  selinux is disabled on both systems.

                  Comment

                  • Hamardaban
                    Senior Member
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • May 2019
                    • 2713

                    #10
                    Run the command
                    Code:
                    asterisk -rx "http show status"
                    on the freepbx and show its output

                    On the zabbix server, increase the logging level to 4 - then the requested url will be logged in the logs.
                    Or change the script in preprocessing of master item so that logging is at level 3.

                    Comment

                    • Ashcor
                      Junior Member
                      • Oct 2023
                      • 8

                      #11
                      AshcorPBX*CLI> http show status
                      HTTP Server Status:
                      Prefix:
                      Server: Asterisk/18.17.1
                      Server Enabled and Bound to [::]:8088

                      HTTPS Server Enabled and Bound to [::]:8089

                      Enabled URI's:
                      /httpstatus => Asterisk HTTP General Status
                      /amanager => HTML Manager Event Interface w/Digest authentication
                      /metrics/... => Prometheus Metrics URI
                      /arawman => Raw HTTP Manager Event Interface w/Digest authentication
                      /manager => HTML Manager Event Interface
                      /rawman => Raw HTTP Manager Event Interface
                      /amxml => XML Manager Event Interface w/Digest authentication
                      /mxml => XML Manager Event Interface
                      /ari/... => Asterisk RESTful API
                      /ws => Asterisk HTTP WebSocket

                      Enabled Redirects:
                      None.

                      Comment

                      • Hamardaban
                        Senior Member
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • May 2019
                        • 2713

                        #12
                        If I understand correctly, then you have port 8088 listening on all IPv6 addresses?
                        But you are accessing an ipv4 address....

                        BTW - "{$AMI.URL} = http://xxx.xxx.xxx.xxx:8088/rawman"​ w/o asterisk prefix is correct for you.
                        Last edited by Hamardaban; 16-10-2023, 16:10.

                        Comment

                        • Ashcor
                          Junior Member
                          • Oct 2023
                          • 8

                          #13
                          it would appear that way yes.. although I don't have IPV6 set up that system so not sure why it's set that way.

                          Comment

                          • Hamardaban
                            Senior Member
                            Zabbix Certified SpecialistZabbix Certified Professional
                            • May 2019
                            • 2713

                            #14
                            One more point: if the host is monitored through a proxy, then all connection (when receiving the value in the master item) is established from the proxy.
                            But! when using the "test" button in the item settings one connection (login) will go from the zabbix proxy and the next connections (command) by the java script in preprocessing - from the zabbix server!

                            Comment

                            • Aleksey_work
                              Junior Member
                              • Oct 2023
                              • 2

                              #15
                              Originally posted by Ashcor
                              it would appear that way yes.. although I don't have IPV6 set up that system so not sure why it's set that way.
                              Hello, did you manage to solve the problem?

                              Comment

                              Working...