Ad Widget

Collapse

required pattern was not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • juanc
    Junior Member
    • Oct 2015
    • 3

    #1

    required pattern was not found

    Hi,

    I am trying to configure a "Required string" inside the setp of the scenario using regex as is documented in the manual. However any regex I have tried is not working, I need to find the word "green" in the page.

    I have used:

    .*green.*
    .*((?!green).)*

    But so far I'm still getting the error required pattern ".*((?!green).)*" was not found.

    Any ideas of how Zabbix do the regex in web scenario? Or how to use the "Require string" option?
  • ingus.vilnis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2014
    • 908

    #2
    Hi,

    In the required string field please try using simply word green. No quotes, no regexp syntax, nothing else.

    Best Regards,
    Ingus

    Comment

    • juanc
      Junior Member
      • Oct 2015
      • 3

      #3
      Hi Ingus,

      Thanks for your answer, I also used just the word itself no quotes nothing around and same problem. And is weird because in the documentation it clearly says that it recognize regex so not sure what I'm doing wrong. Thanks

      Juan

      Comment

      • ingus.vilnis
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2014
        • 908

        #4
        Hi,

        Really strange issue.

        Can you have a look at the HTML code of the web site you are checking with Zabbix? Can you actually found the word "green" in the actual code?

        What version of Zabbix are you using?

        Best Regards,
        Ingus

        Comment

        • Tec_Technician
          Member
          • Dec 2015
          • 39

          #5
          SAme error

          Hi!

          I know this thread is old but, i also have the same problem.

          Versions:
          Server: Zabbix 3.0.1
          Client: Zabbix 3.0.1

          Web monitoring.
          Agent: Zabbix

          required pattern : Mostrando (a text i can see clearly on the HTML code of the web, and in the normal interface).

          Zabbix shows required pattern "Mostrando" was not found on https://mywebsite.com

          Is there other things to check ?

          I used Firefox with firebug to show me the html code of the website.

          Thanks in advance for your help. ;-)

          Comment

          • sboyce
            Junior Member
            • Oct 2016
            • 5

            #6
            Required String sometimes found

            I see the same issue.
            But it seems to behave differently among Web Scenario Steps.
            For example, some steps see "This complex String" when others do not.
            Sometimes just one word works, when other words do not. Very Strange.

            Zabbix 2.4.5

            Comment

            • TheVito
              Junior Member
              • Oct 2016
              • 6

              #7
              I had a similar issue with the Required String

              Most of the pages I checked worked with the Scenario Agent being Zabbix Agent, but the one I was having issues with failed everytime. Just like the others was just a simple WORD match nothing fancy.

              I changed the agent to be Internet Explorer 11 and it all works now, it appears the page was checking for a valid Browser and failing. It was confusing because I still got a 200 return code, that is what threw me off thinking my call was working but the match failing. In reality the url was failing and the match was doing the correct thing.

              So all works now, just make sure you pick the right agent.
              I am using 3.2.1

              Comment

              • sboyce
                Junior Member
                • Oct 2016
                • 5

                #8
                The version of Zabbix I am using does not have IE v11 Agent. It only goes up to v10. I have tried various agents, IE, FF, Chrome, all with the same non-working results.
                It wonder if the issue is that the host I am using is a NetScaler hosted URL that redirects to a actual host. I have discovered that the port setting at the host level seems irrelevant, as any number also gives the same result.
                I think I will now test going direct to the host, see if that makes any difference.
                Thanks for your response.

                Comment

                • sboyce
                  Junior Member
                  • Oct 2016
                  • 5

                  #9
                  javascript not supported

                  I have discovered why Zabbix is unable to see the Required String on the particular site I am trying to monitor.

                  The site requires Javascript to be enabled in your "browser". I discovered this by setting the Zabbix server side logging to Debug Level 5 and that uncovered the issue since I was able to see the site HTML in the log: "To use Oracle BIEE, please enable javascript in your browser."

                  Once I saw this, It made sense since OBIEE GoURLs from Linux also does not work for the same reason.

                  It seems that Javascript enabled UserAgents on Linux simply don't exist, therefore Zabbix on Linux does not support it as well. It would be nice if the doc mentioned that. Oh well. At least I know that I can now just work on a workaround method instead of thinking that there is an issue with Zabbix.

                  Comment


                  • ZMS
                    ZMS commented
                    Editing a comment
                    hey
                    i just stumbled on your post cuz i stumbled on the same problem
                    have you found your workaround?
                • sboyce
                  Junior Member
                  • Oct 2016
                  • 5

                  #10
                  The work around was to look for a unique string on the alternate page that was severed up to verify that I was in the right place. Fortunately in my case there was. Looking at the server side log was key to knowing what to look for. Or I suppose you can disable JavaScript in your browser to see what gets severed up in that situation locally. Incidentally, we are no longer using Zabbix. Everything has been moved to Prometheus, Grafana and Alert Manager, so going based on memory here :/

                  Comment


                  • ZMS
                    ZMS commented
                    Editing a comment
                    Thanks,
                    i heard about Grafana
                    how is it?
                • sboyce
                  Junior Member
                  • Oct 2016
                  • 5

                  #11
                  It's very nice. I would say more appropriate for mid to large environments. There a many moving parts, and very fault tolerant. Zabbix sure does have the fast and easy market covered.

                  Comment


                  • ZMS
                    ZMS commented
                    Editing a comment
                    awsome
                    thanks
                • Juster737
                  Junior Member
                  • Sep 2019
                  • 3

                  #12
                  Я заметил особенность в том, что поиск по строке работает только если сайт в кодировке UTF-8

                  Comment

                  • Brookcie
                    Junior Member
                    • Mar 2022
                    • 1

                    #13
                    Hi all,

                    I know it's years later BUT I have found a (potential) work around for issues like this.

                    Firstly, Zabbix Web Scenario (as of today) works by fetching a GET request of sorts of the website you input. This Zabbix request grabs the PAGE SOURCE, and not necessarily the page you experience when viewing from a web browser. You can see this distinction when a page loads its DOM via a javascript file downloaded by the GET request - browsers have no issue with this BUT Zabbix does not support javascript in this way for Web Scenario.

                    Steps to (potentially) resolve this issue of "pattern not found" error (when it's clearly on the webpage when loaded via a browser):
                    1) Go to the website you wish to grab the string from.

                    2) Right click the webpage (in google chrome) and select 'View Page Source' - THIS is the data Zabbix will find when doing their GET request via Web Scenario.

                    3) At this stage, you can see the difference of Page Source and the 'Inspect Element' DOM (if any) and you will find that the string you're trying to find is NOT in the Page Source, which explains why the Zabbix request fails to find the string.

                    4) Now, you can either use a string found in your Page Source that you wish to use OR you can open up Google Dev Tools on the page and navigate to the Network tab.

                    5) In the Network tab, refresh the page and you'll see the files that the page loads as it renders.

                    6) The top file should be your web address, this is the Page Source and you can even use the 'Preview' tab if it's selected in the list to view what's rendered. It's typically a blank page with 'You need to enable JavaScript to run this app'.

                    7) Now, your webpage contents will be in one of the javascript files loaded further down in the list - find this file

                    8) Inside that file you'll be able to verify the contents that indeed has your string you wish Zabbix to check to make sure the webpage is loading properly.

                    9) The javascript file which contains your string text should be selected on the left of the 'Network' tab, goto the 'Headers' tab on the right, you should see the request URL - have Zabbix take THIS URL in your Web Scenario
                    e.g. {Base URL}/{folder}/javascript-main-file.js

                    10) Zabbix will now try and download the javascript file directly and check for a string and bypass the issue of javascript running to load the page.

                    Hope this works for anyone else with this issue!

                    Comment

                    • manikandan29
                      Junior Member
                      • Dec 2022
                      • 1

                      #14
                      Hi all i have some doubts on configuring the recovery expression for a trigger, Which checks for a string in the last error message of the web scenario, If the required string is not found on the web page it is throwing error properly, But the problem is when the string is found on the web page on the next runs the last error message is not generated, So the trigger stays in the problem state itself. Someone please help me in configuring a recovery expression for the trigger to come out of the problem state.

                      Comment

                      Working...