Is there a free, open source Java application that can monitor website status?

Somebody knows? I need to send an HTTP request and make sure that the HTTP response I received is not http 500

+3
source share
5 answers

I believe Hyperic HQ meets all your criteria. This is open source, I believe that it is written at least partially in Java, and it is designed for all types of server monitoring.

It should be able to handle not only the monitoring that you requested, but also other necessary monitoring, such as memory, CPU usage and disk space on your servers.

+3
source
0

http-unit

Java HttpUnit , , JavaScript, HTTP, , Java , XML DOM, , . , JUnit, , -.

html-unit

HtmlUnit - " GUI-Less Java-". HTML- API, , , ..... , "" .

It has pretty good JavaScript support (which is constantly being improved) and can even work with fairly complex AJAX libraries, mimicking Firefox or Internet Explorer, depending on the configuration you want to use.

0
source

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();
}
0
source

As long as 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() );
    }
}
0
source

Source: https://habr.com/ru/post/1704053/


All Articles