Ad Widget

Collapse

Question about monitoring our Asterisk Server, can't use ports 10,000-20,000

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MTWiley
    Junior Member
    • Jul 2011
    • 16

    #1

    Question about monitoring our Asterisk Server, can't use ports 10,000-20,000

    Default port for zabbix falls into the range of 10000-20000 which are used by asterisk. So I've been forced to find a different port to setup zabbix on. We've already got the zabbix server up and running and are monitoring a number of other hosts using the default ports of 10050 and 10051.

    My understanding is that to monitor our asterisk server using the zabbix agent I'll need 2 ports so I've considered using 20006 and 20007 as they're unusued on our system and unassigned by IANA which should make it less likely to have a conflict. I've changed the listen port number in
    the zabbix_agentd.conf to 20006 and edited /etc/services to

    Code:
    zabbix_agent    20006/tcp
    zabbix_trap     20007/tcp
    My config file is as follows, but I'll be leaving out the commented sections to keep things concise.

    Code:
    LogFile=/tmp/zabbix_agentd.log
    LogFileSize=1
    Server=xxx.xxx.x.xx
    Hostname=xxxxxxx.xxxxxxxxxx.xxx
    ListenPort=20006
    ListenIP=xx.xx.xx.xxx
    If I run service zabbix_agentd start the agent starts up and I run netstat -l which outputs:

    Code:
    Proto Recv-Q Send-Q Local Address               Foreign Address             State
    
    tcp        0      0 *:zabbix_agent              *:*                         LISTEN
    so it looks like the zabbix_agent is running and listening.

    But when I try

    Code:
    telnet xx.xx.xx.xxx 20006
    produces
    Code:
    telnet: connect to address xx.xx.xx.xxx: Connection refused
    and

    Code:
    zabbix_get -s xx.xx.xx.xxx -p 20006 -k agent.ping
    produces
    Code:
    zabbix_get [29535]: Get value error: Cannot connect to [xx.xx.xx.xxx:20006] [Connection refused]

    So as you can see I've got a problem connecting to the host to retrieve that information, but I'm not really sure where/what is causing that issue. Someone else is charge of the firewall, so I'll be having them take a look and see if that's what's causing the problem, but if you see something that I may have overlooked that I need to change to get this working please let me know.

    I'm also working towards some certifications and have been reading recently that ports don't necessarily need to be the same on both ends, and my understanding is that I could use port 20007 on my asterisk server to send to port 10051 on the zabbix server. Is that the case or do I need to change something else in order to get this working?
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    Where are you telnetting from? By default the zabbix agent will not allow any inbound connections to it except from the ip address of the server it has.

    Also I would suggest using -n with your netstat statement as it will not to an automatic look up the /etc/services file, but rather show the port numbers.

    Is askterisk using 10,000-20,000 for UDP only or both UDP and TCP? If it's using UDP only then you should not have an issue running a Zabbix agent on it's usual ports as they are TCP only.

    As for your question about different ports, that is not an issue. You will need to ensure all firewall rules allow for the appropriate traffic flows.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • MTWiley
      Junior Member
      • Jul 2011
      • 16

      #3
      Where are you telnetting from? By default the zabbix agent will not allow any inbound connections to it except from the ip address of the server it has.
      I was telnetting from the zabbix server listed in the configuration file.

      Also I would suggest using -n with your netstat statement as it will not to an automatic look up the /etc/services file, but rather show the port numbers.
      I'll keep that in mind when I'm trouble shooting my next issue.

      Is askterisk using 10,000-20,000 for UDP only or both UDP and TCP? If it's using UDP only then you should not have an issue running a Zabbix agent on it's usual ports as they are TCP only.
      Those ports are used for voip, so I'd assume that they were udp, but I'm not sure on that one.

      As for your question about different ports, that is not an issue. You will need to ensure all firewall rules allow for the appropriate traffic flows.
      Thank you for your quick and detailed response, it turned out to just be a firewall issue where it was blocking port 20006. We just allowed connections from our zabbix server to our asterisk server on port 20006 and now it's working great. I'm setting up some userparameters right now which I've not yet had any experience with so depending on how that goes I might be back later with a few more questions.

      Comment

      • MTWiley
        Junior Member
        • Jul 2011
        • 16

        #4
        I'm running into a small issue with those user parameters, they're randomly going unsupported.

        Code:
        # Number of Registered SIP Trucks
        UserParameter=asterisk.siptrunks,sudo asterisk -rvvvvvx 'sip show registry'|grep Registered |wc -l
        # Number of Registered IAX2 Trucks
        UserParameter=asterisk.iax2trunks,sudo asterisk -rvvvvvx 'iax2 show registry'|grep Registered |wc -l
        # Number of Active Calls
        UserParameter=asterisk.calls,sudo asterisk -rvvvvvx 'core show channels'|grep --text -i 'active call'|awk '{print $1}'
        I can reactivate them manually and they'll return a value but then go unsupported randomly again. Sometimes they're reactivating automatically.

        I've also tried running zabbix_get and it always comes back with a value and not ZBX_NOTSUPPORTED. Anyone got a clue on this one?

        Comment

        Working...