Ad Widget

Collapse

Problem with Web Monitoring feature

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicodelik
    Junior Member
    • Feb 2009
    • 5

    #1

    Problem with Web Monitoring feature

    Hello all,

    I am using a Zabbix server (version 1.6.1) since 2 months ago and I would first like to thank everybody for this product.

    Now that everything is configured, I would like to create Web scenario to be sure that my Web applications are UP.

    I so tried to configure it, but i always have the screen attached (unknown status).

    In the zabbix_server.log file i can see that (after a restart):

    2571:20090226:154109 ZABBIX Server stopped. ZABBIX 1.6.1.
    3756:20090226:154114 Starting zabbix_server. ZABBIX 1.6.1.
    3756:20090226:154114 **** Enabled features ****
    3756:20090226:154114 SNMP monitoring: YES
    3756:20090226:154114 WEB monitoring: NO
    3756:20090226:154114 Jabber notifications: NO
    3756:20090226:154114 ODBC: NO
    3756:20090226:154114 IPv6 support: NO
    3756:20090226:154114 **************************


    My question is so:
    How can I enable the Web Monitoring? Is it during the installation or is it possible to enable it easily?

    I tried to find an answer in the documentation and on the web, without success.

    Any clue would be appreciated.

    Thanks in advance... and sorry for the mistakes in english (still have to improve it).
    Attached Files
  • Calimero
    Senior Member
    • Nov 2006
    • 481

    #2
    You need to have libcurl installed (curl, curl-dev on redhat, for example).

    And then enable curl when configuring:

    ./configure --enable-server \
    --with-mysql=/usr/bin/mysql_config \
    --with-net-snmp \
    --with-libcurl=/usr/bin/curl-config \
    --prefix=/usr/local/zabbix-1.6.1

    Comment

    • nicodelik
      Junior Member
      • Feb 2009
      • 5

      #3
      Thanks a lot Calimero.

      To let you know:
      Zabbix was installed on a test server (a simple PC). I wanted to migrate it to a real server with a good processor and enough memory.

      So i did. I migrate the zabbix DB to the new server (Debian GNU/Linux 4.0) and installed zabbix as you adviced me to do:
      ./configure --enable-server --with-mysql --with-net-snmp --with-libcurl

      Now, things are going well. But I still have a problem with the web monitoring.

      I have different web applications that I would like to test. I followed the documentation procedure to first try with zabbix interface.

      To verify that it works, i used a special user (with read only rights) that would just be used by the zabbix Web monitoring. But i can't see this user logon in the log of zabbix. Apparently, Zabbix doesn't really log into the web interface. So I would like to know: How can i make zabbix click on the submit button to log in the Zabbix Web interface?

      here is the scenario (using the test user) and the step one details of the scenario.

      Thanks in advance for your help.
      Attached Files

      Comment

      • Calimero
        Senior Member
        • Nov 2006
        • 481

        #4
        You should always test your "advanced" (POST, ...) checks with curl before implementing them as web scenarios. It makes debugging easier as you see what zabbix will get.

        Here's the command line I used to successfully log into zabbix:

        Code:
        curl -v \
        --data 'form=1&form_refresh=1&name=monitoring&password=monitoring&enter=Enter' \
        'http://myzabbix.com/index.php?login=1'
        name and password must be urlencoded if they contain non-alphanumeric characters.

        Here's the output of curl for a successful login:
        Code:
        * About to connect() to myzabbix.com port 80
        *   Trying 172.31.246.61... connected
        * Connected to myzabbix.com (172.31.246.61) port 80
        > POST /index.php?login=1 HTTP/1.1
        > User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
        > Host: myzabbix.com
        > Accept: */*
        > Content-Length: 69
        > Content-Type: application/x-www-form-urlencoded
        >
        > form=1&form_refresh=1&name=monitoring&password=monitoring&enter=EnterHTTP/1.1 200 OK
        < Date: Tue, 03 Mar 2009 15:21:47 GMT
        < Server: Apache
        < X-Powered-By: PHP/5.1.6
        < Set-Cookie: zbx_sessionid=deleted; expires=Mon, 03-Mar-2008 15:21:46 GMT
        < Set-Cookie: zbx_sessionid=f4f967acd8b33a27ea2ba7579c22eb58
        < Content-Length: 79
        < Content-Type: text/html; charset=UTF-8
        <script type="text/javascript"><!--
        window.location = "index.php";
        Connection #0 to host myzabbix.com left intact
        * Closing connection #0
        We see that return code is 200 and there's the "window.location" string in case of success.

        So here's how I configured the "Login" step:

        Code:
        Name: Login
        URL: [url]http://myzabbix.com/index.php?login=1[/url]
        Post: form=1&form_refresh=1&name=monitoring&password=monitoring&enter=Enter
        Timeout: 15
        Required: window.location
        Status code: 200
        As far as I know, there's currently no cookie support in zabbix' web monitoring so I think you won't be able to go past the login screen. Maybe in the future zabbix will use libcurl's "cookie jar" to have cookies persist over steps.
        Last edited by Calimero; 03-03-2009, 17:40.

        Comment

        • nicodelik
          Junior Member
          • Feb 2009
          • 5

          #5
          Thanks a lot first for your reply... that helped me a lot with one website.

          Now, my colleagues just developed another web site that has as well to be monitored.

          So I followed ur advices and used curl first, that works great:

          Code:
           curl -v --ntlm --insecure --user 'user:pass' 'https://mysecuredsite.mydomain.com'
          So I get a beautiful 200 OK and see all the code of the page.

          But unfortunately, I don't know where to put this options in the Zabbix Web Monitoring page (the --ntlm has to be there or i get an error).

          I tried to insert --ntlm --insecure --user 'user: pass' in the scenario variables, and in the Step 1 post without success... it doesn't get 200 status or any code that is supposed to be in the page.

          Did anyone use theses curl options and succeed in implementing them in the Web Monitoring feature?

          Thanks in advance.

          Comment

          • Calimero
            Senior Member
            • Nov 2006
            • 481

            #6
            Curl options like '--insecure', '--ntlm' .... are set by Zabbix when initializing a new "session" with libcurl. zabbix_server uses libcurl and doesn't simply run "curl --options http://whatever...." shell commands.

            So if NTLM is really needed you would have to patch zabbix_server (+ DB to store a "NTLM" flag) ...

            Parameters that are equivalent to '--insecure' are automatically given to libcurl by zabbix_server.

            Anyway, the only easy workaround here seems to be the use of an External Script (with that curl command that works) instead of Zabbix' web monitoring.

            Comment

            • nicodelik
              Junior Member
              • Feb 2009
              • 5

              #7
              Thanks for your answer Calimero.

              To be sincere, i don't feel like patching my server now that everything (except this Web Monitoring) is working really well.

              I think i'll make a script that uses curl and send a mail if it gets a wrong answer.

              Thanks anyway for your help and congratz again for all the work u do.

              Comment

              • Calimero
                Senior Member
                • Nov 2006
                • 481

                #8
                Originally posted by nicodelik
                To be sincere, i don't feel like patching my server now that everything (except this Web Monitoring) is working really well.
                Indeed maintaining patches over time can be a pain in the ass... The only patches we have here a small things that don't impact the DB schema ...

                Originally posted by nicodelik
                I think i'll make a script that uses curl and send a mail if it gets a wrong answer.
                You can have zabbix run the script for you (see the "External Script" feature).
                Zabbix will run the script (with the hostname or IP as first argument, plus anything else you define in the GUI) and will then store whatever the script outputs (I suggest a numerical error code, 0=success, 1=failure type A, 2=failure type B ...).
                You'll then be able to have everything handled by zabbix: trigger, notifications ... Only the actual check is performed by your script.

                Having bits and pieces of monitoring in multiple tools/locations is cumbersome.

                And for jobs that cannot be run by zabbix (ie: monitoring a backup job that takes 2 hours), you can also use zabbix_sender to return data to zabbix_server and the end of the job and again have zabbix handle everything else: triggers, notifications, ...

                Comment

                Working...