Ad Widget

Collapse

UserParameter check from server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bytesize
    Member
    • Aug 2005
    • 71

    #1

    UserParameter check from server

    Hi,

    I have several websites I need to monitor configured as hosts. Each host has http and http_perf simple checks which work great. The hostname is the URL of the site. e.g. www.google.com

    I have written a simple script which outputs the http status code which the server returns. I need this script to be executed from the Zabbix server itself, because there are no agents running on the websites I'm monitoring.

    How can I pass the hostname to the UserParameter (e.g. /path/script.sh {HOSTNAME}), and how can I tell Zabbix to execute the script on the Zabbix server itself instead of trying to run it on the host?

    Thanks!

    John
  • mary nancy
    Senior Member
    • Jul 2005
    • 125

    #2
    Hi

    if your trying to monitor the websites why dont you use this
    net.tcp.service[service ,ip ,port]
    Eg:- if your monitoring google then you may use net.tcp.service[http, 66.102.9.147, 80]
    where 66.102.9.147 is the ipaddress of the google server.

    This was my suggestion. I am not sure whether it served your Purpose

    Regards
    Nancy

    Comment

    • Nick.Langstone
      Junior Member
      • Mar 2006
      • 3

      #3
      Hi,
      using net.tcp.service[service ,ip ,port] is not god enough. I have the same requirement.
      using net.tcp.service[service ,ip ,port] only checks that a server respons on port 80 at the TCP level - it does not check to see if the server responds with anything sensible - it could be returning a status 500 and net.tcp.service[service ,ip ,port] would be happy - but the server is down.

      I need to check a specific set of urls and validate the response is sensible - and pass the responce time back to zabbix to show the performace of the web server.
      Has anyone done this ?
      Does anyone has some scripts as examples?

      Thanks in advance
      Nick

      Comment

      • bytesize
        Member
        • Aug 2005
        • 71

        #4
        Hi Nick,

        Here is the script I use to check the http statuscode of a request. I just need to find a way of running this against a host which doesn't have an agent on it!

        For example, I have a host called "www.google.com" which is not running a Zabbix Agent; it just has simple checks like http and http_perf. I need to run the script against the host, but run the script itself from the Zabbix server.

        Code:
        #!/bin/sh
        
        # Simple script to return HTTP statuscode
        # from website. This is useful to check the
        # server isnt returning errors
        
        # Syntax: ./check-http-resultcode.sh www.url.com
        
        URL=$1
        
        RESULT=`/usr/bin/curl -m 10 -i $URL 2>/dev/null | grep ^HTTP/ | awk '{ print $2 }'`
        
        if [ "$RESULT" == "" ]; then
            RESULT=0
        fi
        
        echo $RESULT

        Comment

        • Nick.Langstone
          Junior Member
          • Mar 2006
          • 3

          #5
          Hi everyone,
          yes - this is almost exactly the same as my script.
          Just a footnote on this discussion :-

          Scripts need to be FAST - if the web server decides to run slow - or is unreachable (think network failure), this script will timeout after about 5 seconds (TCP timeout) - however Zabbix will have been waiting the whole time.
          From the manual (Extending ZABBIX agents)

          Also, the scripts must be as quick as possible. The scripts must not run longer than 0.5 second, otherwise ZABBIX server will block on retrieval on the parameter, thus reducing overall performance. After three consequitive timeouts status of the parameter will be set to unsupported.

          You have been warned.......

          Does anyone has a 'safe' way to check slow services without killing Zabbix ?
          Is the solution to have a second agent dedicated to slow services ?

          Cheers
          Nick

          Comment

          • marius
            Member
            • Apr 2006
            • 47

            #6
            Originally posted by bytesize
            Hi Nick,

            Here is the script I use to check the http statuscode of a request. I just need to find a way of running this against a host which doesn't have an agent on it!

            For example, I have a host called "www.google.com" which is not running a Zabbix Agent; it just has simple checks like http and http_perf. I need to run the script against the host, but run the script itself from the Zabbix server.
            I have the same need to run a custom simple check script from the zabbix server. Anyone figure this out yet?

            Comment

            Working...