Ad Widget

Collapse

Nginx by ZAbbix Agent - Nginx: Connections active and MORE are showing ERRORS

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

    #1

    Nginx by ZAbbix Agent - Nginx: Connections active and MORE are showing ERRORS

    I have installed Nginx by Zabbix Agent .. After installing, there are many items that do deliver data, but there are also many that are showing an error.
    Below is the error that is shown for many of the items.


    Click image for larger version  Name:	image.png Views:	0 Size:	209.3 KB ID:	499513


    Click image for larger version  Name:	image.png Views:	1 Size:	49.5 KB ID:	499512​​

    Preprocessing failed for: HTTP/1.1 404 Not Found..Server: nginx..Date: Sat, 22 Feb 2025 21:25:22 GMT..Content-Type: text/ht...
    1. Failed: cannot perform regular expression "server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)" match for value of type "string": pattern does not match​​

    I have read a few articles where people are saying that there have been issues with the macros.
    It seems that I cannot seem to see the HOST and the Service running on my Server.

    Has anyone have any ideas how I can get this working.

    Thanks
    Lawrence
    Last edited by dunnsland; 22-02-2025, 23:40.
  • Answer selected by dunnsland at 24-02-2025, 19:03.
    dunnsland
    Member
    • Dec 2021
    • 81

    PavelZ
    You are a star, thank you for your patience and help and guidance. I have now resolved the issue.
    Following your advice. I created a status stub under /etc/nginx/config.d/nginx_status.conf
    I used what you suggested.
    server {
    listen 127.0.0.1:5555;
    location = /nginx_status {
    stub_status on;
    access_log on;
    allow 127.0.0.1;
    allow xx.xx.xx.xx;
    # only allow access from 192.168.1.5 #
    allow xx.xx.xx.xx; # Office Access #
    deny all;
    }
    }

    This then open port 5555 on the localhost.
    I then updated the config within the macros for the host, set the port accordingly and I then started seeing stats.
    All fix.

    Thanks again.
    Lawrence

    Comment

    • dunnsland
      Member
      • Dec 2021
      • 81

      #2
      PavelZ Thank you for responding, as I said earlier. I am running multiple sites on the server. All of these open the nginx basic_status page if I open it in a browser, using each individual domain name.

      I am running.
      NB: I have limited this to only my external ipaddress. both of these work.

      https://dunnsland.com/basic_status
      Expert IT infrastructure monitoring, server management, and technical support services. 24/7 monitoring and support for your IT ecosystem.


      I have a dedicated server running in a DC in Paris, where I have 5 domains running on my nginx instance.
      I have zabbix running on a virtual machine that I have on my internal home network.

      If I try to run the curl command from the zabbix server commandline towards my external server, I get the following error.

      curl http://https://www.zabbix.com/forum/...x/basic_status
      <html>
      <head><title>410 Gone</title></head>
      <body>
      <center><h1>410 Gone</h1></center>
      <hr><center>nginx</center>
      </body>
      </html>

      I have all my sites set to redirect to https.
      How can I get around this?

      Thanks
      Lawrence

      Comment

      • PavelZ
        Senior Member
        • Dec 2024
        • 162

        #3
        WE mixed up the thread a little bit?

        Okay, I'll give my opinion here.
        NGINX configuration can be very complex. In such a situation, I prefer to create a separate section server on diffent port like this :
        server {
        listen 127.0.0.1:8888
        }
        And add a stub_status handler there
        This data is global for the nginx process and it doesn't matter which server section provide it

        Comment

        • dunnsland
          Member
          • Dec 2021
          • 81

          #4
          PavelZ This looks very interesting ....
          I did not realise that this is possible.
          I am new to zabbix and nginx ......
          What I did was create a file

          I removed the nginx_status from all of the site config files.

          I then created the following file.
          cat /etc/nginx/conf.d/nginx_status.conf
          server {
          listen 127.0.0.1:80;
          location = /nginx_status {
          stub_status on;
          access_log on;
          allow 127.0.0.1;
          allow xx.xx.xx.xx;
          # only allow access from 192.168.1.5 #
          allow xx.xx.xx.xx; # Office Access #
          deny all;
          }
          }

          When I restart nginx and try the nginx_status, I get a 404. I don't know why, and looking into the logs I do not see any reason. Only that it is not found.

          I also tried only with the location tags ... and that also gave the same results.

          Any ideas (sorry this has now become an nginx config help on top of teh nginx in zabbix.)

          Comment

          • PavelZ
            Senior Member
            • Dec 2024
            • 162

            #5
            I suggest using a separate new unused port 8888 so that it definitely does not interfere with the operation of sites.
            I can choose another port - 8081, 3333,4444 ,etc.

            Comment

            • dunnsland
              Member
              • Dec 2021
              • 81

              #6
              OK that makes sense but how do I have zabbix request the status from that specific port that I choose?

              Lawrence

              Comment

              • dunnsland
                Member
                • Dec 2021
                • 81

                #7
                PavelZ
                You are a star, thank you for your patience and help and guidance. I have now resolved the issue.
                Following your advice. I created a status stub under /etc/nginx/config.d/nginx_status.conf
                I used what you suggested.
                server {
                listen 127.0.0.1:5555;
                location = /nginx_status {
                stub_status on;
                access_log on;
                allow 127.0.0.1;
                allow xx.xx.xx.xx;
                # only allow access from 192.168.1.5 #
                allow xx.xx.xx.xx; # Office Access #
                deny all;
                }
                }

                This then open port 5555 on the localhost.
                I then updated the config within the macros for the host, set the port accordingly and I then started seeing stats.
                All fix.

                Thanks again.
                Lawrence

                Comment

                Working...