Ad Widget

Collapse

cannot connect to [[localhost]:5555]: [111] Connection refused

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dunnsland
    Member
    • Dec 2021
    • 81

    #1

    cannot connect to [[localhost]:5555]: [111] Connection refused

    I am trying to monitor the nginx_status of my nginx web server.
    The issue is if I manually check the status of the stub, it reports as up and running. I would then assume that my nginx config is good.



    The issue that I am facing is that zabbix_agent is reporting that the service is down.


    If I set the log-level debug to 5 and tail the zabbix_agent.log file I see the following.


    116458:20250310:083237.761 Requested [net.tcp.service[http,"localhost","5555"]]
    116458:20250310:083237.761 TCP expect network error: cannot connect to [[localhost]:5555]: [111] Connection refused
    116458:20250310:083237.761 Sending back [0]

    ​how and why would this happen if curl works as expected?

    Hoping that someone out there
    Last edited by dunnsland; 10-03-2025, 10:07.
  • Answer selected by dunnsland at 10-03-2025, 15:45.
    dunnsland
    Member
    • Dec 2021
    • 81

    PavelZ
    Thanks again for responding ... The last post I provided was the solution that fixed the issue.

    This is below.

    I changed the Hostname in the zabbix_agentd.conf file set that to

    Hostname=127.0.0.1

    Under Configuration, Host, I edited the MACROS under the server name in the Zabbix Config Dashboard.

    Click image for larger version

Name:	image.png
Views:	153
Size:	59.1 KB
ID:	500239

    Click image for larger version

Name:	image.png
Views:	123
Size:	34.4 KB
ID:	500240

    Click image for larger version

Name:	image.png
Views:	123
Size:	27.0 KB
ID:	500241


    Click image for larger version

Name:	image.png
Views:	124
Size:	139.1 KB
ID:	500242

    now If I run

    zabbix_agentd -t net.tcp.service[http,127.0.0.1,5555]​

    ​It works and the alert has disappeared from the dashboard.

    Comment

    • PavelZ
      Senior Member
      • Dec 2024
      • 162

      #2
      Are you still using the same workaround I suggested in another thread?
      It is not necessary to configure each server to port 5555. This is only necessary if your configuration is too complex or if Nginx is controlled by some program like the hosting control panel and regularly overwrites the settings.

      Try connect zabbix to the regular port 80 first.
      Check request via curl
      Check port listen status with netstat (modern systems use ss program)
      Check firewall settings. IP 127.0.0.1 can also be protected

      Comment

      • dunnsland
        Member
        • Dec 2021
        • 81

        #3
        PavelZ I am using the workaround without any hassles. I am just confused as to why I would get the connection refused.
        What I have done in the meantime is the following.

        I changed the Hostname in the zabbix_agentd.conf file set that to

        Hostname=127.0.0.1

        I have edited the MACRO under the server name in the Zabbix Config Dashboard.

        Set the
        {$NGINX.STUB_STATUS.HOST} = 127.0.0.1
        {$NGINX.STUB_STATUS.PATH} = nginx_status
        {$NGINX.STUB_STATUS.PORT} = 5555
        {$NGINX.STUB_STATUS.SCHEME} = http

        now If I run

        zabbix_agentd -t net.tcp.service[http,127.0.0.1,5555]

        I get

        net.tcp.service[http,127.0.0.1,5555] [u|1]

        which is what I am expecting, I have restarted the zabbix_agent and am waiting to see if the alert returns.

        Will keep you posted.
        Lawrence
        Last edited by dunnsland; 10-03-2025, 15:33.

        Comment

        • dunnsland
          Member
          • Dec 2021
          • 81

          #4
          PavelZ
          Thanks again for responding ... The last post I provided was the solution that fixed the issue.

          This is below.

          I changed the Hostname in the zabbix_agentd.conf file set that to

          Hostname=127.0.0.1

          Under Configuration, Host, I edited the MACROS under the server name in the Zabbix Config Dashboard.

          Click image for larger version

Name:	image.png
Views:	153
Size:	59.1 KB
ID:	500239

          Click image for larger version

Name:	image.png
Views:	123
Size:	34.4 KB
ID:	500240

          Click image for larger version

Name:	image.png
Views:	123
Size:	27.0 KB
ID:	500241


          Click image for larger version

Name:	image.png
Views:	124
Size:	139.1 KB
ID:	500242

          now If I run

          zabbix_agentd -t net.tcp.service[http,127.0.0.1,5555]​

          ​It works and the alert has disappeared from the dashboard.

          Comment

          Working...