Ad Widget

Collapse

Zabbix web monitoring service

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SergeyL
    Member
    • Jan 2022
    • 89

    #1

    Zabbix web monitoring service

    Hey all!
    I need to monitor my services for their availability.
    I have a Linux server that runs this service and has zabbix-agent installed, the service is available on port 8787.
    I created a validation request:​
    Click image for larger version

Name:	image.png
Views:	1873
Size:	37.8 KB
ID:	462690
    Click image for larger version

Name:	image.png
Views:	1717
Size:	39.5 KB
ID:	462691
    I get an error:
    Step "HealthCheck" [1 of 1] failed: Couldn't connect to server: Failed to connect to localhost port 8787: Connection refused
    Which is natural, because as far as I understood the request

    ​comes from my Zabbix server, not from the Agent installed on the Server where my service is running.
    Zabbix Server don`t have access to this service on this port.

    Tell me, is there a way to start the scan from the Agent installed on the server on which the Service is running!?
    Thanks!​​
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    The agent web.page.get item can be used. I've never used it, it seems to have less function than the web scenarios. Is "localhost" really what you are testing, or is that sanitized for this post? Of course, the Zabbix server would need the DNS or IP of the host running the service.

    You may be able to use the web test "HTTP proxy" option. I had a small Apache proxy in the cloud so I could monitor the status of service from an external view. A $12 a month Vultr VM was adequate for several proxy tests

    Comment

    • SergeyL
      Member
      • Jan 2022
      • 89

      #3
      Originally posted by LenR
      The agent web.page.get item can be used. I've never used it, it seems to have less function than the web scenarios. Is "localhost" really what you are testing, or is that sanitized for this post? Of course, the Zabbix server would need the DNS or IP of the host running the service.

      You may be able to use the web test "HTTP proxy" option. I had a small Apache proxy in the cloud so I could monitor the status of service from an external view. A $12 a month Vultr VM was adequate for several proxy tests
      I just need to get 200 response or text {"status":"UP"} to make sure that the service is working, after adding the desired item, I will set up the trigger.
      Click image for larger version

Name:	image.png
Views:	1719
Size:	5.5 KB
ID:	462723
      Yes, I use localhost(though it doesn't matter I can use his ip), because I want the agent that is installed on this server to do the check (so as not to give extra rights for Zabbix Server).
      At the moment, I can’t set up an Item to attach a trigger to it....

      Click image for larger version

Name:	image.png
Views:	1711
Size:	43.8 KB
ID:	462724

      I'd appreciate the options....​

      Comment

      • Atsushi
        Senior Member
        • Aug 2013
        • 2028

        #4
        Hint of item setting.

        Name: AMS HealthCheck
        Type: Zabbix agent
        Key: web.page.get[http://localhost:8787/ams/actuator/health]
        Type of information: Text
        Update interval: 1m

        Preprocessing tab
        -----
        Regular expression
        pattern: .*({.*}).*
        output: \1
        -----
        JSONPath
        $.status
        -----

        Comment

        • SergeyL
          Member
          • Jan 2022
          • 89

          #5
          Originally posted by Atsushi
          Hint of item setting.

          Name: AMS HealthCheck
          Type: Zabbix agent
          Key: web.page.get[http://localhost:8787/ams/actuator/health]
          Type of information: Text
          Update interval: 1m

          Preprocessing tab
          -----
          Regular expression
          pattern: .*({.*}).*
          output: \1
          -----
          JSONPath
          $.status
          -----
          Thanks for helping! now I'm looking for why it's not coming Latest data...

          Click image for larger version

Name:	image.png
Views:	1725
Size:	43.7 KB
ID:	462754Click image for larger version

Name:	image.png
Views:	1746
Size:	25.0 KB
ID:	462755

          Click image for larger version

Name:	image.png
Views:	1733
Size:	15.1 KB
ID:	462756 It works, but for some reason I don’t get data, I’m looking for a problem.​​

          Comment

          • Atsushi
            Senior Member
            • Aug 2013
            • 2028

            #6
            First, delete Preprocessing and check what kind of values you can get from the web service.

            Comment

            • SergeyL
              Member
              • Jan 2022
              • 89

              #7
              Originally posted by Atsushi
              First, delete Preprocessing and check what kind of values you can get from the web service.
              Thanks!
              I get what I need, now I'm sorting out the syntax so that it would be displayed in the Latest Data for Trigger.​

              Comment

              • SergeyL
                Member
                • Jan 2022
                • 89

                #8
                Originally posted by Atsushi
                First, delete Preprocessing and check what kind of values you can get from the web service.
                It is enough for me to check if there are 200.
                I can’t figure out why during the test it shows what I need, but the Data doesn`t fall into Latest Data. Storage period has been exposed.
                Can someone advise? Thank you.

                Click image for larger version

