Ad Widget

Collapse

Web monitoring, trigger if a string is found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sapineceh
    Junior Member
    • Aug 2012
    • 4

    #1

    Web monitoring, trigger if a string is found

    Hi,

    I was wondering if there is a way to monitor for a string on a website and have a trigger launch when a specific string is found. In other words I have a query that returns the amount of rows in a database and I would need an alert if the amount of rows returned is zero, so the string that shouldn't be found would be something like "rowsReturned = 0".
  • sapineceh
    Junior Member
    • Aug 2012
    • 4

    #2
    Any ideas or suggestions?

    Comment

    • Yello
      Senior Member
      • Apr 2011
      • 309

      #3
      Hi,
      If I am understanding you correctly, that's not really possible using web scenarios given they way they work.

      Instead, what I'd do is either:

      - Write a script to parse the page output and fire a result to zabbix using zabbix_sender.

      or

      - Use dbforbix to remotely query the database in question and forward the returned value to zabbix (again, trapper items required).


      Regards,
      David

      Comment

      • Rawlings
        Junior Member
        • Sep 2012
        • 24

        #4
        Hello

        You can use nagios plugin Check_Http

        It's work good with Zabbix

        Comment

        • mbsit
          Senior Member
          • Sep 2012
          • 130

          #5
          Hi,
          Come on guys !
          It's standard functionality of ZABBIX, you don't need any script or Nagios (tfu) plugin.

          Go to: http://www.zabbix.com/documentation/...web_monitoring Read the step 3 in "Real scenario" example (field: Required) and you have what you want.

          This is the first answer.

          If you want to query the database (not website), you can use STANDARD odbc functionality. Start from there: http://lin4.de/blog/zabbix/zabbix-da...ring-with-odbc

          If you want scripting, use UserParameter or SSH command to call 'curl' and parse the result.


          Best,
          Grzegorz
          Pozdrawiam
          Grzegorz Grabowski
          ____
          Wdrożenia, szkolenia, umowy serwisowe
          Warszawa - Polska

          Comment

          • Rawlings
            Junior Member
            • Sep 2012
            • 24

            #6
            Hello

            @mbsit odbc functionalitydon't work yet

            Comment

            • mbsit
              Senior Member
              • Sep 2012
              • 130

              #7
              Rawlings: do not tell nonsense

              ODBC is perfect working. I implemented about 2k odbc items during last two month.

              Do ./configure Zabbix with (hidden) switch --with-unixodbc and you will see.
              Then read http://lab4.org/wiki/Zabbix_Database_Monitor_English

              Bests,
              Grzegorz
              Pozdrawiam
              Grzegorz Grabowski
              ____
              Wdrożenia, szkolenia, umowy serwisowe
              Warszawa - Polska

              Comment

              • Rawlings
                Junior Member
                • Sep 2012
                • 24

                #8
                Sorry , i was not update




                Post 5

                Comment

                • mbsit
                  Senior Member
                  • Sep 2012
                  • 130

                  #9
                  No problem, but it was 4 year ago

                  Bests,
                  Grzegorz

                  --
                  Wdrożenia Zabbix - Warszawa
                  Pozdrawiam
                  Grzegorz Grabowski
                  ____
                  Wdrożenia, szkolenia, umowy serwisowe
                  Warszawa - Polska

                  Comment

                  • Yello
                    Senior Member
                    • Apr 2011
                    • 309

                    #10
                    Originally posted by mbsit
                    Hi,
                    Come on guys !
                    It's standard functionality of ZABBIX, you don't need any script or Nagios (tfu) plugin.
                    My initial reaction on seeing the OP's question was similar to yours. However, the way I now interpret the question I see it differently. If I recall (I don't have a zabbix instance to work with right now) there is one web item for any scenario failure, return code, validation tsring et.al. Therefore it's not possible to set up a trigger which only fires when a validation string checks fails.

                    Also, the OP is asking to check that the validation string has a value greater than 0 (fail on 0 value). Web scenarios don't lend themselves to that kind of checking. They check for explicit strings, not patterns.

                    That's why I suggest pre-processing the page and pushing the result into zabbix for storage/alerting.

                    Regards,
                    David

                    Comment

                    • mbsit
                      Senior Member
                      • Sep 2012
                      • 130

                      #11
                      Hi
                      Short introduction: My Vision of Zabbix is, this is a tool for Managers and Directors, NOT for Admins. So I will always promote solutions for Managers not for Admins.

                      I was wondering if there is a way to monitor for a string on a website and have a trigger launch when a specific string is found. In other words I have a query that returns the amount of rows in a database and I would need an alert if the amount of rows returned is zero,
                      What I understand there is a some website which is owned by the user. This website shows some data (query) from database. if its true, we don't need plugins, we need only one time, user parameter development.

                      If the website looks like that:

                      <Some HEADER>
                      <Table of data>
                      | column 1 | column 2 | column 3 | .... | column n |

                      <Some footer>

                      We can do UserParameter with parameters like:

                      Userparameter=up.get.website.field[*], curl "$1" | grep $2 | awk $3 '{print $$4}'

                      We can define Item like this:
                      Name: Value from website
                      Type: Zabbix agent
                      Data type: decimal
                      Key: up.get.website.field[WEBSITE_ADRRESS,"|","-F'|'",1]

                      Which get 1-st column value.

                      Then Managers from frontend (without any scripting) can get any value from that table and trigger it.

                      Of course, if the website has more complex format, there is a need, more complex - one time userparameter - creating

                      Bests,
                      Grzegorz

                      --
                      Wdrożenia Zabbix - Warszawa
                      Pozdrawiam
                      Grzegorz Grabowski
                      ____
                      Wdrożenia, szkolenia, umowy serwisowe
                      Warszawa - Polska

                      Comment

                      • plfiumi
                        Junior Member
                        • Dec 2022
                        • 2

                        #12
                        Originally posted by mbsit
                        Hi,
                        Come on guys !
                        It's standard functionality of ZABBIX, you don't need any script or Nagios (tfu) plugin.

                        Go to: http://www.zabbix.com/documentation/...web_monitoring Read the step 3 in "Real scenario" example (field: Required) and you have what you want.

                        This is the first answer.

                        If you want to query the database (not website), you can use STANDARD odbc functionality. Start from there: http://lin4.de/blog/zabbix/zabbix-da...ring-with-odbc

                        If you want scripting, use UserParameter or SSH command to call 'curl' and parse the result.


                        Best,
                        Grzegorz
                        www.mbs-it.pl
                        Hi, all due respect, this user is talking about the case where the string found is something that you don't expect to happen. So the idea here would be to have an alert IF the string is found.
                        Actually I'm trying to do the same, I've created a web scenario to find the undesired string. But I don't know what to place in the trigger, because response is still 200 even if the string is not there.
                        Any help?

                        Thanks in advance .

                        Comment

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

                          #13
                          I don't know if I'm missing something, but isn't it this simple:
                          - create a HTTP agent item
                          - create a trigger with find()

                          ?

                          Markku

                          Comment

                          • plfiumi
                            Junior Member
                            • Dec 2022
                            • 2

                            #14
                            Originally posted by Markku
                            I don't know if I'm missing something, but isn't it this simple:
                            - create a HTTP agent item
                            - create a trigger with find()

                            ?

                            Markku
                            Beautiful Markku, this is the correct answer!

                            I've created a HTTP Agent to get all the content of the website:
                            Click image for larger version

Name:	image.png
Views:	1964
Size:	118.9 KB
ID:	455899
                            And then a trigger to found a reggex with undesired content in my website:
                            Click image for larger version

Name:	image.png
Views:	1970
Size:	122.7 KB
ID:	455900

                            For future reference, this is a good example: https://blog.zabbix.com/handy-tips-8...unction/17481/

                            Thanks for your help .

                            Comment

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

                              #15
                              Originally posted by Markku
                              I don't know if I'm missing something, but ...
                              Yes.. you missed, that someone failed to read docs and revived 10 years old topic..:P

                              Comment

                              Working...