Ad Widget

Collapse

Zabbix Agent for Nginx not following redirect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dunnsland
    Member
    • Dec 2021
    • 81

    #1

    Zabbix Agent for Nginx not following redirect

    I have nginx installed on my web server. I have installed the Nginx by zabbix agent.
    I see the following when I look at the config.

    Click image for larger version

Name:	image.png
Views:	946
Size:	120.9 KB
ID:	453775

    My site is up and running, only I have a forced https redirect in my config. How can I get zabbix to accept and follow the redirect?

    Thanks
    Lawrence ​
  • dunnsland
    Member
    • Dec 2021
    • 81

    #2
    If I open a browser and use the URL www.dunnsland.com/basic_status I am given the following page.

    Click image for larger version

Name:	image.png
Views:	950
Size:	16.6 KB
ID:	453777

    Lawrence

    Comment

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

      #3
      You are showing us "dependent items". Those are just reporting that they cannot extract data based on regex from your main item. Is "Follow redirects" checked in your main item config ("Nginx:Get stub status page")?

      Comment

      • dunnsland
        Member
        • Dec 2021
        • 81

        #4
        cyber
        Thanks for the input, but I am new to Zabbix. Where and how can I add a check for redirect within the Nginx: Get stub status page

        Thanks
        Lawrence

        Comment

        • dunnsland
          Member
          • Dec 2021
          • 81

          #5
          cyber
          I could not find anything related to adding or checking a redirect, so I searched in the template for the trigger, found where it was looking for the URL status, changed that to 301 instead of 200 and am now monitoring to see if this works.

          Will keep you posted.

          Thanks
          Lawrence

          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1782

            #6
            https://git.zabbix.com/projects/ZBX/...pp/nginx_agent says:

            Note that this template doesn't support https and redirects (limitations of web.page.get).
            Could you use the Nginx HTTP template instead? (I have no experience on either)

            Markku

            Comment

            • dunnsland
              Member
              • Dec 2021
              • 81

              #7
              Markku
              Thanks for responding. After updating the template directly I am now happy that it is working.

              I did the following.

              Under Configuration / Hosts / Templates I selected the template Nginx by Zabbix agent

              Select Triggers and then the item named Nginx: Failed to fetch stub status

              Click image for larger version

Name:	image.png
Views:	884
Size:	22.9 KB
ID:	453814

              When this opens you can then edit and change the expected HTTP code.

              The default setting is 200, I changed it to 301 to reflect the redirect. That solved my issue.

              Click image for larger version

Name:	image.png
Views:	894
Size:	31.9 KB
ID:	453815


              Hope this helps.
              ​​
              ​​Lawrence
              Attached Files

              Comment

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

                #8
                Ah ok .. as Markku noted it is web.page.get agent item, not http item. Somehow I assumed it is http item... I have not used this template myself..:P ...

                But do your dependent items also work now? I would assume, that you get only redirect notice as a result of stub page, but not stats themselves... As I understand, you never get to actual page, only to frontend which shows you redirecting...

                Comment

                • dunnsland
                  Member
                  • Dec 2021
                  • 81

                  #9
                  cyber
                  I don't really have an understanding of what the template does or expects to do.

                  Looking at it now, the stubs parts is working but none of the others are.

                  Looking at total requests and requests per second. Both of these depend on get stubs status, but the requests are failing..

                  Click image for larger version

Name:	image.png
Views:	865
Size:	13.3 KB
ID:	453860

                  Click image for larger version

Name:	image.png
Views:	850
Size:	40.6 KB
ID:	453861​​

                  Click image for larger version

Name:	image.png
Views:	886
Size:	23.0 KB
ID:	453859

                  So it seems fixing one thing does not cascade to fixing the dependancies.

                  Any advice.

                  Lawrence​

                  Comment

                  • dunnsland
                    Member
                    • Dec 2021
                    • 81

                    #10
                    Guys

                    I have now also tried to use the template Nginx by HTTP and am having exactly the same issues.

                    Any ideas

                    Lawrence​

                    Comment

                    • Markku
                      Senior Member
                      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                      • Sep 2018
                      • 1782

                      #11
                      Did you configure the macros as instructed in https://git.zabbix.com/projects/ZBX/...app/nginx_http?

                      (Let's assume that you correctly removed the old configurations as well.)

                      Markku

                      Comment

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

                        #12
                        And other thing is, is your nginx allowing stats from outside... I think in case of "agent check" it is configured to use 127.0.0.1, but in case of http check, query comes from outside, so nginx has to allow that connection to stats...

                        Comment

                        • dunnsland
                          Member
                          • Dec 2021
                          • 81

                          #13
                          cyber Thanks for the feed back, but my zabbix server in tracing nginx on an external server as you say. So how/where can I set the external ipaddress to check externally.

                          Lawrence

                          Comment

                          Working...