Maven Lee
Maven Lee

Reputation:

Is there any free java open source application that can monitor website status?

Anyone know any? I need to send in a http request and make sure the http response i got back is not http 500

Upvotes: 3

Views: 3052

Answers (5)

Maurice Perry
Maurice Perry

Reputation: 32831

http-unit

Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.

or html-unit

HtmlUnit is a "GUI-Less browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser.

It has fairly good JavaScript support (which is constantly improving) and is able to work even with quite complex AJAX libraries, simulating either Firefox or Internet Explorer depending on the configuration you want to use.

Upvotes: 0

jt.
jt.

Reputation: 7705

If you want to do this yourself, Apache HttpClient is an option:

GetMethod get = new GetMethod("http://www.stackoverflow.com");
try
{
    int resultCode = client.executeMethod(get);
    if (resultCode == 500)
    {
        //do something meaningful here

    } // if
} // try
catch (Exception e)
{
    e.printStackTrace();
}
finally
{
    get.releaseConnection();
}

Upvotes: 0

OscarRyz
OscarRyz

Reputation: 199333

While you find it you can use this:

import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;

public class SimplisticMonitor { 

    public static void main( String [] args ) throws IOException { 

        HttpURLConnection c = ( HttpURLConnection ) 
                      new URL( "http://stackoverflow.com" ).openConnection();

        System.out.println( c.getResponseCode() );
    }
}

Upvotes: 0

John Munsch
John Munsch

Reputation: 19528

I believe Hyperic HQ meets all of your criteria. It is open source, I believe it is written at least partially in Java, and it is designed to do all kinds of server monitoring.

It should be able to handle not only the kind of monitoring you requested but other necessary monitoring like memory, CPU usage, and disk space on your servers as well.

Upvotes: 3

Steve B.
Steve B.

Reputation: 57333

You could use httpunit - web-centric unit testing

Upvotes: 0

Related Questions