Ad Widget

Collapse

monitoring 500 error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pradhanparas
    Member
    • Jul 2012
    • 45

    #1

    monitoring 500 error

    How does one monitors apache 500 error and Internal server errors. I can check if apache is on or off but not sure how to monitor 500 and similar errors when the port 80 is up and running.

    How do you guys handle this?

    -Thanks
    Paras.
  • pxsh
    Junior Member
    • Oct 2013
    • 14

    #2
    I´ve not done this specific case myself yet but you could create a script that runs a curl towards your page and parse the http response code, then just print/echo it in the end of the script.

    Then add a row in your agentd conf file:
    UserParameter=http.status,/path/to/script/check_status.php

    Add item in Zabbix.
    Item type: Zabbix Agent
    Key: http.status

    Sample curl test in php (I´ve verified the code):

    Code:
    #!/usr/bin/php
    <?php
    $url = "http://www.yoursite.net/index.php";
    
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url );
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
    
    if(empty($result))
    {
      // fatal error, log error
    }
    else
    {
      $info = curl_getinfo($curl);
      curl_close($curl);
    
      if(empty($info['http_code']))
      {
         // no http response code received, log error
      }
      else
      {
         // http responce code received.
         echo $info['http_code'];
      }
    }
    ?>
    With the response code you can easily produce triggers.
    This should get you started with the task.

    Comment

    • pradhanparas
      Member
      • Jul 2012
      • 45

      #3
      Super ! Thanks for your help.

      Comment

      Working...