Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Monitor your Web server in realtime, Part 2

Chart a real Web server's performance in realtime using Percollator

  • Print
  • Feedback
Give the current Percollator applet a try. The Panel defaults to the current file. Load it by depressing the "Load URL" button. A URL is generated and the corresponding file on the server is read. The data is stored in a class and the graphing panel is displayed. Every ten seconds the graph panel changes to another performance graph. Once a cycle is complete, you can select the Statistics panel and see the current average, minimum and maximum for the parameters that were just graphed. At the bottom of the Statistics panel is a button whereby you can mail the Statistics data as an applet.

This is the second installment on building a Web Server performance-monitoring tool in Java. In this article we'll cover the following topics:

  • How to send a mail message directly from an applet to a MIME-capable mail reader that can display executable content.
  • How to store data samples in a hierarchical calendar.
  • Setting alarms and delivering alerts.
  • Working with datafiles on a remote server that are being updated.
  • Graphing the states of the rules using colors and a modified Gantt chart.
  • General user Interface improvements and improved object-oriented design.


The current HTTP operations per second

You need a Java-enabled browser to view this applet.

The current percent of user time in terms of cpu percentage

You need a Java-enabled browser to view this applet.

Sending mail messages directly from an applet

The latest version of the Netscape mailer supports MIME mail messages, which support a content type allowing messages to be decoded and associated with some type of processing program. This is a very powerful feature that will facilitate the delivery of executable content directly in a mail message. The Percollator applet periodically receives updates from the Percollator.se tool, which generates log entries on the server being monitored. You can see how this works in this example applet and source code. A user-interface panel is provided to the user so that upper and lower thresholds can be set. A number of options were considered for implementing this functionality:

  • Write a cgi script and send the data from the applet as a post. This approach has the usual problems of additional dependencies on the server, redundant transmissions, and the use of yet another scripting language.
  • Write a server program that listens for the data, This approach requires more code, the definition of a protocol, and installing the server program on all the servers.
  • Use the browser APIs for sending mail messages. This approach requires different versions for each browser.
  • Use SMTP directly. SMTP was designed to support a pretty simple interface on a known port.
  • Use IMAP directly. IMAP is a little more involved than SMTP.


I decided to use the direct interface to SMTP. In order to send a mail message to a designated recipient you can follow the following steps:

  • Contact the local SMTP server on port 25. To verify that this will work on your system try the following telnet localhost 25. You should see something like this coming back. Type "quit" to exit.

  • Send the following strings:

        MAIL FROM: senders email address
        RCPT TO: recipient
        DATA 
                To: "Some String"
                Mime-Version: 1.0
                Content-type: text/html
                Subject: A Subject line
                <HTML>
                <HEAD>
                </HEAD>
                <BODY>
                <A HREF=\"$url\">form</A>.
                </BODY>
                </HTML>
            .
    


    The first three messages inform SMTP of the message sender, destination, and the actual message body as a MIME compliant message. Notice the "." to indicate the end of the message.

  • Print
  • Feedback
What is Tech Briefcase?
TechBriefcase is a new, free service where IT Professionals can Search, Store and Share IT white papers and content like this. Learn more
Bookmark content
Speed up your research efforts with content across the web.
Search and Store
Find the white papers you need. Create folders for any topic.
View Anywhere
Open your briefcase on your iPhone, tablet or desktop. Share with colleagues.
Don't have an account yet?

Resources