Name:	image.png
Views:	1713
Size:	40.4 KB
ID:	463054

                Comment

                • Atsushi
                  Senior Member
                  • Aug 2013
                  • 2028

                  #9
                  If you only want the HTTP response code, try preprocessing to extract just that part.

                  -----
                  Regular expression
                  pattern: HTTP/1.1 ([0-9]{3})
                  output: \1
                  -----

                  Comment

                  • SergeyL
                    Member
                    • Jan 2022
                    • 89

                    #10
                    Originally posted by Atsushi
                    If you only want the HTTP response code, try preprocessing to extract just that part.

                    -----
                    Regular expression
                    pattern: HTTP/1.1 ([0-9]{3})
                    output: \1
                    -----
                    Actually, it doesn't really matter to me, because I absolutely accept it as text and he does not understand that this is an http response.
                    The strangest thing for me right now is that I don't have the Latest Data. Although the trigger (and it turns out that the items) work, if I stop my service, triggers work.

                    Comment

                    • Atsushi
                      Senior Member
                      • Aug 2013
                      • 2028

                      #11
                      If you don't get the value, check the log. If a red mark is displayed on the right side of the item whose value cannot be obtained in the list of items on the web front end, you may be able to check it by moving the mouse pointer there. As for triggers, I'm not sure what triggers you're setting up.

                      Comment

                      • SergeyL
                        Member
                        • Jan 2022
                        • 89

                        #12
                        Originally posted by Atsushi
                        If you don't get the value, check the log. If a red mark is displayed on the right side of the item whose value cannot be obtained in the list of items on the web front end, you may be able to check it by moving the mouse pointer there. As for triggers, I'm not sure what triggers you're setting up.
                        It does not give any errors, in my opinion everything looks correct, but the Latest Data isn`t accumulated.
                        This is the question I am currently trying to solve....
                        Click image for larger version

Name:	image.png
Views:	1770
Size:	7.2 KB
ID:	463093
                        Click image for larger version

Name:	image.png
Views:	1686
Size:	45.2 KB
ID:	463094
                        Click image for larger version

Name:	image.png
Views:	1766
Size:	7.6 KB
ID:	463095
                        History is just as empty.

                        As for triggers, I set up the simplest one, although I was surprised that it works, although there is no Latest data.(it fires if i disable my service)

                        Here maybe it will be useful for someone:

                        Click image for larger version

Name:	image.png
Views:	1701
Size:	48.8 KB
ID:	463096
                        ​​​

                        Comment

                        • Atsushi
                          Senior Member
                          • Aug 2013
                          • 2028

                          #13
                          How are your items configured? If you want to check the status 200, did you remove the Precessing that I introduced at the beginning?
                          Also, if you stop the service with a trigger, it will be judged as a failure because you have set it using nodata(). If you want to make sure the status code is 200, create the trigger to something like that.​

                          Comment

                          • SergeyL
                            Member
                            • Jan 2022
                            • 89

                            #14
                            Originally posted by Atsushi
                            How are your items configured? If you want to check the status 200, did you remove the Precessing that I introduced at the beginning?
                            Also, if you stop the service with a trigger, it will be judged as a failure because you have set it using nodata(). If you want to make sure the status code is 200, create the trigger to something like that.​
                            I left as you suggested above - it suits me. Thanks!
                            Healthcheck works, only Latest Date doesn't work, I'm looking for logs.

                            Comment

                            Working...