Ad Widget

Collapse

failing to configure a web scenario with login form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • n.kretzer
    Junior Member
    • Oct 2020
    • 6

    #1

    failing to configure a web scenario with login form

    Hey there,

    I'm writing here because i've been stuck on a problem for days. I have multiple checks and triggers set up on my Zabbix, all is working fine. I have web scenarios checking the up/down state of lots of pages and everything is ok.

    Now for some reasons i would like to create a scenario where i would login to a post form on a web page i'm monitoring (mainly for database state awareness). And everytime I create a step checking a certain string on the page (after i've set up authentification steps, of course), it always fails with the error "Required pattern %whateverpatternthisis% not found".

    So for debugging purposes, I've created a simple host, forums.centos.org, which I try to log into. So far I have 2 steps, one logging in and checking if the result is 200, and one looking for a string validating that i'm connected and a 200 return code.

    My login step :

    Click image for larger version

Name:	Sans titre.png
Views:	3275
Size:	56.8 KB
ID:	410904

    I've also tried to login to the website myself, and with Chrome dev tools, grabbing the post data and putting all of it in "raw data" of this step, still no luck.

    My second step :

    Click image for larger version

Name:	step 2.png
Views:	3284
Size:	53.1 KB
ID:	410905

    The string "Private" should be on the monitored page once correctly logged in so my guess is that i'm not connected at all.

    Am i doing something wrong ? Is there a better way to login to a POST form and checking if you're logged in ?

    Thanks a lot.

    Regards.

    PS : for exemple, the POST data of a failed auth :

    Click image for larger version

Name:	Capture d’écran du 2020-10-15 15-56-30.png
Views:	3178
Size:	24.8 KB
ID:	410906
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Have you reviewed the "Real life scenario" from the Web monitoring chapter of the docs, https://www.zabbix.com/documentation...toring/example ?

    You probably need to capture a session ID or some other token as part of the response to the step 1 / login, and then submit that to steps 2 through N of your scenario.

    Comment

    • n.kretzer
      Junior Member
      • Oct 2020
      • 6

      #3
      Yes, i have successfully set up the real life scenario in my zabbix (logging into zabbix, checking, disconnecting). Works like a charm.
      I haven't set up the sid yet because I thought it was only needed for disconnection purposes later on. I'm gonna try to get it and pass it to my other steps. Thanks for the tip.

      Comment

      • tim.mooney
        Senior Member
        • Dec 2012
        • 1427

        #4
        Originally posted by n.kretzer
        I haven't set up the sid yet because I thought it was only needed for disconnection purposes later on. I'm gonna try to get it and pass it to my other steps. Thanks for the tip.
        Anything is possible, but my expectation is that you should be providing whatever session state token your application uses for steps 2 and on. I'm guessing you're aware that HTTP is a stateless protocol, but just so it's clear, it's providing that session or other token on every connection that allows the application to stitch together "state" (like, "logged in") over a stateless protocol.

        Comment

        Working...